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 780e41f1 751359f9

+332 -126
+2 -2
predicate/conditions/damage_source_properties.go
··· 1 1 package conditions 2 2 3 3 import ( 4 - "tangled.org/cosmeak.tngl.sh/weave/predicate" 5 4 "tangled.org/cosmeak.tngl.sh/weave/predicate/internal/condition" 5 + "tangled.org/cosmeak.tngl.sh/weave/predicate/subpredicate" 6 6 ) 7 7 8 - func DamageSourceProperties(name string, directEntity predicate.Entity, sourceEntity predicate.Entity, isDirect bool, tags []string) condition.Condition { 8 + func DamageSourceProperties(name string, directEntity subpredicate.Entity, sourceEntity subpredicate.Entity, isDirect bool, tags []string) condition.Condition { 9 9 // todo 10 10 }
-123
predicate/entity.go
··· 1 - package predicate 2 - 3 - type minMaxInt struct { 4 - Min int 5 - Max int 6 - } 7 - 8 - type minMaxDouble struct { 9 - Min float64 10 - Max float64 11 - } 12 - 13 - type Entity struct { 14 - type_ []string 15 - // components 16 - distance Distance 17 - effects []Effect 18 - equipement []Equipement 19 - flags EntityFlag 20 - location Location 21 - nbt string 22 - passenger *Entity 23 - slots []Slot 24 - steppingOn Location 25 - movementAffectedBy Location 26 - team string 27 - targetedEntity *Entity 28 - vehicle *Entity 29 - movement Movement 30 - periodicTick int 31 - // predicates 32 - 33 - } 34 - 35 - type Distance struct { 36 - Absolute float32 37 - Horizontal float32 38 - X float32 39 - Y float32 40 - Z float32 41 - } 42 - 43 - // todo: Amplifier and Duration can be an object with min and max value 44 - type Effect struct { 45 - Name string 46 - Amplifier int 47 - Duration int 48 - Ambiant bool 49 - Visible bool 50 - } 51 - 52 - type EquipementSlot string 53 - 54 - const ( 55 - MainHand EquipementSlot = "mainhand" 56 - OffHand EquipementSlot = "offhand" 57 - Head EquipementSlot = "head" 58 - Chest EquipementSlot = "chest" 59 - Legs EquipementSlot = "legs" 60 - Feet EquipementSlot = "feet" 61 - Body EquipementSlot = "body" 62 - ) 63 - 64 - type Equipement struct { 65 - Slot EquipementSlot 66 - Items []string 67 - Count minMaxInt 68 - // Components 69 - // Predicates 70 - } 71 - 72 - type EntityFlag struct { 73 - IsBaby bool 74 - IsOnFire bool 75 - IsSneaking bool 76 - IsSprinting bool 77 - IsSwimming bool 78 - IsOnGround bool 79 - IsFlying bool 80 - } 81 - 82 - type Location struct { 83 - Biome []string 84 - Block struct { 85 - Blocks []string 86 - Nbt string 87 - State map[string]string 88 - // Components 89 - // Predicates 90 - } 91 - Dimension string 92 - Fluid struct { 93 - Fluids []string 94 - State map[string]string 95 - } 96 - Light minMaxInt 97 - Position struct { 98 - X minMaxDouble 99 - Y minMaxDouble 100 - Z minMaxDouble 101 - } 102 - Smokey bool 103 - CanSeeSky bool 104 - Structures []string 105 - } 106 - 107 - type Slot struct { 108 - Range string 109 - Items []string 110 - Count minMaxInt 111 - // Components 112 - // Predicatess 113 - } 114 - 115 - type Movement struct { 116 - X minMaxDouble 117 - Y minMaxDouble 118 - Z minMaxDouble 119 - Speed minMaxDouble 120 - HorizontalSpeed minMaxDouble 121 - VerticalSpeed minMaxDouble 122 - FallDistance minMaxDouble 123 - }
+1 -1
predicate/entity_to_check.go predicate/subpredicate/entity_to_check.go
··· 1 - package predicate 1 + package subpredicate 2 2 3 3 type EntityToCheck string 4 4
+9
predicate/subpredicate/distance.go
··· 1 + package subpredicate 2 + 3 + type Distance struct { 4 + Absolute float32 5 + Horizontal float32 6 + X float32 7 + Y float32 8 + Z float32 9 + }
+10
predicate/subpredicate/effect.go
··· 1 + package subpredicate 2 + 3 + // todo: Amplifier and Duration can be an object with min and max value 4 + type Effect struct { 5 + Name string 6 + Amplifier int 7 + Duration int 8 + Ambiant bool 9 + Visible bool 10 + }
+39
predicate/subpredicate/entity.go
··· 1 + package subpredicate 2 + 3 + type Entity struct { 4 + Type []string 5 + Components []Component 6 + Distance Distance 7 + Effects []Effect 8 + Equipement []Equipement 9 + Flags EntityFlag 10 + Location Location 11 + Nbt string 12 + Passenger *Entity 13 + Slots []Slot 14 + SteppingOn Location 15 + MovementAffectedBy Location 16 + Team string 17 + TargetedEntity *Entity 18 + Vehicle *Entity 19 + Movement Movement 20 + PeriodicTick int 21 + Predicates []PredicateComponent 22 + TypeSpecific EntityTypeSpecific 23 + SourceEntity *Entity 24 + IsDirect bool 25 + tags []struct { 26 + Id string 27 + Expected bool 28 + } 29 + } 30 + 31 + type EntityFlag struct { 32 + IsBaby bool 33 + IsOnFire bool 34 + IsSneaking bool 35 + IsSprinting bool 36 + IsSwimming bool 37 + IsOnGround bool 38 + IsFlying bool 39 + }
+192
predicate/subpredicate/entity_type_specific.go
··· 1 + package subpredicate 2 + 3 + type EntityTypeSpecific struct { 4 + Type string 5 + Fields map[string]any 6 + } 7 + 8 + func AxolotlTypeSpecific(variant string) EntityTypeSpecific { 9 + return EntityTypeSpecific{ 10 + Type: "axolotl", 11 + Fields: map[string]any{ 12 + "variant": variant, 13 + }, 14 + } 15 + } 16 + 17 + func CatTypeSpecific(variants ...string) EntityTypeSpecific { 18 + return EntityTypeSpecific{ 19 + Type: "cat", 20 + Fields: map[string]any{ 21 + "variant": variants, 22 + }, 23 + } 24 + } 25 + 26 + func FishingHookTypeSpecific(inOpenWater bool) EntityTypeSpecific { 27 + return EntityTypeSpecific{ 28 + Type: "cat", 29 + Fields: map[string]any{ 30 + "in_open_water": inOpenWater, 31 + }, 32 + } 33 + } 34 + 35 + func FoxTypeSpecific(variant string) EntityTypeSpecific { 36 + return EntityTypeSpecific{ 37 + Type: "fox", 38 + Fields: map[string]any{ 39 + "variant": variant, 40 + }, 41 + } 42 + } 43 + 44 + func FrogTypeSpecific(variants ...string) EntityTypeSpecific { 45 + return EntityTypeSpecific{ 46 + Type: "frog", 47 + Fields: map[string]any{ 48 + "variant": variants, 49 + }, 50 + } 51 + } 52 + 53 + func HorseTypeSpecific(variant string) EntityTypeSpecific { 54 + return EntityTypeSpecific{ 55 + Type: "horse", 56 + Fields: map[string]any{ 57 + "variant": variant, 58 + }, 59 + } 60 + } 61 + 62 + func LightningTypeSpecific(blocksSetOnFire MinMaxInt, entityStruck Entity) EntityTypeSpecific { 63 + return EntityTypeSpecific{ 64 + Type: "lightning", 65 + Fields: map[string]any{ 66 + "blocks_set_on_fire": blocksSetOnFire, 67 + "entity_struck": entityStruck, 68 + }, 69 + } 70 + } 71 + 72 + func LlamaTypeSpecific(variant string) EntityTypeSpecific { 73 + return EntityTypeSpecific{ 74 + Type: "llama", 75 + Fields: map[string]any{ 76 + "variant": variant, 77 + }, 78 + } 79 + } 80 + 81 + func MooshroomTypeSpecific(variant string) EntityTypeSpecific { 82 + return EntityTypeSpecific{ 83 + Type: "mooshroom", 84 + Fields: map[string]any{ 85 + "variant": variant, 86 + }, 87 + } 88 + } 89 + 90 + func PaintingTypeSpecific(variants ...string) EntityTypeSpecific { 91 + return EntityTypeSpecific{ 92 + Type: "painting", 93 + Fields: map[string]any{ 94 + "variant": variants, 95 + }, 96 + } 97 + } 98 + 99 + func ParrotTypeSpecific(variant string) EntityTypeSpecific { 100 + return EntityTypeSpecific{ 101 + Type: "parrot", 102 + Fields: map[string]any{ 103 + "variant": variant, 104 + }, 105 + } 106 + } 107 + 108 + func PlayerTypeSpecific(lookingAt Entity) EntityTypeSpecific { 109 + return EntityTypeSpecific{ 110 + Type: "player", 111 + Fields: map[string]any{ 112 + // 113 + }, 114 + } 115 + } 116 + 117 + func RabbitTypeSpecific(variant string) EntityTypeSpecific { 118 + return EntityTypeSpecific{ 119 + Type: "rabbit", 120 + Fields: map[string]any{ 121 + "variant": variant, 122 + }, 123 + } 124 + } 125 + 126 + func RaiderTypeSpecific(isCaptain, hasRaid bool) EntityTypeSpecific { 127 + return EntityTypeSpecific{ 128 + Type: "raider", 129 + Fields: map[string]any{ 130 + "is_captain": isCaptain, 131 + "has_raid": hasRaid, 132 + }, 133 + } 134 + } 135 + 136 + func SalmonTypeSpecific(variant string) EntityTypeSpecific { 137 + return EntityTypeSpecific{ 138 + Type: "salmon", 139 + Fields: map[string]any{ 140 + "variant": variant, 141 + }, 142 + } 143 + } 144 + 145 + func SheepTypeSpecific(sheared bool, variant string) EntityTypeSpecific { 146 + return EntityTypeSpecific{ 147 + Type: "sheep", 148 + Fields: map[string]any{ 149 + "sheared": sheared, 150 + "variant": variant, 151 + }, 152 + } 153 + } 154 + 155 + func SlimeTypeSpecific(min, max int) EntityTypeSpecific { 156 + return EntityTypeSpecific{ 157 + Type: "slime", 158 + Fields: map[string]any{ 159 + "size": map[string]int{ 160 + "min": min, 161 + "max": max, 162 + }, 163 + }, 164 + } 165 + } 166 + 167 + func TropicalFishTypeSpecific(variant string) EntityTypeSpecific { 168 + return EntityTypeSpecific{ 169 + Type: "tropical_fish", 170 + Fields: map[string]any{ 171 + "variant": variant, 172 + }, 173 + } 174 + } 175 + 176 + func VillagerTypeSpecific(variant string) EntityTypeSpecific { 177 + return EntityTypeSpecific{ 178 + Type: "villager", 179 + Fields: map[string]any{ 180 + "variant": variant, 181 + }, 182 + } 183 + } 184 + 185 + func WolfTypeSpecific(variants ...string) EntityTypeSpecific { 186 + return EntityTypeSpecific{ 187 + Type: "wolf", 188 + Fields: map[string]any{ 189 + "variant": variants, 190 + }, 191 + } 192 + }
+9
predicate/subpredicate/equipement.go
··· 1 + package subpredicate 2 + 3 + type Equipement struct { 4 + Slot EquipementSlot 5 + Items []string 6 + Count MinMaxInt 7 + // Components 8 + // Predicates 9 + }
+13
predicate/subpredicate/equipement_slot.go
··· 1 + package subpredicate 2 + 3 + type EquipementSlot string 4 + 5 + const ( 6 + MainHand EquipementSlot = "mainhand" 7 + OffHand EquipementSlot = "offhand" 8 + Head EquipementSlot = "head" 9 + Chest EquipementSlot = "chest" 10 + Legs EquipementSlot = "legs" 11 + Feet EquipementSlot = "feet" 12 + Body EquipementSlot = "body" 13 + )
+26
predicate/subpredicate/location.go
··· 1 + package subpredicate 2 + 3 + type Location struct { 4 + Biome []string 5 + Block struct { 6 + Blocks []string 7 + Nbt string 8 + State map[string]string 9 + // Components 10 + // Predicates 11 + } 12 + Dimension string 13 + Fluid struct { 14 + Fluids []string 15 + State map[string]string 16 + } 17 + Light MinMaxInt 18 + Position struct { 19 + X MinMaxDouble 20 + Y MinMaxDouble 21 + Z MinMaxDouble 22 + } 23 + Smokey bool 24 + CanSeeSky bool 25 + Structures []string 26 + }
+11
predicate/subpredicate/min_max.go
··· 1 + package subpredicate 2 + 3 + type MinMaxInt struct { 4 + Min int 5 + Max int 6 + } 7 + 8 + type MinMaxDouble struct { 9 + Min float64 10 + Max float64 11 + }
+11
predicate/subpredicate/movement.go
··· 1 + package subpredicate 2 + 3 + type Movement struct { 4 + X MinMaxDouble 5 + Y MinMaxDouble 6 + Z MinMaxDouble 7 + Speed MinMaxDouble 8 + HorizontalSpeed MinMaxDouble 9 + VerticalSpeed MinMaxDouble 10 + FallDistance MinMaxDouble 11 + }
+9
predicate/subpredicate/slot.go
··· 1 + package subpredicate 2 + 3 + type Slot struct { 4 + Range string 5 + Items []string 6 + Count MinMaxInt 7 + // Components 8 + // Predicatess 9 + }