Skip to content

Commit 6e5bb63

Browse files
committed
Use Templates, Adjust Size Increments
1 parent 797894e commit 6e5bb63

File tree

14 files changed

+124
-45
lines changed

14 files changed

+124
-45
lines changed

gm4_lavish_livestock/beet.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,28 @@ data_pack:
88
resource_pack:
99
load: .
1010

11+
require:
12+
- bolt
13+
1114
pipeline:
15+
- gm4_lavish_livestock.generate
1216
- gm4.plugins.extend.module
1317

1418
meta:
1519
gm4:
1620
versioning:
1721
schedule_loops: []
1822
website:
19-
description: Huh?
23+
description: Selectively breed your livestock for increased yields! Commercialize your farming!
2024
recommended:
21-
- gm4_enderman_support_class
22-
notes:
23-
- Modifies loot tables.
25+
- gm4_pig_tractors
26+
- metallurgy
2427
#modrinth:
25-
# project_id: qWQqEQMY
28+
# project_id:
2629
#smithed:
27-
# pack_id: gm4_bat_grenades
30+
# pack_id:
2831
#planetminecraft:
29-
# uid: 4293806
30-
#video: https://www.youtube.com/watch?v=uUoEKtte1GQ
32+
# uid:
3133
wiki: https://wiki.gm4.co/wiki/Lavish_Livestock
3234
credits:
3335
Creator:

gm4_lavish_livestock/data/gm4_lavish_livestock/function/modify_baby.mcfunction

Lines changed: 0 additions & 9 deletions
This file was deleted.

gm4_lavish_livestock/data/gm4_lavish_livestock/function/revoke_advancement.mcfunction

Lines changed: 0 additions & 13 deletions
This file was deleted.

gm4_lavish_livestock/data/gm4_lavish_livestock/advancements/breed.json renamed to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/advancement/breed.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"trigger": "minecraft:bred_animals",
55
"conditions": {
66
"child": {
7-
"type": "pig"
7+
"type": "{{ entity_id }}"
88
}
99
}
1010
}
1111
},
1212
"rewards": {
13-
"function": "gm4_lavish_livestock:revoke_advancement"
13+
"function": "gm4_lavish_livestock:{{ entity_id }}/revoke_advancement"
1414
}
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Selects babies near the breeding site
22
# @s = breeding site
33
# at @s
4-
# run from gm4_lavish_livestock:find_baby
4+
# run from gm4_lavish_livestock:{{ entity_id }}/find_baby
55

66
# cache parent size
77
scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size
8-
execute as @e[type=pig,distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:modify_baby
8+
execute as @e[type={{ entity_id }},distance=..10,nbt={Age:-24000},limit=1,sort=nearest] run function gm4_lavish_livestock:{{ entity_id }}/modify_baby
99

1010
# remove breeding site marker
1111
kill @s
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Selects one of the two parents of the baby as the source of the inherited size
22
# @s = parent of the baby
33
# at location of player who has fed the parent
4-
# run from gm4_lavish_livestock:revoke_advancement
4+
# run from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement
55

66
# if the other parent candidate was already tested and selected as the parent, abort
7-
execute if score $parent_selected gm4_lavish_livestock_data matches 1.. run return fail
7+
execute if score $parent_selected gm4_lavish_livestock_size matches 1.. run return fail
88

99
# no parent selected yet
1010
# if the other parent candidate was already tested but not selected as the parent, make this candidate the parent
11-
execute if score $parent_selected gm4_lavish_livestock_data matches 0 run scoreboard players set $parent_selected gm4_lavish_livestock_data 1
11+
execute if score $parent_selected gm4_lavish_livestock_size matches 0 run scoreboard players set $parent_selected gm4_lavish_livestock_size 1
1212
# if the other parent candidate was not tested yet, roll a 50/50 whether this candidate should be the parent
13-
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
13+
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
1414
# if this candidate was not selected, abort
15-
execute if score $parent_selected gm4_lavish_livestock_data matches 0 run return fail
15+
execute if score $parent_selected gm4_lavish_livestock_size matches 0 run return fail
1616

1717
# this candidate is the parent, transfer its stats to breeding site marker
1818
execute unless score @s gm4_lavish_livestock_size matches 0..2 run scoreboard players set @s gm4_lavish_livestock_size 0
1919
scoreboard players operation $size gm4_lavish_livestock_size = @s gm4_lavish_livestock_size
20-
execute summon marker run function gm4_lavish_livestock:initialize_marker
20+
execute summon marker run function gm4_lavish_livestock:{{ entity_id }}/initialize_marker
2121

2222
# delay for one tick until child is alive
23-
schedule function gm4_lavish_livestock:find_baby 1t
23+
schedule function gm4_lavish_livestock:{{ entity_id }}/find_baby 1t
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Called once the parent has given birth and initiates breeding sites to look for babies.
22
# @s = undefined
33
# at undefined
4-
# scheduled from gm4_lavish_livestock:revoke_advancement
4+
# scheduled from gm4_lavish_livestock:{{ entity_id }}/revoke_advancement
55

6-
execute as @e[type=marker,tag=gm4_lavish_livestock_breeding_site] at @s run function gm4_lavish_livestock:pick_type
6+
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

gm4_lavish_livestock/data/gm4_lavish_livestock/function/init.mcfunction renamed to gm4_lavish_livestock/data/gm4_lavish_livestock/templates/function/init.mcfunction

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ execute unless score lavish_livestock gm4_modules matches 1 run data modify stor
22
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
33
scoreboard players set lavish_livestock gm4_modules 1
44

5-
scoreboard objectives add gm4_lavish_livestock_data dummy
65
scoreboard objectives add gm4_lavish_livestock_size dummy
76

87
#$moduleUpdateList
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Initializes the breeding site marker which sticks around awaiting birth
22
# @s = new breeding site marker
33
# at location of player who has fed the parent
4-
# run from gm4_lavish_livestock:determine_parent
4+
# run from gm4_lavish_livestock:{{ entity_id }}/determine_parent
55

66
scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size
77
tag @s add gm4_lavish_livestock_breeding_site
8+
tag @s add gm4_lavish_livestock_{{ entity_id }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Sets the size of the newborn baby
2+
# @s = the newborn baby
3+
# at location of breeding site marker
4+
# run from gm4_lavish_livestock:{{ entity_id }}/cache_size
5+
6+
# get parent size and roll chance to increase in size
7+
scoreboard players operation @s gm4_lavish_livestock_size = $size gm4_lavish_livestock_size
8+
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
9+
10+
# if non-vanilla size: add loot table and tag entity (tag is for future-proofing only, it is not currently read)
11+
execute if score @s gm4_lavish_livestock_size matches 1.. run tag @s add gm4_lavish_livestock_{{ entity_id }}
12+
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"
13+
14+
# set scale attribute
15+
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
16+
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

0 commit comments

Comments
 (0)