diff --git a/gm4/modeldata_registry.json b/gm4/modeldata_registry.json index 430a974d53..657f31cb86 100644 --- a/gm4/modeldata_registry.json +++ b/gm4/modeldata_registry.json @@ -1695,7 +1695,8 @@ "gm4_metallurgy:shamir/infinitas": 100 }, "wheat": { - "gm4_mysterious_midnights:guidebook_icon/harvest_moons": 1 + "gm4_mysterious_midnights:guidebook_icon/harvest_moons": 1, + "gm4_lavish_livestock:guidebook_icon/lavish_livestock": 2 }, "white_concrete_powder": { "gm4_zauber_cauldrons:block/liquid_magicol/white": 300 diff --git a/gm4_guidebook/triggers.json b/gm4_guidebook/triggers.json index 9d8930384d..47ceb32fbb 100644 --- a/gm4_guidebook/triggers.json +++ b/gm4_guidebook/triggers.json @@ -1,6 +1,6 @@ { "__important__": "Generated by generate_guidebooks.py. Don't manually update this", - "__next__": 122, + "__next__": 123, "animi_shamir": 91, "apple_trees": 83, "arborenda_shamir": 20, @@ -56,6 +56,7 @@ "illusioner_nights": 103, "infinitas_shamir": 23, "ink_spitting_squid": 78, + "lavish_livestock": 122, "lightning_in_a_bottle": 109, "liquid_minecarts": 47, "liquid_tanks": 63, diff --git a/gm4_lavish_livestock/beet.yaml b/gm4_lavish_livestock/beet.yaml index b0d9d8b489..fca7197fe5 100644 --- a/gm4_lavish_livestock/beet.yaml +++ b/gm4_lavish_livestock/beet.yaml @@ -16,6 +16,14 @@ pipeline: - gm4.plugins.extend.module meta: + livestock: + - chicken + - cow + - hoglin + - mooshroom + - pig + - rabbit + - sheep gm4: versioning: schedule_loops: [] diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/guidebook/lavish_livestock.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/guidebook/lavish_livestock.json new file mode 100644 index 0000000000..2af67b0418 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/guidebook/lavish_livestock.json @@ -0,0 +1,64 @@ +{ + "id": "lavish_livestock", + "name": "Lavish Livestock", + "module_type": "module", + "icon": { + "id": "minecraft:wheat" + }, + "criteria": { + "breed": { + "trigger": "minecraft:bred_animals", + "conditions": { + "child": { + "type": "#gm4_lavish_livestock:livestock" + } + } + } + }, + "sections": [ + { + "name": "display", + "enable": [], + "requirements": [ + [ + "breed" + ] + ], + "pages": [ + [ + { + "insert": "title" + }, + { + "text":"\n" + }, + { + "translate": "text.gm4.guidebook.lavish_livestock.description", + "fallback": "Breeding livestock may result in offspring that is abnormally large.\n\nLarger livestock drops more loot." + } + ], + [ + { + "translate":"text.gm4.guidebook.lavish_livestock.list_header", + "fallback":"Livestock", + "underlined":true + }, + {"text":"\n\n"}, + {"translate":"entity.minecraft.chicken", "underlined":false}, + {"text":"\n"}, + {"translate":"entity.minecraft.cow", "underlined":false}, + {"text":"\n"}, + {"translate":"entity.minecraft.hoglin", "underlined":false}, + {"text":"\n"}, + {"translate":"entity.minecraft.mooshroom", "underlined":false}, + {"text":"\n"}, + {"translate":"entity.minecraft.pig", "underlined":false}, + {"text":"\n"}, + {"translate":"entity.minecraft.rabbit", "underlined":false}, + {"text":"\n"}, + {"translate":"entity.minecraft.sheep", "underlined":false} + ] + ] + } + ] +} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/tags/entity_type/livestock.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/tags/entity_type/livestock.json new file mode 100644 index 0000000000..9c30d358c8 --- /dev/null +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/tags/entity_type/livestock.json @@ -0,0 +1,3 @@ +{ + "values": ctx.meta['livestock'] +} diff --git a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json index 9d687e76e3..44c9ca24cb 100644 --- a/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json +++ b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json @@ -1,6 +1,6 @@ { "criteria": { - "breed_pigs": { + "breed_{{ entity_id }}": { "trigger": "minecraft:bred_animals", "conditions": { "child": { 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 76e26549a4..c46dc49d5e 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 @@ -7,5 +7,5 @@ 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 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 +execute if score $parent_a gm4_lavish_livestock_size matches -1 run return run scoreboard players operation $parent_a gm4_lavish_livestock_size = @s gm4_lavish_livestock_size +execute if score $parent_b gm4_lavish_livestock_size matches -1 run return 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 c349f66f5a..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 @@ -4,7 +4,6 @@ # 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/revoke_advancement.mcfunction b/gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/revoke_advancement.mcfunction index 4fd873bffa..ad545285b2 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 @@ -6,8 +6,8 @@ advancement revoke @s only gm4_lavish_livestock:{{ entity_id }}/breed # get parent sizes -scoreboard players reset $parent_a gm4_lavish_livestock_size -scoreboard players reset $parent_b gm4_lavish_livestock_size +scoreboard players set $parent_a gm4_lavish_livestock_size -1 +scoreboard players set $parent_b 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 # if the parents differ in size, chose the smaller one diff --git a/gm4_lavish_livestock/generate.py b/gm4_lavish_livestock/generate.py index 957832396b..6c146c958c 100644 --- a/gm4_lavish_livestock/generate.py +++ b/gm4_lavish_livestock/generate.py @@ -1,21 +1,13 @@ -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] - + # List of supported animals defined in beet.yaml as well as the guidebook page # for each supported entity, render a copy of the "templates" directory with the appropriate entity-id - for entity in entity_ids: + for entity in ctx.meta['livestock']: subproject_config = { "data_pack": { "load": [ diff --git a/gm4_lavish_livestock/raw/livestock.csv b/gm4_lavish_livestock/raw/livestock.csv deleted file mode 100644 index 6014dc51fe..0000000000 --- a/gm4_lavish_livestock/raw/livestock.csv +++ /dev/null @@ -1,8 +0,0 @@ -entity_id, -chicken, -cow, -hoglin, -mooshroom, -pig, -rabbit, -sheep, diff --git a/gm4_lavish_livestock/translations.csv b/gm4_lavish_livestock/translations.csv new file mode 100644 index 0000000000..c9b08327c8 --- /dev/null +++ b/gm4_lavish_livestock/translations.csv @@ -0,0 +1,4 @@ +key,en_us +text.gm4.guidebook.module_desc.lavish_livestock,"Selectively breed your livestock for increased yields! Commercialize your farming!" +text.gm4.guidebook.lavish_livestock.description,"Breeding livestock may result in offspring that is abnormally large.\n\nLarger livestock drops more loot." +text.gm4.guidebook.lavish_livestock.list_header,"Livestock"