From 13969a35060305f17d0e7e4dc176892d9e4eb704 Mon Sep 17 00:00:00 2001 From: Bloo Date: Fri, 7 Nov 2025 00:15:39 +0100 Subject: [PATCH 01/12] Add Concept --- gm4_lavish_livestock/beet.yaml | 34 +++++++++++++++++++ .../advancements/breed_pig.json | 15 ++++++++ .../advancements/feed_livestock.json | 18 ++++++++++ .../breed/determine_parent.mcfunction | 22 ++++++++++++ .../breed/initialize_marker.mcfunction | 2 ++ .../breed/revoke_advancement.mcfunction | 5 +++ .../feed/revoke_advancement.mcfunction | 2 ++ .../function/find_baby.mcfunction | 1 + .../function/init.mcfunction | 12 +++++++ .../function/modify_baby.mcfunction | 7 ++++ .../function/pick_type.mcfunction | 4 +++ 11 files changed, 122 insertions(+) create mode 100644 gm4_lavish_livestock/beet.yaml create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction diff --git a/gm4_lavish_livestock/beet.yaml b/gm4_lavish_livestock/beet.yaml new file mode 100644 index 0000000000..ac0028ea06 --- /dev/null +++ b/gm4_lavish_livestock/beet.yaml @@ -0,0 +1,34 @@ +id: gm4_lavish_livestock +name: Lavish Livestock +version: 1.0.0 + +data_pack: + load: . + +resource_pack: + load: . + +pipeline: + - gm4.plugins.extend.module + +meta: + gm4: + versioning: + schedule_loops: [] + website: + description: Huh? + recommended: + - gm4_enderman_support_class + notes: + - Modifies loot tables. + #modrinth: + # project_id: qWQqEQMY + #smithed: + # pack_id: gm4_bat_grenades + #planetminecraft: + # uid: 4293806 + #video: https://www.youtube.com/watch?v=uUoEKtte1GQ + wiki: https://wiki.gm4.co/wiki/Lavish_Livestock + credits: + Creator: + - Bloo diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json new file mode 100644 index 0000000000..8128d2fbc6 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json @@ -0,0 +1,15 @@ +{ + "criteria": { + "breed_pigs": { + "trigger": "minecraft:bred_animals", + "conditions": { + "child": { + "type": "pig" + } + } + } + }, + "rewards": { + "function": "gm4_lavish_livestock:breed/revoke_advancement" + } +} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json new file mode 100644 index 0000000000..b43605ceba --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json @@ -0,0 +1,18 @@ +{ + "criteria": { + "g": { + "trigger": "minecraft:player_interacted_with_entity", + "conditions": { + "item": { + "items": "minecraft:carrot" + }, + "entity": { + "type": "minecraft:pig" + } + } + } + }, + "rewards": { + "function": "gm4_lavish_livestock:feed/revoke_advancement" + } +} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction new file mode 100644 index 0000000000..e3fadb4849 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction @@ -0,0 +1,22 @@ + +# if the other parent candidate was already tested and selected as the parent, abort +execute if score $parent_selected gm4_lavish_livestock_data matches 1.. run return fail + +# no parent selected yet +# if the other parent candidate was already tested but not selected as the parent, make this candidate the parent +execute if score $parent_selected gm4_lavish_livestock_data matches 0 run scoreboard players set $parent_selected gm4_lavish_livestock_data 1 +# if the other parent candidate was not tested yet, roll a 50/50 whether this candidate should be the parent +execute if score $parent_selected gm4_lavish_livestock_data matches -1 store result score $parent_selected gm4_lavish_livestock_data run random roll 0..1 +# if this candidate was not selected, abort +execute if score $parent_selected gm4_lavish_livestock_data matches 0 run return fail + +# this candidate is the parent, transfer its stats to breeding site marker +execute unless score @s gm4_lavish_livestock_size matches 0..2 run scoreboard players set @s gm4_lavish_livestock_size 0 +scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute summon marker run function gm4_lavish_livestock:breed/initialize_marker + +say am parent! +effect give @s regeneration infinite 0 false + +# delay for one tick until child is alive +schedule function gm4_lavish_livestock:find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction new file mode 100644 index 0000000000..5573e2c5e3 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction @@ -0,0 +1,2 @@ +scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size +tag @s add gm4_lavish_livestock_breeding_site diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction new file mode 100644 index 0000000000..b58ae524bc --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction @@ -0,0 +1,5 @@ +advancement revoke @s only gm4_lavish_livestock:breed_pig + +scoreboard players set $parent_selected gm4_lavish_livestock_data -1 +execute as @e[type=pig,distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:breed/determine_parent +schedule function gm4_lavish_livestock:find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction new file mode 100644 index 0000000000..8e4a6a91ff --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction @@ -0,0 +1,2 @@ +advancement revoke @s only gm4_lavish_livestock:feed_livestock +execute as @e[type=pig,distance=..10,nbt={InLove:600}] run tag @s add gm4_lavish_livestock_fed diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction new file mode 100644 index 0000000000..df8b4663ca --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction @@ -0,0 +1 @@ +execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site] at @s run function gm4_lavish_livestock:pick_type diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction new file mode 100644 index 0000000000..3845cea9bf --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction @@ -0,0 +1,12 @@ +execute unless score lavish_livestock gm4_modules matches 1 run data modify storage gm4:log queue append value {type:"install",module:"Lavish Livestock"} +execute unless score lavish_livestock gm4_earliest_version < lavish_livestock gm4_modules run scoreboard players operation lavish_livestock gm4_earliest_version = lavish_livestock gm4_modules +scoreboard players set lavish_livestock gm4_modules 1 + +scoreboard objectives add gm4_lavish_livestock_data dummy +scoreboard objectives add gm4_lavish_livestock_size dummy + +schedule function gm4_lavish_livestock:main 1t + + + +#$moduleUpdateList diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction new file mode 100644 index 0000000000..f24737585e --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction @@ -0,0 +1,7 @@ +say found me! +effect give @s absorption infinite 0 false + +scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size +execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:1} run scoreboard players add @s gm4_lavish_livestock_size 1 +execute if score @s gm4_lavish_livestock_size matches 1 run attribute @s minecraft:scale modifier add gm4_lavish_livestock:size 0.2 add_multiplied_base +execute if score @s gm4_lavish_livestock_size matches 2 run attribute @s minecraft:scale modifier add gm4_lavish_livestock:size 0.4 add_multiplied_base diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction new file mode 100644 index 0000000000..3f5e455d65 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction @@ -0,0 +1,4 @@ +scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute as @e[type=pig,distance=..10,nbt={Age:-24000},limit=1,sort=nearest] at @s run function gm4_lavish_livestock:modify_baby + +kill @s From 797894e61021a100c72653c2a6f17421e47d5953 Mon Sep 17 00:00:00 2001 From: Bloo Date: Fri, 7 Nov 2025 22:24:28 +0100 Subject: [PATCH 02/12] Refactor --- .../{breed_pig.json => breed.json} | 2 +- .../advancements/feed_livestock.json | 18 ------------------ .../breed/initialize_marker.mcfunction | 2 -- .../breed/revoke_advancement.mcfunction | 5 ----- .../{breed => }/determine_parent.mcfunction | 9 +++++---- .../feed/revoke_advancement.mcfunction | 2 -- .../function/find_baby.mcfunction | 5 +++++ .../function/init.mcfunction | 4 ---- .../function/initialize_marker.mcfunction | 7 +++++++ .../function/modify_baby.mcfunction | 6 ++++-- .../function/pick_type.mcfunction | 9 ++++++++- .../function/revoke_advancement.mcfunction | 13 +++++++++++++ 12 files changed, 43 insertions(+), 39 deletions(-) rename gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/{breed_pig.json => breed.json} (79%) delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction rename gm4_lavish_livestock/data/gm4_lavish_livestock/function/{breed => }/determine_parent.mcfunction (81%) delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json similarity index 79% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json rename to gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json index 8128d2fbc6..33bf4562dd 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed_pig.json +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json @@ -10,6 +10,6 @@ } }, "rewards": { - "function": "gm4_lavish_livestock:breed/revoke_advancement" + "function": "gm4_lavish_livestock:revoke_advancement" } } diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json deleted file mode 100644 index b43605ceba..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/feed_livestock.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "criteria": { - "g": { - "trigger": "minecraft:player_interacted_with_entity", - "conditions": { - "item": { - "items": "minecraft:carrot" - }, - "entity": { - "type": "minecraft:pig" - } - } - } - }, - "rewards": { - "function": "gm4_lavish_livestock:feed/revoke_advancement" - } -} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction deleted file mode 100644 index 5573e2c5e3..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/initialize_marker.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size -tag @s add gm4_lavish_livestock_breeding_site diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction deleted file mode 100644 index b58ae524bc..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/revoke_advancement.mcfunction +++ /dev/null @@ -1,5 +0,0 @@ -advancement revoke @s only gm4_lavish_livestock:breed_pig - -scoreboard players set $parent_selected gm4_lavish_livestock_data -1 -execute as @e[type=pig,distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:breed/determine_parent -schedule function gm4_lavish_livestock:find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/determine_parent.mcfunction similarity index 81% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction rename to gm4_lavish_livestock/data/gm4_lavish_livestock/function/determine_parent.mcfunction index e3fadb4849..669b8d058b 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/breed/determine_parent.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/determine_parent.mcfunction @@ -1,3 +1,7 @@ +# Selects one of the two parents of the baby as the source of the inherited size +# @s = parent of the baby +# at location of player who has fed the parent +# run from gm4_lavish_livestock:revoke_advancement # if the other parent candidate was already tested and selected as the parent, abort execute if score $parent_selected gm4_lavish_livestock_data matches 1.. run return fail @@ -13,10 +17,7 @@ execute if score $parent_selected gm4_lavish_livestock_data matches 0 run return # this candidate is the parent, transfer its stats to breeding site marker execute unless score @s gm4_lavish_livestock_size matches 0..2 run scoreboard players set @s gm4_lavish_livestock_size 0 scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute summon marker run function gm4_lavish_livestock:breed/initialize_marker - -say am parent! -effect give @s regeneration infinite 0 false +execute summon marker run function gm4_lavish_livestock:initialize_marker # delay for one tick until child is alive schedule function gm4_lavish_livestock:find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction deleted file mode 100644 index 8e4a6a91ff..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/feed/revoke_advancement.mcfunction +++ /dev/null @@ -1,2 +0,0 @@ -advancement revoke @s only gm4_lavish_livestock:feed_livestock -execute as @e[type=pig,distance=..10,nbt={InLove:600}] run tag @s add gm4_lavish_livestock_fed diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction index df8b4663ca..94d94d06aa 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction @@ -1 +1,6 @@ +# Called once the parent has given birth and initiates breeding sites to look for babies. +# @s = undefined +# at undefined +# scheduled from gm4_lavish_livestock:revoke_advancement + execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site] at @s run function gm4_lavish_livestock:pick_type diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction index 3845cea9bf..db08dc1177 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction @@ -5,8 +5,4 @@ scoreboard players set lavish_livestock gm4_modules 1 scoreboard objectives add gm4_lavish_livestock_data dummy scoreboard objectives add gm4_lavish_livestock_size dummy -schedule function gm4_lavish_livestock:main 1t - - - #$moduleUpdateList diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction new file mode 100644 index 0000000000..9386c964c5 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction @@ -0,0 +1,7 @@ +# Initializes the breeding site marker which sticks around awaiting birth +# @s = new breeding site marker +# at location of player who has fed the parent +# run from gm4_lavish_livestock:determine_parent + +scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size +tag @s add gm4_lavish_livestock_breeding_site diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction index f24737585e..f50f52f763 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction @@ -1,5 +1,7 @@ -say found me! -effect give @s absorption infinite 0 false +# Sets the size of the newborn baby +# @s = the newborn baby +# at location of breeding site marker +# run from gm4_lavish_livestock:pick_type scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:1} run scoreboard players add @s gm4_lavish_livestock_size 1 diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction index 3f5e455d65..1ee7946df5 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction @@ -1,4 +1,11 @@ +# Selects babies near the breeding site +# @s = breeding site +# at @s +# run from gm4_lavish_livestock:find_baby + +# cache parent size scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute as @e[type=pig,distance=..10,nbt={Age:-24000},limit=1,sort=nearest] at @s run function gm4_lavish_livestock:modify_baby +execute as @e[type=pig,distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:modify_baby +# remove breeding site marker kill @s diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction new file mode 100644 index 0000000000..ea239858e6 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction @@ -0,0 +1,13 @@ +# Revokes the breeding advancement and initiates baby tracking +# @s = player who bred livestock +# at @s +# run from advancement gm4_lavish_livestock:breed + +advancement revoke @s only gm4_lavish_livestock:breed + +# determine parent to inherit size from +scoreboard players set $parent_selected gm4_lavish_livestock_data -1 +execute as @e[type=pig,distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:determine_parent + +# await birth +schedule function gm4_lavish_livestock:find_baby 1t From 6e5bb6320b233daf8dfff1ce2ae0a8d454fee3dd Mon Sep 17 00:00:00 2001 From: Bloo Date: Sat, 8 Nov 2025 11:22:43 +0100 Subject: [PATCH 03/12] Use Templates, Adjust Size Increments --- gm4_lavish_livestock/beet.yaml | 18 +++++---- .../function/modify_baby.mcfunction | 9 ----- .../function/revoke_advancement.mcfunction | 13 ------ .../advancement}/breed.json | 4 +- .../function/cache_size.mcfunction} | 4 +- .../function/determine_parent.mcfunction | 14 +++---- .../function/find_baby.mcfunction | 4 +- .../{ => templates}/function/init.mcfunction | 1 - .../function/initialize_marker.mcfunction | 3 +- .../templates/function/modify_baby.mcfunction | 16 ++++++++ .../function/revoke_advancement.mcfunction | 13 ++++++ .../templates/loot_table/lavish_death.json | 23 +++++++++++ gm4_lavish_livestock/generate.py | 40 +++++++++++++++++++ gm4_lavish_livestock/raw/livestock.csv | 7 ++++ 14 files changed, 124 insertions(+), 45 deletions(-) delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction rename gm4_lavish_livestock/data/gm4_lavish_livestock/{advancements => templates/advancement}/breed.json (64%) rename gm4_lavish_livestock/data/gm4_lavish_livestock/{function/pick_type.mcfunction => templates/function/cache_size.mcfunction} (51%) rename gm4_lavish_livestock/data/gm4_lavish_livestock/{ => templates}/function/determine_parent.mcfunction (66%) rename gm4_lavish_livestock/data/gm4_lavish_livestock/{ => templates}/function/find_baby.mcfunction (50%) rename gm4_lavish_livestock/data/gm4_lavish_livestock/{ => templates}/function/init.mcfunction (89%) rename gm4_lavish_livestock/data/gm4_lavish_livestock/{ => templates}/function/initialize_marker.mcfunction (72%) create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/templates/loot_table/lavish_death.json create mode 100644 gm4_lavish_livestock/generate.py create mode 100644 gm4_lavish_livestock/raw/livestock.csv diff --git a/gm4_lavish_livestock/beet.yaml b/gm4_lavish_livestock/beet.yaml index ac0028ea06..fffdacc2ad 100644 --- a/gm4_lavish_livestock/beet.yaml +++ b/gm4_lavish_livestock/beet.yaml @@ -8,7 +8,11 @@ data_pack: resource_pack: load: . +require: + - bolt + pipeline: + - gm4_lavish_livestock.generate - gm4.plugins.extend.module meta: @@ -16,18 +20,16 @@ meta: versioning: schedule_loops: [] website: - description: Huh? + description: Selectively breed your livestock for increased yields! Commercialize your farming! recommended: - - gm4_enderman_support_class - notes: - - Modifies loot tables. + - gm4_pig_tractors + - metallurgy #modrinth: - # project_id: qWQqEQMY + # project_id: #smithed: - # pack_id: gm4_bat_grenades + # pack_id: #planetminecraft: - # uid: 4293806 - #video: https://www.youtube.com/watch?v=uUoEKtte1GQ + # uid: wiki: https://wiki.gm4.co/wiki/Lavish_Livestock credits: Creator: diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction deleted file mode 100644 index f50f52f763..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction +++ /dev/null @@ -1,9 +0,0 @@ -# Sets the size of the newborn baby -# @s = the newborn baby -# at location of breeding site marker -# run from gm4_lavish_livestock:pick_type - -scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size -execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:1} run scoreboard players add @s gm4_lavish_livestock_size 1 -execute if score @s gm4_lavish_livestock_size matches 1 run attribute @s minecraft:scale modifier add gm4_lavish_livestock:size 0.2 add_multiplied_base -execute if score @s gm4_lavish_livestock_size matches 2 run attribute @s minecraft:scale modifier add gm4_lavish_livestock:size 0.4 add_multiplied_base diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction deleted file mode 100644 index ea239858e6..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# Revokes the breeding advancement and initiates baby tracking -# @s = player who bred livestock -# at @s -# run from advancement gm4_lavish_livestock:breed - -advancement revoke @s only gm4_lavish_livestock:breed - -# determine parent to inherit size from -scoreboard players set $parent_selected gm4_lavish_livestock_data -1 -execute as @e[type=pig,distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:determine_parent - -# await birth -schedule function gm4_lavish_livestock:find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json similarity index 64% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json rename to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json index 33bf4562dd..9d687e76e3 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json @@ -4,12 +4,12 @@ "trigger": "minecraft:bred_animals", "conditions": { "child": { - "type": "pig" + "type": "{{ entity_id }}" } } } }, "rewards": { - "function": "gm4_lavish_livestock:revoke_advancement" + "function": "gm4_lavish_livestock:{{ entity_id }}/revoke_advancement" } } diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction similarity index 51% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction rename to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction index 1ee7946df5..7a38fc8978 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/pick_type.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction @@ -1,11 +1,11 @@ # Selects babies near the breeding site # @s = breeding site # at @s -# run from gm4_lavish_livestock:find_baby +# run from gm4_lavish_livestock:{{ entity_id }}/find_baby # cache parent size scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute as @e[type=pig,distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:modify_baby +execute as @e[type={{ entity_id }},distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:{{ entity_id }}/modify_baby # remove breeding site marker kill @s diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/determine_parent.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction similarity index 66% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/function/determine_parent.mcfunction rename to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction index 669b8d058b..615ad0705e 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/determine_parent.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction @@ -1,23 +1,23 @@ # Selects one of the two parents of the baby as the source of the inherited size # @s = parent of the baby # at location of player who has fed the parent -# run from gm4_lavish_livestock:revoke_advancement +# run from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement # if the other parent candidate was already tested and selected as the parent, abort -execute if score $parent_selected gm4_lavish_livestock_data matches 1.. run return fail +execute if score $parent_selected gm4_lavish_livestock_size matches 1.. run return fail # no parent selected yet # if the other parent candidate was already tested but not selected as the parent, make this candidate the parent -execute if score $parent_selected gm4_lavish_livestock_data matches 0 run scoreboard players set $parent_selected gm4_lavish_livestock_data 1 +execute if score $parent_selected gm4_lavish_livestock_size matches 0 run scoreboard players set $parent_selected gm4_lavish_livestock_size 1 # if the other parent candidate was not tested yet, roll a 50/50 whether this candidate should be the parent -execute if score $parent_selected gm4_lavish_livestock_data matches -1 store result score $parent_selected gm4_lavish_livestock_data run random roll 0..1 +execute if score $parent_selected gm4_lavish_livestock_size matches -1 store result score $parent_selected gm4_lavish_livestock_size run random value 0..1 # if this candidate was not selected, abort -execute if score $parent_selected gm4_lavish_livestock_data matches 0 run return fail +execute if score $parent_selected gm4_lavish_livestock_size matches 0 run return fail # this candidate is the parent, transfer its stats to breeding site marker execute unless score @s gm4_lavish_livestock_size matches 0..2 run scoreboard players set @s gm4_lavish_livestock_size 0 scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute summon marker run function gm4_lavish_livestock:initialize_marker +execute summon marker run function gm4_lavish_livestock:{{ entity_id }}/initialize_marker # delay for one tick until child is alive -schedule function gm4_lavish_livestock:find_baby 1t +schedule function gm4_lavish_livestock:{{ entity_id }}/find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction similarity index 50% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction rename to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction index 94d94d06aa..f9346c862d 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/find_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction @@ -1,6 +1,6 @@ # Called once the parent has given birth and initiates breeding sites to look for babies. # @s = undefined # at undefined -# scheduled from gm4_lavish_livestock:revoke_advancement +# scheduled from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement -execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site] at @s run function gm4_lavish_livestock:pick_type +execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site,tag=gm4_lavish_livestock_{{ entity_id }}] at @s run function gm4_lavish_livestock:{{ entity_id }}/cache_size diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/init.mcfunction similarity index 89% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction rename to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/init.mcfunction index db08dc1177..03cc419d13 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/init.mcfunction @@ -2,7 +2,6 @@ execute unless score lavish_livestock gm4_modules matches 1 run data modify stor execute unless score lavish_livestock gm4_earliest_version < lavish_livestock gm4_modules run scoreboard players operation lavish_livestock gm4_earliest_version = lavish_livestock gm4_modules scoreboard players set lavish_livestock gm4_modules 1 -scoreboard objectives add gm4_lavish_livestock_data dummy scoreboard objectives add gm4_lavish_livestock_size dummy #$moduleUpdateList diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction similarity index 72% rename from gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction rename to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction index 9386c964c5..2493bad137 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/function/initialize_marker.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction @@ -1,7 +1,8 @@ # Initializes the breeding site marker which sticks around awaiting birth # @s = new breeding site marker # at location of player who has fed the parent -# run from gm4_lavish_livestock:determine_parent +# run from gm4_lavish_livestock:{{ entity_id }}/determine_parent scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size tag @s add gm4_lavish_livestock_breeding_site +tag @s add gm4_lavish_livestock_{{ entity_id }} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction new file mode 100644 index 0000000000..d0d7e6a520 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction @@ -0,0 +1,16 @@ +# Sets the size of the newborn baby +# @s = the newborn baby +# at location of breeding site marker +# run from gm4_lavish_livestock:{{ entity_id }}/cache_size + +# get parent size and roll chance to increase in size +scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size +execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:0.05} run scoreboard players add @s gm4_lavish_livestock_size 1 + +# if non-vanilla size: add loot table and tag entity (tag is for future-proofing only, it is not currently read) +execute if score @s gm4_lavish_livestock_size matches 1.. run tag @s add gm4_lavish_livestock_{{ entity_id }} +execute if score @s gm4_lavish_livestock_size matches 1.. run data modify entity @s DeathLootTable set value "gm4_lavish_livestock:{{ entity_id }}/lavish_death" + +# set scale attribute +execute if score @s gm4_lavish_livestock_size matches 1 run attribute @s minecraft:scale modifier add gm4_lavish_livestock:size 0.125 add_multiplied_base +execute if score @s gm4_lavish_livestock_size matches 2 run attribute @s minecraft:scale modifier add gm4_lavish_livestock:size 0.25 add_multiplied_base diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction new file mode 100644 index 0000000000..9b7f3cf15c --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction @@ -0,0 +1,13 @@ +# Revokes the breeding advancement and initiates baby tracking +# @s = player who bred livestock +# at @s +# run from advancement gm4_lavish_livestock:{{ entity_id }}/breed + +advancement revoke @s only gm4_lavish_livestock:{{ entity_id }}/breed + +# determine parent to inherit size from +scoreboard players set $parent_selected gm4_lavish_livestock_size -1 +execute as @e[type={{ entity_id }},distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:{{ entity_id }}/determine_parent + +# await birth +schedule function gm4_lavish_livestock:find_baby 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/loot_table/lavish_death.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/loot_table/lavish_death.json new file mode 100644 index 0000000000..74a9f1e6a2 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/loot_table/lavish_death.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "rolls": { + "type": "minecraft:score", + "target": { + "type": "minecraft:context", + "target": "this" + }, + "score": "gm4_lavish_livestock_size", + "scale": 2.5 + }, + "entries": [ + { + "type": "minecraft:loot_table", + "value": "minecraft:entities/{{ entity_id }}" + } + ] + } + ], + "random_sequence": "minecraft:entities/{{ entity_id }}" +} diff --git a/gm4_lavish_livestock/generate.py b/gm4_lavish_livestock/generate.py new file mode 100644 index 0000000000..1a6e6298a0 --- /dev/null +++ b/gm4_lavish_livestock/generate.py @@ -0,0 +1,40 @@ +from pathlib import Path +import logging + +from beet import Context, subproject +from gm4.utils import CSV + +logger = logging.getLogger(__name__) + +def beet_default(ctx: Context): + + # load csv + csv = CSV.from_file(Path('gm4_lavish_livestock', 'raw', 'livestock.csv')) + + # prepare list of supported entities + entity_ids = [e.get('entity_id', "").removeprefix('minecraft:').strip() for e in csv] + + # for each wood type in the vanilla doors tag, render a copy of the "templates" directory with the appropriate wood-type + for entity in entity_ids: + logger.info(f"adding entity type {entity}") + subproject_config = { + "data_pack": { + "load": [ + { + f"data/gm4_lavish_livestock/advancement/{entity}": "data/gm4_lavish_livestock/templates/advancement", + f"data/gm4_lavish_livestock/function/{entity}": "data/gm4_lavish_livestock/templates/function", + f"data/gm4_lavish_livestock/loot_table/{entity}": "data/gm4_lavish_livestock/templates/loot_table", + } + ], + "render": { + "advancement": "*", + "function": "*", + "loot_table": "*" + } + }, + "meta": { + "entity_id": entity + } + } + + ctx.require(subproject(subproject_config)) diff --git a/gm4_lavish_livestock/raw/livestock.csv b/gm4_lavish_livestock/raw/livestock.csv new file mode 100644 index 0000000000..4da8891ade --- /dev/null +++ b/gm4_lavish_livestock/raw/livestock.csv @@ -0,0 +1,7 @@ +entity_id, +chicken, +cow, +mooshroom, +pig, +rabbit, +sheep, From ed5db55824d613241bebbedc7ba45d7aacced837 Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 9 Nov 2025 22:13:27 +0100 Subject: [PATCH 04/12] Remove Debug Line --- gm4_lavish_livestock/generate.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gm4_lavish_livestock/generate.py b/gm4_lavish_livestock/generate.py index 1a6e6298a0..477b9981e7 100644 --- a/gm4_lavish_livestock/generate.py +++ b/gm4_lavish_livestock/generate.py @@ -16,7 +16,6 @@ def beet_default(ctx: Context): # for each wood type in the vanilla doors tag, render a copy of the "templates" directory with the appropriate wood-type for entity in entity_ids: - logger.info(f"adding entity type {entity}") subproject_config = { "data_pack": { "load": [ From e49bb83f39983ebd7a9bdee11350a908449cabf4 Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 9 Nov 2025 22:22:15 +0100 Subject: [PATCH 05/12] Remove Duplicate Schedule --- .../templates/function/revoke_advancement.mcfunction | 3 --- 1 file changed, 3 deletions(-) diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction index 9b7f3cf15c..ecb37b71c4 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction @@ -8,6 +8,3 @@ advancement revoke @s only gm4_lavish_livestock:{{ entity_id }}/breed # determine parent to inherit size from scoreboard players set $parent_selected gm4_lavish_livestock_size -1 execute as @e[type={{ entity_id }},distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:{{ entity_id }}/determine_parent - -# await birth -schedule function gm4_lavish_livestock:find_baby 1t From 15ccb8f3b401b12856bc681d6b49fd9b1061033c Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 9 Nov 2025 22:34:40 +0100 Subject: [PATCH 06/12] Refactor --- .../templates/function/cache_size.mcfunction | 11 ----------- .../function/determine_parent.mcfunction | 2 +- .../templates/function/find_baby.mcfunction | 15 ++++++++++----- .../templates/function/find_marker.mcfunction | 6 ++++++ .../templates/function/modify_baby.mcfunction | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction create mode 100644 gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_marker.mcfunction diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction deleted file mode 100644 index 7a38fc8978..0000000000 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/cache_size.mcfunction +++ /dev/null @@ -1,11 +0,0 @@ -# Selects babies near the breeding site -# @s = breeding site -# at @s -# run from gm4_lavish_livestock:{{ entity_id }}/find_baby - -# cache parent size -scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute as @e[type={{ entity_id }},distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:{{ entity_id }}/modify_baby - -# remove breeding site marker -kill @s diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction index 615ad0705e..f371d9d4b7 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction @@ -20,4 +20,4 @@ scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_liv execute summon marker run function gm4_lavish_livestock:{{ entity_id }}/initialize_marker # delay for one tick until child is alive -schedule function gm4_lavish_livestock:{{ entity_id }}/find_baby 1t +schedule function gm4_lavish_livestock:{{ entity_id }}/find_marker 1t diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction index f9346c862d..747fdffd68 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction @@ -1,6 +1,11 @@ -# Called once the parent has given birth and initiates breeding sites to look for babies. -# @s = undefined -# at undefined -# scheduled from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement +# Selects babies near the breeding site +# @s = breeding site +# at @s +# run from gm4_lavish_livestock:{{ entity_id }}/find_marker -execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site,tag=gm4_lavish_livestock_{{ entity_id }}] at @s run function gm4_lavish_livestock:{{ entity_id }}/cache_size +# cache parent size +scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute as @e[type={{ entity_id }},distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:{{ entity_id }}/modify_baby + +# remove breeding site marker +kill @s diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_marker.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_marker.mcfunction new file mode 100644 index 0000000000..b726da085e --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_marker.mcfunction @@ -0,0 +1,6 @@ +# Called once the parent has given birth and initiates breeding sites to look for babies. +# @s = undefined +# at undefined +# scheduled from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement + +execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site,tag=gm4_lavish_livestock_{{ entity_id }}] at @s run function gm4_lavish_livestock:{{ entity_id }}/find_baby diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction index d0d7e6a520..4e273c4bba 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction @@ -1,11 +1,11 @@ # Sets the size of the newborn baby # @s = the newborn baby # at location of breeding site marker -# run from gm4_lavish_livestock:{{ entity_id }}/cache_size +# run from gm4_lavish_livestock:{{ entity_id }}/find_baby # get parent size and roll chance to increase in size scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size -execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:0.05} run scoreboard players add @s gm4_lavish_livestock_size 1 +execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:1} run scoreboard players add @s gm4_lavish_livestock_size 1 # if non-vanilla size: add loot table and tag entity (tag is for future-proofing only, it is not currently read) execute if score @s gm4_lavish_livestock_size matches 1.. run tag @s add gm4_lavish_livestock_{{ entity_id }} From ec2607b52a45e9a58e8d98954268b1b9e2288120 Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 9 Nov 2025 22:34:54 +0100 Subject: [PATCH 07/12] Add Hoglins --- gm4_lavish_livestock/raw/livestock.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/gm4_lavish_livestock/raw/livestock.csv b/gm4_lavish_livestock/raw/livestock.csv index 4da8891ade..6014dc51fe 100644 --- a/gm4_lavish_livestock/raw/livestock.csv +++ b/gm4_lavish_livestock/raw/livestock.csv @@ -1,6 +1,7 @@ entity_id, chicken, cow, +hoglin, mooshroom, pig, rabbit, From d1f705d7d5782151f68ee526f05bcd1295534df7 Mon Sep 17 00:00:00 2001 From: Bloo Date: Fri, 14 Nov 2025 15:51:33 +0100 Subject: [PATCH 08/12] Rework Inheritance Mechanism: Only Breeding Events with Same-Sized Parents Produce Mutations --- .../function/determine_parent.mcfunction | 23 ++++--------------- .../templates/function/find_baby.mcfunction | 1 + .../function/initialize_marker.mcfunction | 2 +- .../templates/function/modify_baby.mcfunction | 3 +-- .../function/revoke_advancement.mcfunction | 15 ++++++++++-- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction index f371d9d4b7..fd8e03836f 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction @@ -1,23 +1,8 @@ -# Selects one of the two parents of the baby as the source of the inherited size +# Stores the size of each parent into a score # @s = parent of the baby # at location of player who has fed the parent # run from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement -# if the other parent candidate was already tested and selected as the parent, abort -execute if score $parent_selected gm4_lavish_livestock_size matches 1.. run return fail - -# no parent selected yet -# if the other parent candidate was already tested but not selected as the parent, make this candidate the parent -execute if score $parent_selected gm4_lavish_livestock_size matches 0 run scoreboard players set $parent_selected gm4_lavish_livestock_size 1 -# if the other parent candidate was not tested yet, roll a 50/50 whether this candidate should be the parent -execute if score $parent_selected gm4_lavish_livestock_size matches -1 store result score $parent_selected gm4_lavish_livestock_size run random value 0..1 -# if this candidate was not selected, abort -execute if score $parent_selected gm4_lavish_livestock_size matches 0 run return fail - -# this candidate is the parent, transfer its stats to breeding site marker -execute unless score @s gm4_lavish_livestock_size matches 0..2 run scoreboard players set @s gm4_lavish_livestock_size 0 -scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute summon marker run function gm4_lavish_livestock:{{ entity_id }}/initialize_marker - -# delay for one tick until child is alive -schedule function gm4_lavish_livestock:{{ entity_id }}/find_marker 1t +# store size of parent into fixed fake player (only one of these triggers, the other one triggers for the other parent) +execute unless score $parent_a gm4_lavish_livestock_size matches -2147483648..2147483647 run scoreboard players operation $parent_a gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute unless score $parent_b gm4_lavish_livestock_size matches -2147483648..2147483647 run scoreboard players operation $parent_b gm4_lavish_livestock_size = @s gm4_lavish_livestock_size diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction index 747fdffd68..c349f66f5a 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/find_baby.mcfunction @@ -4,6 +4,7 @@ # run from gm4_lavish_livestock:{{ entity_id }}/find_marker # cache parent size +scoreboard players reset $size gm4_lavish_livestock_size scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size execute as @e[type={{ entity_id }},distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:{{ entity_id }}/modify_baby diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction index 2493bad137..3d8f92ba62 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/initialize_marker.mcfunction @@ -3,6 +3,6 @@ # at location of player who has fed the parent # run from gm4_lavish_livestock:{{ entity_id }}/determine_parent -scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size +scoreboard players operation @s gm4_lavish_livestock_size = $parent_a gm4_lavish_livestock_size tag @s add gm4_lavish_livestock_breeding_site tag @s add gm4_lavish_livestock_{{ entity_id }} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction index 4e273c4bba..01d07d9f54 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/modify_baby.mcfunction @@ -3,9 +3,8 @@ # at location of breeding site marker # run from gm4_lavish_livestock:{{ entity_id }}/find_baby -# get parent size and roll chance to increase in size +# get baby size from marker value scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size -execute if score @s gm4_lavish_livestock_size matches 0..1 if predicate {condition:"minecraft:random_chance",chance:1} run scoreboard players add @s gm4_lavish_livestock_size 1 # if non-vanilla size: add loot table and tag entity (tag is for future-proofing only, it is not currently read) execute if score @s gm4_lavish_livestock_size matches 1.. run tag @s add gm4_lavish_livestock_{{ entity_id }} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction index ecb37b71c4..90af784ca7 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction @@ -5,6 +5,17 @@ advancement revoke @s only gm4_lavish_livestock:{{ entity_id }}/breed -# determine parent to inherit size from -scoreboard players set $parent_selected gm4_lavish_livestock_size -1 +# get parent sizes +scoreboard players reset $parent_a gm4_lavish_livestock_size +scoreboard players reset $parent_b gm4_lavish_livestock_size execute as @e[type={{ entity_id }},distance=..10,limit=2,sort=nearest,nbt=!{InLove:0}] run function gm4_lavish_livestock:{{ entity_id }}/determine_parent + +# if the parents differ in size, chose the smaller one +execute if score $parent_a gm4_lavish_livestock_size > $parent_b gm4_lavish_livestock_size run scoreboard players operation $parent_a gm4_lavish_livestock_size >< $parent_b gm4_lavish_livestock_size + +# if both parents are the same size, roll dice for size increase +execute if score $parent_a gm4_lavish_livestock_size = $parent_b gm4_lavish_livestock_size if predicate {condition:"minecraft:random_chance",chance:0.05} run scoreboard players add $parent_a gm4_lavish_livestock_size 1 + +# store size onto marker and wait for baby to be born +execute summon marker run function gm4_lavish_livestock:{{ entity_id }}/initialize_marker +schedule function gm4_lavish_livestock:{{ entity_id }}/find_marker 1t From 0fad94492ac1d50a150623cf14814fbd4c38dcaf Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 16 Nov 2025 19:01:41 +0100 Subject: [PATCH 09/12] Fix Invalid Parent Age Inheritance --- .../templates/function/determine_parent.mcfunction | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction index fd8e03836f..76e26549a4 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/determine_parent.mcfunction @@ -3,6 +3,9 @@ # at location of player who has fed the parent # run from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement +# init score if parent does not have a score +scoreboard players add @s gm4_lavish_livestock_size 0 + # store size of parent into fixed fake player (only one of these triggers, the other one triggers for the other parent) -execute unless score $parent_a gm4_lavish_livestock_size matches -2147483648..2147483647 run scoreboard players operation $parent_a gm4_lavish_livestock_size = @s gm4_lavish_livestock_size -execute unless score $parent_b gm4_lavish_livestock_size matches -2147483648..2147483647 run scoreboard players operation $parent_b gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute unless score $parent_a gm4_lavish_livestock_size matches -2147483648..2147483647 run return run scoreboard players operation $parent_a gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute unless score $parent_b gm4_lavish_livestock_size matches -2147483648..2147483647 run return run scoreboard players operation $parent_b gm4_lavish_livestock_size = @s gm4_lavish_livestock_size From c6d127ab30599ddbe5fc514f931355ce611fd51e Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 16 Nov 2025 19:01:51 +0100 Subject: [PATCH 10/12] Set Mutation Chance to 2.5% --- .../templates/function/revoke_advancement.mcfunction | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction index 90af784ca7..4fd873bffa 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction @@ -14,7 +14,7 @@ execute as @e[type={{ entity_id }},distance=..10,limit=2,sort=nearest,nbt=!{InLo execute if score $parent_a gm4_lavish_livestock_size > $parent_b gm4_lavish_livestock_size run scoreboard players operation $parent_a gm4_lavish_livestock_size >< $parent_b gm4_lavish_livestock_size # if both parents are the same size, roll dice for size increase -execute if score $parent_a gm4_lavish_livestock_size = $parent_b gm4_lavish_livestock_size if predicate {condition:"minecraft:random_chance",chance:0.05} run scoreboard players add $parent_a gm4_lavish_livestock_size 1 +execute if score $parent_a gm4_lavish_livestock_size = $parent_b gm4_lavish_livestock_size if predicate {condition:"minecraft:random_chance",chance:0.025} run scoreboard players add $parent_a gm4_lavish_livestock_size 1 # store size onto marker and wait for baby to be born execute summon marker run function gm4_lavish_livestock:{{ entity_id }}/initialize_marker From 303ff826520091520333d073c1a03d8107264e4d Mon Sep 17 00:00:00 2001 From: Bloo Date: Sun, 16 Nov 2025 19:25:06 +0100 Subject: [PATCH 11/12] Add README.md --- gm4_lavish_livestock/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gm4_lavish_livestock/README.md diff --git a/gm4_lavish_livestock/README.md b/gm4_lavish_livestock/README.md new file mode 100644 index 0000000000..0dd7aaaf03 --- /dev/null +++ b/gm4_lavish_livestock/README.md @@ -0,0 +1,7 @@ +# Lavish Livestock + +Selectively breed your livestock for increased yields! Commercialize your farming! + +### Features +- Breeding livestock may result in offspring that is abnormally large +- Larger individuals drop more loot From 94e6839b8ce072499db58d166ab509b0e3d7640f Mon Sep 17 00:00:00 2001 From: Bloo Date: Mon, 17 Nov 2025 21:13:07 +0100 Subject: [PATCH 12/12] Add Missing gm4.video Entry in beet.yaml --- gm4_lavish_livestock/beet.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/gm4_lavish_livestock/beet.yaml b/gm4_lavish_livestock/beet.yaml index fffdacc2ad..b0d9d8b489 100644 --- a/gm4_lavish_livestock/beet.yaml +++ b/gm4_lavish_livestock/beet.yaml @@ -24,6 +24,7 @@ meta: recommended: - gm4_pig_tractors - metallurgy + video: null #modrinth: # project_id: #smithed: