A Minecraft datapack generator written in go.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

wip: predicate

cosmeak e49c068f 88f7ea26

+192
+15
predicate/conditions/all_of.go
··· 1 + package conditions 2 + 3 + import ( 4 + "tangled.org/cosmeak.tngl.sh/weave/predicate" 5 + "tangled.org/cosmeak.tngl.sh/weave/predicate/internal/condition" 6 + ) 7 + 8 + func AllOf(name string, terms ...predicate.Predicate) condition.Condition { 9 + return condition.MkCondition( 10 + "minecraft:all_of", 11 + map[string]any{ 12 + "terms": terms, 13 + }, 14 + ) 15 + }
+15
predicate/conditions/any_of.go
··· 1 + package conditions 2 + 3 + import ( 4 + "tangled.org/cosmeak.tngl.sh/weave/predicate" 5 + "tangled.org/cosmeak.tngl.sh/weave/predicate/internal/condition" 6 + ) 7 + 8 + func AnyOf(terms ...predicate.Predicate) condition.Condition { 9 + return condition.MkCondition( 10 + "minecraft:any_of", 11 + map[string]any{ 12 + "terms": terms, 13 + }, 14 + ) 15 + }
+13
predicate/conditions/block_state_property.go
··· 1 + package conditions 2 + 3 + import "tangled.org/cosmeak.tngl.sh/weave/predicate/internal/condition" 4 + 5 + // todo: implement the properties options 6 + func BlockStateProperty(block string) condition.Condition { 7 + return condition.MkCondition( 8 + "block_state_property", 9 + map[string]any{ 10 + "block": block, 11 + }, 12 + ) 13 + }
+10
predicate/conditions/damage_source_properties.go
··· 1 + package conditions 2 + 3 + import ( 4 + "tangled.org/cosmeak.tngl.sh/weave/predicate" 5 + "tangled.org/cosmeak.tngl.sh/weave/predicate/internal/condition" 6 + ) 7 + 8 + func DamageSourceProperties(name string, directEntity predicate.Entity, sourceEntity predicate.Entity, isDirect bool, tags []string) condition.Condition { 9 + // todo 10 + }
+95
predicate/entity.go
··· 1 + package predicate 2 + 3 + type Entity struct { 4 + type_ []string 5 + // components 6 + distance Distance 7 + effects []Effect 8 + equipement []Equipement 9 + flags EntityFlag 10 + location Location 11 + nbt string 12 + passenger *Entity 13 + } 14 + 15 + type Distance struct { 16 + Absolute float32 17 + Horizontal float32 18 + X float32 19 + Y float32 20 + Z float32 21 + } 22 + 23 + // todo: Amplifier and Duration can be an object with min and max value 24 + type Effect struct { 25 + Name string 26 + Amplifier int 27 + Duration int 28 + Ambiant bool 29 + Visible bool 30 + } 31 + 32 + type EquipementSlot string 33 + 34 + const ( 35 + MainHand EquipementSlot = "mainhand" 36 + OffHand EquipementSlot = "offhand" 37 + Head EquipementSlot = "head" 38 + Chest EquipementSlot = "chest" 39 + Legs EquipementSlot = "legs" 40 + Feet EquipementSlot = "feet" 41 + Body EquipementSlot = "body" 42 + ) 43 + 44 + type Equipement struct { 45 + Slot EquipementSlot 46 + Items []string 47 + Count minMaxInt 48 + // Components 49 + // Predicates 50 + } 51 + 52 + type EntityFlag struct { 53 + IsBaby bool 54 + IsOnFire bool 55 + IsSneaking bool 56 + IsSprinting bool 57 + IsSwimming bool 58 + IsOnGround bool 59 + IsFlying bool 60 + } 61 + 62 + type Location struct { 63 + Biome []string 64 + Block struct { 65 + Blocks []string 66 + Nbt string 67 + State map[string]string 68 + // Components 69 + // Predicates 70 + } 71 + Dimension string 72 + Fluid struct { 73 + Fluids []string 74 + State map[string]string 75 + } 76 + Light minMaxInt 77 + Position struct { 78 + X minMaxDouble 79 + Y minMaxDouble 80 + Z minMaxDouble 81 + } 82 + Smokey bool 83 + CanSeeSky bool 84 + Structures []string 85 + } 86 + 87 + type minMaxInt struct { 88 + Min int 89 + Max int 90 + } 91 + 92 + type minMaxDouble struct { 93 + Min float64 94 + Max float64 95 + }
+12
predicate/entity_to_check.go
··· 1 + package predicate 2 + 3 + type EntityToCheck string 4 + 5 + const ( 6 + Attacker EntityToCheck = "attacker" 7 + AttackingPlayer EntityToCheck = "attacking_player" 8 + DirectAttacker EntityToCheck = "direct_attacker" 9 + InteractingEntity EntityToCheck = "interacting_entity" 10 + TargetEntity EntityToCheck = "target_entity" 11 + This EntityToCheck = "this" 12 + )
+13
predicate/internal/condition/condition.go
··· 1 + package condition 2 + 3 + type Condition struct { 4 + name string 5 + fields map[string]any 6 + } 7 + 8 + func MkCondition(name string, fields map[string]any) Condition { 9 + return Condition{ 10 + name: name, 11 + fields: fields, 12 + } 13 + }
+19
predicate/predicate.go
··· 1 + package predicate 2 + 3 + import "tangled.org/cosmeak.tngl.sh/weave/predicate/internal/condition" 4 + 5 + type Predicate struct { 6 + name string 7 + condition condition.Condition 8 + } 9 + 10 + func (p Predicate) Type() string { 11 + return "predicate" 12 + } 13 + 14 + func MkPredicate(name string, condition condition.Condition) Predicate { 15 + return Predicate{ 16 + name: name, 17 + condition: condition, 18 + } 19 + }