Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gm4/modeldata_registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion gm4_guidebook/triggers.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
]
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": ctx.meta['animals']
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"criteria": {
"breed_pigs": {
"breed_{{ entity_id }}": {
"trigger": "minecraft:bred_animals",
"conditions": {
"child": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 13 additions & 9 deletions gm4_lavish_livestock/generate.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
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 entities
# This list is defined in 2 other places, translations.csv and the guidebook
entity_ids = [
"chicken",
"cow",
"hoglin",
"mooshroom",
"pig",
"rabbit",
"sheep"
]
ctx.meta['animals'] = entity_ids

# for each supported entity, render a copy of the "templates" directory with the appropriate entity-id
for entity in entity_ids:
subproject_config = {
Expand Down
8 changes: 0 additions & 8 deletions gm4_lavish_livestock/raw/livestock.csv

This file was deleted.

4 changes: 4 additions & 0 deletions gm4_lavish_livestock/translations.csv
Original file line number Diff line number Diff line change
@@ -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"
Loading