From 7d48d9b21b028b3efb13eba25cd8306cd30907a1 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 8 Mar 2025 13:43:13 +0900 Subject: [PATCH 01/37] Initial Commit --- gm4_reeling_rods/README.md | 13 ++ gm4_reeling_rods/beet.yaml | 38 +++++ .../gm4_reeling_rods/enchantment/reeling.json | 22 +++ .../empty_container_entity.mcfunction | 36 +++++ .../function/fishing/allay/action.mcfunction | 8 + .../fishing/end_crystal/action.mcfunction | 6 + .../fishing/glow_item_frame/action.mcfunction | 10 ++ .../fishing/item_frame/action.mcfunction | 10 ++ .../fishing/leash_knot/action.mcfunction | 13 ++ .../leash_knot/change_leader.mcfunction | 7 + .../leash_knot/leaded_by_knot.mcfunction | 6 + .../function/fishing/owns_bobber.mcfunction | 6 + .../fishing/painting/action.mcfunction | 8 + .../function/get_lookup.mcfunction | 5 + .../function/get_motion_to_player.mcfunction | 44 +++++ .../gm4_reeling_rods/function/init.mcfunction | 12 ++ .../function/separate.mcfunction | 13 ++ .../function/store_player_pos.mcfunction | 9 ++ .../function/summon_entity.mcfunction | 5 + .../function/summon_item.mcfunction | 4 + .../tags/entity_type/leashable.json | 50 ++++++ .../tags/enchantment/non_treasure.json | 5 + gm4_reeling_rods/generate_files.py | 151 ++++++++++++++++++ 23 files changed, 481 insertions(+) create mode 100644 gm4_reeling_rods/README.md create mode 100644 gm4_reeling_rods/beet.yaml create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/enchantment/reeling.json create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/owns_bobber.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/get_lookup.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/get_motion_to_player.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/summon_item.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json create mode 100644 gm4_reeling_rods/data/minecraft/tags/enchantment/non_treasure.json create mode 100644 gm4_reeling_rods/generate_files.py diff --git a/gm4_reeling_rods/README.md b/gm4_reeling_rods/README.md new file mode 100644 index 0000000000..cd7081bc0d --- /dev/null +++ b/gm4_reeling_rods/README.md @@ -0,0 +1,13 @@ +# Reeling Rods + +Reel in more than just fish with these rods! Yoink the chest from the chest boat and more! + +### Features +Fishing Rods can now yoink many more things! +- Pull Paintings off walls +- Reel in items from Item Frames +- Snatch leashed mobs from leash knots +- Try and fail to pull in an end crystal +Adds a new enchantment for fishing rods to take your yoinking up a notch! With it you can +- Separate chest boats and all minecart variants +- Steal items from allays diff --git a/gm4_reeling_rods/beet.yaml b/gm4_reeling_rods/beet.yaml new file mode 100644 index 0000000000..eda3748229 --- /dev/null +++ b/gm4_reeling_rods/beet.yaml @@ -0,0 +1,38 @@ +id: gm4_reeling_rods +name: Reeling Rods +version: 1.0.X + +data_pack: + load: . + overlays: + - formats: + min_inclusive: 61 + max_inclusive: 61 + directory: since_61 + +pipeline: + - generate_files + - gm4.plugins.extend.module + +meta: + gm4: + versioning: + schedule_loops: [] + website: + description: Reel in more than just fish with these rods! Yoink the chest from the chest boat and more! + recommended: + - gm4_end_fishing + notes: [] + #modrinth: + #project_id: + #smithed: + #pack_id: + #planetminecraft: + #uid: + video: null + wiki: https://wiki.gm4.co/wiki/Reeling_Rods + credits: + Creator: + - runcows + #Icon Design: + #- runcows diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/enchantment/reeling.json b/gm4_reeling_rods/data/gm4_reeling_rods/enchantment/reeling.json new file mode 100644 index 0000000000..d5ab45c12a --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/enchantment/reeling.json @@ -0,0 +1,22 @@ +{ + "description":{ + "text": "Reeling" + }, + "supported_items": "minecraft:fishing_rod", + "primary_items": "minecraft:fishing_rod", + "weight": 3, + "max_level": 1, + "min_cost": { + "base": 5, + "per_level_above_first": 8 + }, + "max_cost": { + "base": 55, + "per_level_above_first": 8 + }, + "anvil_cost": 2, + "slots": [ + "any" + ], + "effects": {} +} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction new file mode 100644 index 0000000000..e4481ae697 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction @@ -0,0 +1,36 @@ +# Loops through Items[] and creates an item entity for each item, setting a slightly random motion +# @s = entity with an Items[] tag +# at @s +# run from separate + +# Assumptions + # storage gm4_reeling_rods:temp motion_vector is a Motion[] vector that reaches player + # in storage gm4_reeling_rods:temp entity_data is an Items[] array of item data objects + +# pull item data to be processed +data modify storage gm4_reeling_rods:temp item_data.Item set from storage gm4_reeling_rods:temp entity_data.Items[0] + +# randomize motion slightly.... + # this is the complicated bit +execute store result score $motionX gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp motion_vector[0] 100 +execute store result score $motionY gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp motion_vector[1] 100 +execute store result score $motionZ gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp motion_vector[2] 100 +execute store result score $randomX gm4_reeling_rods.math run random value -10..10 +execute store result score $randomY gm4_reeling_rods.math run random value 0..10 +execute store result score $randomZ gm4_reeling_rods.math run random value -10..10 +execute store result storage gm4_reeling_rods:temp item_data.Motion[0] double 0.006 run \ + scoreboard players operation $motionX gm4_reeling_rods.math += $randomX gm4_reeling_rods.math +execute store result storage gm4_reeling_rods:temp item_data.Motion[1] double 0.006 run \ + scoreboard players operation $motionY gm4_reeling_rods.math += $randomY gm4_reeling_rods.math +execute store result storage gm4_reeling_rods:temp item_data.Motion[2] double 0.006 run \ + scoreboard players operation $motionZ gm4_reeling_rods.math += $randomZ gm4_reeling_rods.math +# scale 0.01 for same magnitude as main item + +# summon item with data +function gm4_reeling_rods:summon_item with storage gm4_reeling_rods:temp + +# remove processed item +data remove storage gm4_reeling_rods:temp entity_data.Items[0] + +# run again if needed +execute if data storage gm4_reeling_rods:temp entity_data.Items[] run function gm4_reeling_rods:empty_container_entity diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction new file mode 100644 index 0000000000..3ad4f4422a --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction @@ -0,0 +1,8 @@ +# Action for reeled allay +# @s = allay +# at @s +# run from gm4_reeling_rods:fishing/allay/adv + +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] +data remove entity @s HandItems[0] +execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction new file mode 100644 index 0000000000..36fa31748e --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction @@ -0,0 +1,6 @@ +# Action for reeled end crystal +# @s = end_crystal +# at @s +# run from gm4_reeling_rods:fishing/end_crystal/adv + +damage @s 1 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction new file mode 100644 index 0000000000..62fa7d6ba5 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction @@ -0,0 +1,10 @@ +# Action for reeled glow item frame +# @s = glow item frame +# at @s +# run from gm4_reeling_rods:fishing/glow_item_frame/adv + +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:glow_item_frame",count:1} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Item +execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate +execute unless data entity @s Item run return run kill @s +data remove entity @s Item diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction new file mode 100644 index 0000000000..65e1b5e8ce --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction @@ -0,0 +1,10 @@ +# Action for reeled item frame +# @s = item frame +# at @s +# run from gm4_reeling_rods:fishing/item_frame/adv + +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:item_frame",count:1} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Item +execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate +execute unless data entity @s Item run return run kill @s +data remove entity @s Item diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction new file mode 100644 index 0000000000..f9e8e13369 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction @@ -0,0 +1,13 @@ +# Action for reeled leash knot +# @s = leash knot +# at @s +# run from gm4_reeling_rods:fishing/leash_knot/adv + +tag @s add gm4_reeling_rods.leash_knot + +execute as @e[type=#gm4_reeling_rods:leashable,distance=..10] \ + if function gm4_reeling_rods:fishing/leash_knot/leaded_by_knot \ + run function gm4_reeling_rods:fishing/leash_knot/change_leader + + +kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction new file mode 100644 index 0000000000..254d0ffcdb --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction @@ -0,0 +1,7 @@ +# Changes a leashed entities leader from a leash knot to a tagged player +# @s = entity leaded to leash knot +# at leash knot +# run from fishing/leash_knot/action + +data remove entity @s leash +data modify entity @s leash.UUID set from entity @e[type=player,tag=gm4_reeling_rods.player,distance=..45,limit=1] UUID diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction new file mode 100644 index 0000000000..efbe8444c5 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction @@ -0,0 +1,6 @@ +# Checks if an entity is leashed by the knot in question +# @s = a leashable entity +# at owner +# run from fishing/leash_knot/action + +return run execute on leasher if entity @s[tag=gm4_reeling_rods.leash_knot] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/owns_bobber.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/owns_bobber.mcfunction new file mode 100644 index 0000000000..9e97065849 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/owns_bobber.mcfunction @@ -0,0 +1,6 @@ +# Checks if a fishing bobber belongs to the targeted owner +# @s = a fishing bobber +# at owner +# run from fishing/{entity}/adv + +return run execute on origin if entity @s[tag=gm4_reeling_rods.player] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction new file mode 100644 index 0000000000..266b7dbfc6 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction @@ -0,0 +1,8 @@ +# Action for reeled painting +# @s = painting +# at @s +# run from gm4_reeling_rods:fishing/painting/adv + +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:painting",count:1} +execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate +kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/get_lookup.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/get_lookup.mcfunction new file mode 100644 index 0000000000..274d5f13b9 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/get_lookup.mcfunction @@ -0,0 +1,5 @@ +# Adds a value from the lookup table to Y motion +# with (lookup_key) +# run from get_motion_to_player + +$scoreboard players operation $motionY gm4_reeling_rods.math += $$(lookup_key) gm4_reeling_rods.lookup diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/get_motion_to_player.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/get_motion_to_player.mcfunction new file mode 100644 index 0000000000..833856cc8f --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/get_motion_to_player.mcfunction @@ -0,0 +1,44 @@ +# Gets motion vector to launch item to player +# run from separate + + +data modify storage gm4_reeling_rods:temp item_data.Motion set value [0d,0d,0d] + +# Store item pos +data modify storage gm4_reeling_rods:temp item_data.Pos set from entity @s Pos +execute store result score $itemX gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp item_data.Pos[0] 1 +execute store result score $itemY gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp item_data.Pos[1] 1 +execute store result score $itemZ gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp item_data.Pos[2] 1 + +# Player postion is stored in $motionX... ect from store_player_pos.mcfunction + +# Get delta from item to player +scoreboard players operation $motionX gm4_reeling_rods.math -= $itemX gm4_reeling_rods.math +scoreboard players operation $motionY gm4_reeling_rods.math -= $itemY gm4_reeling_rods.math +scoreboard players operation $motionZ gm4_reeling_rods.math -= $itemZ gm4_reeling_rods.math + + +# store Motion, y to be edited after +execute store result storage gm4_reeling_rods:temp item_data.Motion[0] double 0.1 run scoreboard players get $motionX gm4_reeling_rods.math +execute store result storage gm4_reeling_rods:temp item_data.Motion[1] double 0.1 run scoreboard players get $motionY gm4_reeling_rods.math +execute store result storage gm4_reeling_rods:temp item_data.Motion[2] double 0.1 run scoreboard players get $motionZ gm4_reeling_rods.math + +# Square +scoreboard players operation $motionX gm4_reeling_rods.math *= $motionX gm4_reeling_rods.math +scoreboard players operation $motionY gm4_reeling_rods.math *= $motionY gm4_reeling_rods.math +scoreboard players operation $motionZ gm4_reeling_rods.math *= $motionZ gm4_reeling_rods.math + +# Add the squares +scoreboard players operation $lookup_key gm4_reeling_rods.math = $motionX gm4_reeling_rods.math +scoreboard players operation $lookup_key gm4_reeling_rods.math += $motionY gm4_reeling_rods.math +execute store result storage gm4_reeling_rods:temp lookup_key int 1 \ + run scoreboard players operation $lookup_key gm4_reeling_rods.math += $motionZ gm4_reeling_rods.math + +# store motion Y, scaled up +execute store result score $motionY gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp item_data.Motion[1] 100 + +# Add looked up value +function gm4_reeling_rods:get_lookup with storage gm4_reeling_rods:temp + +# Store the Completed YMotion +execute store result storage gm4_reeling_rods:temp item_data.Motion[1] double 0.01 run scoreboard players get $motionY gm4_reeling_rods.math diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction new file mode 100644 index 0000000000..36500c6f3a --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction @@ -0,0 +1,12 @@ +execute unless score reeling_rods gm4_modules matches 1 run data modify storage gm4:log queue append value {type:"install",module:"Reeling Rods"} +execute unless score reeling_rods gm4_earliest_version < reeling_rods gm4_modules run scoreboard players operation reeling_rods gm4_earliest_version = reeling_rods gm4_modules +scoreboard players set reeling_rods gm4_modules 1 + + +scoreboard objectives add gm4_reeling_rods.math dummy "gm4_reeling math" +scoreboard objectives add gm4_reeling_rods.lookup dummy "gm4_reeling lookup table" + +# set_lookup_table generated in generate_files.py +function gm4_reeling_rods:set_lookup_table + +# no main function diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction new file mode 100644 index 0000000000..801cf2ad0d --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction @@ -0,0 +1,13 @@ +# Separates an entity that needs it +# @s = entity to be separated +# at @s +# run from fishing/{entity}/action + +function gm4_reeling_rods:get_motion_to_player +function gm4_reeling_rods:summon_item with storage gm4_reeling_rods:temp + +# return if no items +execute unless data entity @s Items[] run return 0 + +data modify storage gm4_reeling_rods:temp motion_vector set from storage gm4_reeling_rods:temp entity_data.Motion +function gm4_reeling_rods:empty_container_entity diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction new file mode 100644 index 0000000000..cdbac992cb --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction @@ -0,0 +1,9 @@ +# stores players postion +# @s = Player +# at @s +# run from fishing/{entity}/adv + +data modify storage gm4_reeling_rods:temp player_data.Pos set from entity @s Pos +execute store result score $motionX gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp player_data.Pos[0] 1 +execute store result score $motionY gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp player_data.Pos[1] 1 +execute store result score $motionZ gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp player_data.Pos[2] 1 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction new file mode 100644 index 0000000000..d53b8adb37 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction @@ -0,0 +1,5 @@ +# Summons a generic entity with data +# with {entity_data} +# run from fishing/{entity}/action + +$summon $(entity_type) ~ ~ ~ $(entity_data) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_item.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_item.mcfunction new file mode 100644 index 0000000000..cf8001d5b6 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_item.mcfunction @@ -0,0 +1,4 @@ +# Summons item with data +# run from separate and empty_container_entity + +$summon minecraft:item ~ ~ ~ $(item_data) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json new file mode 100644 index 0000000000..ae13a5bfeb --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json @@ -0,0 +1,50 @@ +{ + "values": [ + "#minecraft:boat", + "minecraft:acacia_chest_boat", + "minecraft:oak_chest_boat", + "minecraft:cherry_chest_boat", + "minecraft:birch_chest_boat", + "minecraft:bamboo_chest_raft", + "minecraft:jungle_chest_boat", + "minecraft:spruce_chest_boat", + "minecraft:dark_oak_chest_boat", + "minecraft:mangrove_chest_boat", + "minecraft:mangrove_chest_boat", + "minecraft:skeleton_horse", + "minecraft:zombie_horse", + "minecraft:horse", + "minecraft:allay", + "minecraft:armadillo", + "minecraft:axolotl", + "minecraft:bee", + "minecraft:camel", + "minecraft:cat", + "minecraft:chicken", + "minecraft:cow", + "minecraft:dolphin", + "minecraft:donkey", + "minecraft:fox", + "minecraft:frog", + "minecraft:glow_squid", + "minecraft:goat", + "minecraft:hoglin", + "minecraft:iron_golem", + "minecraft:llama", + "minecraft:mooshroom", + "minecraft:mule", + "minecraft:ocelot", + "minecraft:parrot", + "minecraft:pig", + "minecraft:polar_bear", + "minecraft:rabbit", + "minecraft:sheep", + "minecraft:sniffer", + "minecraft:snow_golem", + "minecraft:squid", + "minecraft:strider", + "minecraft:trader_llama", + "minecraft:wolf", + "minecraft:zoglin" + ] +} diff --git a/gm4_reeling_rods/data/minecraft/tags/enchantment/non_treasure.json b/gm4_reeling_rods/data/minecraft/tags/enchantment/non_treasure.json new file mode 100644 index 0000000000..fdf6328f6d --- /dev/null +++ b/gm4_reeling_rods/data/minecraft/tags/enchantment/non_treasure.json @@ -0,0 +1,5 @@ +{ + "values": [ + "gm4_reeling_rods:reeling" + ] +} diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py new file mode 100644 index 0000000000..410641d597 --- /dev/null +++ b/gm4_reeling_rods/generate_files.py @@ -0,0 +1,151 @@ +from typing import List +from beet import Context, Advancement, Function +from beet.contrib.vanilla import Vanilla +import math + +class Entity: + def __init__(self, entity_type: str, vertical_displacement: str, needs_enchantment: bool): + self.entity_type = entity_type + self.vertical_displacement = vertical_displacement + self.needs_enchantment = needs_enchantment + +def beet_default(ctx: Context): + """generates the advancements, the subsequent functions for handling reeling, and set_lookup_table.mcfunction + NOTE: Only generates action functions for minecarts and chest boats. Others will have to be defined manually""" + + vanilla = ctx.inject(Vanilla) + vanilla.minecraft_version = '1.21.4' + + def create_files(entities: List[Entity]): + for entity in entities: + since_61 = "pale_oak" in entity.entity_type + output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data + entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv"] = Function([ + f"# Initial Logic for rod reeling {entity_type_no_prefix}", + "# @s = player who fished", + "# at @s", + f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}", + f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}", + "\nfunction gm4_reeling_rods:store_player_pos", + "\ntag @s add gm4_reeling_rods.player\n", + "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", + "\tif function gm4_reeling_rods:fishing/owns_bobber \\", + f"\tat @s positioned ~ ~{entity.vertical_displacement} ~ \\", + f"\tas @e[type={entity.entity_type},distance=..0.00001,limit=1] \\", + "\tunless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \\", + f"\trun function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", + "\ntag @s remove gm4_reeling_rods.player" + ]) + if entity.needs_enchantment: + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}"] = Advancement({ + "criteria":{ + "fishing_rod_hooked":{ + "trigger": "minecraft:fishing_rod_hooked", + "conditions": { + "rod": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "gm4_reeling_rods:reeling" + } + ] + } + }, + "entity": { + "type": entity.entity_type + } + } + } + }, + "rewards": { + "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" + } + }) + else: + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}"] = Advancement({ + "criteria":{ + "fishing_rod_hooked":{ + "trigger":"minecraft:fishing_rod_hooked", + "conditions":{ + "entity":{ + "type": entity.entity_type + } + } + } + }, + "rewards":{ + "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" + } + }) + if not ("minecart" in entity.entity_type or "chest" in entity.entity_type): # Other entity types need to have actions defined manually + continue + if "minecart" in entity.entity_type: # minecart types + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", + "function gm4_reeling_rods:separate", + "tp @s ~ -1000 ~", + "data remove storage gm4_reeling_rods:temp entity_data.UUID", + "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + ]) + continue + if "chest" in entity.entity_type: # chest boats / raft + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", + "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", + "tp @s ~ -1000 ~", + "data remove storage gm4_reeling_rods:temp entity_data.UUID", + f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + ]) + continue + + def create_lookup_file(): + lookup_keys = [0] + for dx in range(0,34): + for dy in range(0,34): + for dz in range(0,34): + potenital_key = (dx * dx) + (dy * dy) + (dz * dz) + if (math.sqrt(potenital_key) > 33): # ignore values out of fishing bobber range + continue + if potenital_key in lookup_keys: # ignore if already found + continue + lookup_keys.append(potenital_key) + lookup_keys.sort() + strList: List[str] = [] + for key in lookup_keys: + value = math.floor(100*(0.08*math.sqrt(math.sqrt(key)))) + strList.append(f"scoreboard players set ${key} gm4_reeling_rods.lookup {value}") + ctx.data["gm4_reeling_rods:set_lookup_table"] = Function(strList) + + entity_list: List[Entity] = [] + + entity_list.append(Entity("minecraft:painting","-0.4",False)) + entity_list.append(Entity("minecraft:item_frame","-0.4",False)) + entity_list.append(Entity("minecraft:glow_item_frame","-0.4",False)) + entity_list.append(Entity("minecraft:leash_knot","-0.4",False)) + entity_list.append(Entity("minecraft:allay","-0.48",True)) + entity_list.append(Entity("minecraft:chest_minecart","-0.55999",True)) + entity_list.append(Entity("minecraft:furnace_minecart","-0.55999", True)) + entity_list.append(Entity("minecraft:hopper_minecart","-0.55999", True)) + entity_list.append(Entity("minecraft:tnt_minecart","-0.55999",True)) + entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) + + item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags + for chest_boat in item_tags["minecraft:chest_boats"].data['values']: + entity_list.append(Entity(chest_boat,"-0.45",True)) + + create_files(entity_list) + create_lookup_file() + \ No newline at end of file From 0e7c7311ad5c65b5d49bc1677a8de07c55070af0 Mon Sep 17 00:00:00 2001 From: runcows Date: Sun, 9 Mar 2025 01:28:55 +0900 Subject: [PATCH 02/37] Fix Version Compat --- .../advancement/fishing/chest_boat.json | 25 ++++++++++ .../fishing/chest_boat/action.mcfunction | 12 +++++ .../fishing/chest_boat/adv.mcfunction | 19 +++++++ .../tags/entity_type/leashable.json | 41 +++++++++++++++ gm4_reeling_rods/beet.yaml | 8 +++ .../tags/entity_type/leashable.json | 1 - gm4_reeling_rods/generate_files.py | 7 +-- .../tags/entity_type/leashable.json | 50 +++++++++++++++++++ 8 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json create mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction create mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction create mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json create mode 100644 gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json new file mode 100644 index 0000000000..e5fb7a17f8 --- /dev/null +++ b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json @@ -0,0 +1,25 @@ +{ + "criteria": { + "fishing_rod_hooked": { + "trigger": "minecraft:fishing_rod_hooked", + "conditions": { + "rod": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "gm4_reeling_rods:reeling" + } + ] + } + }, + "entity": { + "type": "minecraft:chest_boat" + } + } + } + }, + "rewards": { + "function": "gm4_reeling_rods:fishing/chest_boat/adv" + } + } + \ No newline at end of file diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction new file mode 100644 index 0000000000..787ca611cb --- /dev/null +++ b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction @@ -0,0 +1,12 @@ +# Action for reeled chest_boat +# @s = chest_boat +# at @s +# run from gm4_reeling_rods:fishing/chest_boat/adv + +data modify storage gm4_reeling_rods:temp entity_data set from entity @s +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} +execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate +tp @s ~ -1000 ~ +data remove storage gm4_reeling_rods:temp entity_data.UUID +data modify storage gm4_reeling_rods:temp entity_type set value "minecraft:boat" +function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction new file mode 100644 index 0000000000..2aeb6802b4 --- /dev/null +++ b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction @@ -0,0 +1,19 @@ +# Initial Logic for rod reeling chest_boat +# @s = player who fished +# at @s +# run from advancement gm4_reeling_rods:fishing/chest_boat + +advancement revoke @s only gm4_reeling_rods:fishing/chest_boat + +function gm4_reeling_rods:store_player_pos + +tag @s add gm4_reeling_rods.player + +execute as @e[type=minecraft:fishing_bobber,distance=..33] \ + if function gm4_reeling_rods:fishing/owns_bobber \ + at @s positioned ~ ~-0.45 ~ \ + as @e[type=minecraft:chest_boat,distance=..0.00001,limit=1] \ + unless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \ + run function gm4_reeling_rods:fishing/chest_boat/action + +tag @s remove gm4_reeling_rods.player diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json new file mode 100644 index 0000000000..4a06361e37 --- /dev/null +++ b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json @@ -0,0 +1,41 @@ +{ + "values": [ + "minecraft:boat", + "minecraft:chest_boat", + "minecraft:skeleton_horse", + "minecraft:zombie_horse", + "minecraft:horse", + "minecraft:allay", + "minecraft:armadillo", + "minecraft:axolotl", + "minecraft:bee", + "minecraft:camel", + "minecraft:cat", + "minecraft:chicken", + "minecraft:cow", + "minecraft:dolphin", + "minecraft:donkey", + "minecraft:fox", + "minecraft:frog", + "minecraft:glow_squid", + "minecraft:goat", + "minecraft:hoglin", + "minecraft:iron_golem", + "minecraft:llama", + "minecraft:mooshroom", + "minecraft:mule", + "minecraft:ocelot", + "minecraft:parrot", + "minecraft:pig", + "minecraft:polar_bear", + "minecraft:rabbit", + "minecraft:sheep", + "minecraft:sniffer", + "minecraft:snow_golem", + "minecraft:squid", + "minecraft:strider", + "minecraft:trader_llama", + "minecraft:wolf", + "minecraft:zoglin" + ] +} diff --git a/gm4_reeling_rods/beet.yaml b/gm4_reeling_rods/beet.yaml index eda3748229..5801549d49 100644 --- a/gm4_reeling_rods/beet.yaml +++ b/gm4_reeling_rods/beet.yaml @@ -9,6 +9,14 @@ data_pack: min_inclusive: 61 max_inclusive: 61 directory: since_61 + - formats: + min_inclusive: 57 + max_inclusive: 61 + directory: since_57 + - formats: + min_inclusive: 48 + max_inclusive: 48 + directory: backport_48 pipeline: - generate_files diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json index ae13a5bfeb..d4a2d4449f 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json @@ -10,7 +10,6 @@ "minecraft:spruce_chest_boat", "minecraft:dark_oak_chest_boat", "minecraft:mangrove_chest_boat", - "minecraft:mangrove_chest_boat", "minecraft:skeleton_horse", "minecraft:zombie_horse", "minecraft:horse", diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 410641d597..f87f43756f 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -19,7 +19,8 @@ def beet_default(ctx: Context): def create_files(entities: List[Entity]): for entity in entities: since_61 = "pale_oak" in entity.entity_type - output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data + is_chest_boat = "chest_boat" in entity.entity_type or "chest_raft" in entity.entity_type + output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["since_57"] if is_chest_boat else ctx.data entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv"] = Function([ f"# Initial Logic for rod reeling {entity_type_no_prefix}", @@ -78,7 +79,7 @@ def create_files(entities: List[Entity]): "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" } }) - if not ("minecart" in entity.entity_type or "chest" in entity.entity_type): # Other entity types need to have actions defined manually + if not ("minecart" in entity.entity_type or is_chest_boat): # Other entity types need to have actions defined manually continue if "minecart" in entity.entity_type: # minecart types output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ @@ -95,7 +96,7 @@ def create_files(entities: List[Entity]): "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" ]) continue - if "chest" in entity.entity_type: # chest boats / raft + if is_chest_boat: # chest boats / raft specific output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ f"# Action for reeled {entity_type_no_prefix}", f"# @s = {entity_type_no_prefix}", diff --git a/gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json new file mode 100644 index 0000000000..8d73a3466c --- /dev/null +++ b/gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json @@ -0,0 +1,50 @@ +{ + "values": [ + "#minecraft:boat", + "minecraft:acacia_chest_boat", + "minecraft:oak_chest_boat", + "minecraft:cherry_chest_boat", + "minecraft:birch_chest_boat", + "minecraft:bamboo_chest_raft", + "minecraft:jungle_chest_boat", + "minecraft:spruce_chest_boat", + "minecraft:dark_oak_chest_boat", + "minecraft:pale_oak_chest_boat", + "minecraft:mangrove_chest_boat", + "minecraft:skeleton_horse", + "minecraft:zombie_horse", + "minecraft:horse", + "minecraft:allay", + "minecraft:armadillo", + "minecraft:axolotl", + "minecraft:bee", + "minecraft:camel", + "minecraft:cat", + "minecraft:chicken", + "minecraft:cow", + "minecraft:dolphin", + "minecraft:donkey", + "minecraft:fox", + "minecraft:frog", + "minecraft:glow_squid", + "minecraft:goat", + "minecraft:hoglin", + "minecraft:iron_golem", + "minecraft:llama", + "minecraft:mooshroom", + "minecraft:mule", + "minecraft:ocelot", + "minecraft:parrot", + "minecraft:pig", + "minecraft:polar_bear", + "minecraft:rabbit", + "minecraft:sheep", + "minecraft:sniffer", + "minecraft:snow_golem", + "minecraft:squid", + "minecraft:strider", + "minecraft:trader_llama", + "minecraft:wolf", + "minecraft:zoglin" + ] +} From aaed0f762fe15e462b077194f8173d9b20824b30 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 10 Mar 2025 09:28:15 +0900 Subject: [PATCH 03/37] Add player gamemode check --- .../gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction | 2 ++ gm4_reeling_rods/generate_files.py | 1 + 2 files changed, 3 insertions(+) diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction index 2aeb6802b4..0d537a6a3e 100644 --- a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction +++ b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction @@ -5,6 +5,8 @@ advancement revoke @s only gm4_reeling_rods:fishing/chest_boat +execute if entity @s[gamemode=adventure] run return fail + function gm4_reeling_rods:store_player_pos tag @s add gm4_reeling_rods.player diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index f87f43756f..d74c9284e0 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -28,6 +28,7 @@ def create_files(entities: List[Entity]): "# at @s", f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}", f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}", + "\nexecute if entity @s[gamemode=adventure] run return fail", "\nfunction gm4_reeling_rods:store_player_pos", "\ntag @s add gm4_reeling_rods.player\n", "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", From 11e7606c0d77dba205eb513d515016e015e8e46a Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 10 Mar 2025 09:28:36 +0900 Subject: [PATCH 04/37] Fix Allay HandItems[0] being removed instead of set empty --- .../gm4_reeling_rods/function/fishing/allay/action.mcfunction | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction index 3ad4f4422a..1d2c15de1b 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction @@ -4,5 +4,5 @@ # run from gm4_reeling_rods:fishing/allay/adv data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] -data remove entity @s HandItems[0] +data modify entity @s HandItems[0] set value {} execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate From a4a3b57daf6519a3522a0a398be58cbc67a7a741 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 10 Mar 2025 09:29:05 +0900 Subject: [PATCH 05/37] Add shulker pulling --- .../function/fishing/shulker/action.mcfunction | 6 ++++++ gm4_reeling_rods/generate_files.py | 1 + 2 files changed, 7 insertions(+) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction new file mode 100644 index 0000000000..2d7dd0e62d --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction @@ -0,0 +1,6 @@ +# Action for reeled shulker +# @s = shulker +# at @s +# run from gm4_reeling_rods:fishing/shulker/adv + +execute facing entity @a[tag=gm4_reeling_rods.player,distance=..33,limit=1] eyes run tp @s ^ ^ ^1 diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index d74c9284e0..e8eda9f6a2 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -142,6 +142,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:furnace_minecart","-0.55999", True)) entity_list.append(Entity("minecraft:hopper_minecart","-0.55999", True)) entity_list.append(Entity("minecraft:tnt_minecart","-0.55999",True)) + entity_list.append(Entity("minecraft:shulker","-0.8",False)) entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags From ac894adf61cd57460c1a7def26c0a0eda54d3694 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 10 Mar 2025 15:29:48 +0900 Subject: [PATCH 06/37] Fix minecart fishing bobber vertical displacement off by 0.00001 --- gm4_reeling_rods/generate_files.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index e8eda9f6a2..f671796fb9 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -132,16 +132,16 @@ def create_lookup_file(): ctx.data["gm4_reeling_rods:set_lookup_table"] = Function(strList) entity_list: List[Entity] = [] - + # Vertical displacement for mobs is -0.8 * the entities hibox height. Entities with hitboxes that arent just width and height are different entity_list.append(Entity("minecraft:painting","-0.4",False)) entity_list.append(Entity("minecraft:item_frame","-0.4",False)) entity_list.append(Entity("minecraft:glow_item_frame","-0.4",False)) entity_list.append(Entity("minecraft:leash_knot","-0.4",False)) entity_list.append(Entity("minecraft:allay","-0.48",True)) - entity_list.append(Entity("minecraft:chest_minecart","-0.55999",True)) - entity_list.append(Entity("minecraft:furnace_minecart","-0.55999", True)) - entity_list.append(Entity("minecraft:hopper_minecart","-0.55999", True)) - entity_list.append(Entity("minecraft:tnt_minecart","-0.55999",True)) + entity_list.append(Entity("minecraft:chest_minecart","-0.56",True)) + entity_list.append(Entity("minecraft:furnace_minecart","-0.56", True)) + entity_list.append(Entity("minecraft:hopper_minecart","-0.56", True)) + entity_list.append(Entity("minecraft:tnt_minecart","-0.56",True)) entity_list.append(Entity("minecraft:shulker","-0.8",False)) entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) From 5f94a20ff3fc2d9a042b1ba363fe67167dddd5ee Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 10 Mar 2025 15:43:51 +0900 Subject: [PATCH 07/37] Fix Allay item summon wrong location --- .../gm4_reeling_rods/function/fishing/allay/action.mcfunction | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction index 1d2c15de1b..568c691135 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction @@ -5,4 +5,4 @@ data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] data modify entity @s HandItems[0] set value {} -execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate +function gm4_reeling_rods:separate From a5c5e14847026908328892571b74add6774c7ff3 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 10 Mar 2025 15:51:23 +0900 Subject: [PATCH 08/37] Add witch potion stealing --- .../function/fishing/witch/action.mcfunction | 8 ++++++++ gm4_reeling_rods/generate_files.py | 1 + 2 files changed, 9 insertions(+) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction new file mode 100644 index 0000000000..388b44bcd9 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction @@ -0,0 +1,8 @@ +# Action for reeled witch +# @s = witch +# at @s +# run from gm4_reeling_rods:fishing/witch/adv + +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] +data modify entity @s HandItems[0] set value {} +execute positioned ~ ~1.2 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index f671796fb9..86389c675e 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -143,6 +143,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:hopper_minecart","-0.56", True)) entity_list.append(Entity("minecraft:tnt_minecart","-0.56",True)) entity_list.append(Entity("minecraft:shulker","-0.8",False)) + entity_list.append(Entity("minecraft:witch","-1.56",True)) entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags From 216f9568ffc47eb01410dae7dcdc48ef05624a20 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 11 Mar 2025 07:57:29 +0900 Subject: [PATCH 09/37] Slight python change --- gm4_reeling_rods/generate_files.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 86389c675e..66aa144a1e 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -133,15 +133,9 @@ def create_lookup_file(): entity_list: List[Entity] = [] # Vertical displacement for mobs is -0.8 * the entities hibox height. Entities with hitboxes that arent just width and height are different - entity_list.append(Entity("minecraft:painting","-0.4",False)) - entity_list.append(Entity("minecraft:item_frame","-0.4",False)) - entity_list.append(Entity("minecraft:glow_item_frame","-0.4",False)) + entity_list.append(Entity("minecraft:leash_knot","-0.4",False)) entity_list.append(Entity("minecraft:allay","-0.48",True)) - entity_list.append(Entity("minecraft:chest_minecart","-0.56",True)) - entity_list.append(Entity("minecraft:furnace_minecart","-0.56", True)) - entity_list.append(Entity("minecraft:hopper_minecart","-0.56", True)) - entity_list.append(Entity("minecraft:tnt_minecart","-0.56",True)) entity_list.append(Entity("minecraft:shulker","-0.8",False)) entity_list.append(Entity("minecraft:witch","-1.56",True)) entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) @@ -149,7 +143,11 @@ def create_lookup_file(): item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: entity_list.append(Entity(chest_boat,"-0.45",True)) - + for minecart in ["minecraft:chest_minecart","minecraft:furnace_minecart","minecraft:hopper_minecart","minecraft:tnt_minecart"]: + entity_list.append(Entity(minecart,"-0.56",True)) + for special_hitbox in ["minecraft:painting","minecraft:item_frame", "minecraft:glow_item_frame"]: + entity_list.append(Entity(special_hitbox,"-0.4",False)) + create_files(entity_list) create_lookup_file() \ No newline at end of file From 0f37745b8619a84a57dc085b731a0905a16b1921 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 11 Mar 2025 14:29:24 +0900 Subject: [PATCH 10/37] Add villager theft --- .../fishing/villager/action.mcfunction | 30 +++++++++++++++++++ .../fishing/villager/add_gossip.mcfunction | 16 ++++++++++ .../fishing/villager/sell_out.mcfunction | 9 ++++++ gm4_reeling_rods/generate_files.py | 4 +-- 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction new file mode 100644 index 0000000000..171d119d14 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction @@ -0,0 +1,30 @@ +# Action for reeled villager +# @s = villager +# at @s +# run from gm4_reeling_rods:fishing/villager/adv + +# fail if baby +execute store result score $misc gm4_reeling_rods.math run data get entity @s Age +execute unless score $misc gm4_reeling_rods.math matches 0.. run return fail + +# fail if not holding anything +execute unless data entity @s HandItems[0].id run return fail + +# find trade and sell it out +data modify storage gm4_reeling_rods:temp entity_data set value {} +data modify storage gm4_reeling_rods:temp entity_data.mainhand set from entity @s HandItems[0] +function gm4_reeling_rods:fishing/villager/sell_out with storage gm4_reeling_rods:temp entity_data + +# adds 20 "major_negative" gossip of the player to the villager +data modify storage gm4_reeling_rods:temp entity_data.gossip.Target set from entity @a[tag=gm4_reeling_rods.player,limit=1,distance=..33] UUID +function gm4_reeling_rods:fishing/villager/add_gossip with storage gm4_reeling_rods:temp entity_data.gossip + +# angry particles +particle minecraft:angry_villager ~ ~1.5 ~ 0.3 0.3 0.3 20 3 +# angry sound +playsound minecraft:entity.villager.hurt neutral @a[distance=..16] ~ ~1.5 ~ + +# pulls item +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] +data modify entity @s HandItems[0] set value {} +execute positioned ~ ~1.1 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction new file mode 100644 index 0000000000..e30b69c30a --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction @@ -0,0 +1,16 @@ +# adds a "major_negaive" gossip of the player to the villager +# @s = villager +# at @s +# with {Target} +# run from fishing/villager/action + +$execute store success score $success gm4_reeling_rods.math run \ + data modify storage gm4_reeling_rods:temp entity_data.gossip merge from entity @s Gossips[{Type:"major_negative",Target:$(Target)}] + +execute unless score $success gm4_reeling_rods.math matches 1 run data modify storage gm4_reeling_rods:temp entity_data.gossip merge value {Type:"major_negative",Value:0} + +execute store result score $gossip_value gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp entity_data.gossip.Value +execute unless score $gossip_value gm4_reeling_rods.math matches ..80 run scoreboard players set $gossip_value gm4_reeling_rods.math 100 +execute if score $gossip_value gm4_reeling_rods.math matches ..80 run scoreboard players add $gossip_value gm4_reeling_rods.math 20 +execute store result storage gm4_reeling_rods:temp entity_data.gossip.Value int 1 run scoreboard players get $gossip_value gm4_reeling_rods.math +data modify entity @s Gossips append from storage gm4_reeling_rods:temp entity_data.gossip diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction new file mode 100644 index 0000000000..0e44e3e048 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction @@ -0,0 +1,9 @@ +# sells out a trade +# @s = villager +# at @s +# with {mainhand} +# run from fishing/villager/action + +# for some reason on the first item after a restock?? it fails to set uses, but succeeds after that? This double set doesn't fix that though +$data modify entity @s Offers.Recipes[{sell:$(mainhand)}] merge value {uses:0} +$data modify entity @s Offers.Recipes[{sell:$(mainhand)}].uses set from entity @s Offers.Recipes[{sell:$(mainhand)}].maxUses diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 66aa144a1e..85b49bd84e 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -137,7 +137,6 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:leash_knot","-0.4",False)) entity_list.append(Entity("minecraft:allay","-0.48",True)) entity_list.append(Entity("minecraft:shulker","-0.8",False)) - entity_list.append(Entity("minecraft:witch","-1.56",True)) entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags @@ -147,7 +146,8 @@ def create_lookup_file(): entity_list.append(Entity(minecart,"-0.56",True)) for special_hitbox in ["minecraft:painting","minecraft:item_frame", "minecraft:glow_item_frame"]: entity_list.append(Entity(special_hitbox,"-0.4",False)) - + for villager_height in ["minecraft:witch","minecraft:villager"]: + entity_list.append(Entity(villager_height,"-1.56",True)) create_files(entity_list) create_lookup_file() \ No newline at end of file From b116175423f98e590ab96ed066a7954d731462ca Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 11 Mar 2025 19:41:24 +0900 Subject: [PATCH 11/37] Python changes to allow baby mobs to be processed --- gm4_reeling_rods/generate_files.py | 126 ++++++++++++++++++----------- 1 file changed, 80 insertions(+), 46 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 85b49bd84e..789c8624fc 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -1,13 +1,27 @@ from typing import List from beet import Context, Advancement, Function from beet.contrib.vanilla import Vanilla +from beet.core.utils import JsonDict import math +from copy import deepcopy class Entity: - def __init__(self, entity_type: str, vertical_displacement: str, needs_enchantment: bool): + def __init__(self, entity_type: str, can_be_baby: bool, vertical_displacement: str, needs_enchantment: bool): self.entity_type = entity_type self.vertical_displacement = vertical_displacement self.needs_enchantment = needs_enchantment + self.can_be_baby = can_be_baby + +# Function from: https://www.geeksforgeeks.org/recursively-merge-dictionaries-in-python/ +def recursive_merge(dict1:JsonDict, dict2:JsonDict): + for key, value in dict2.items(): + if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict): + # Recursively merge nested dictionaries + dict1[key] = recursive_merge(dict1[key], value) # type: ignore + else: + # Merge non-dictionary values + dict1[key] = value + return dict1 def beet_default(ctx: Context): """generates the advancements, the subsequent functions for handling reeling, and set_lookup_table.mcfunction @@ -22,64 +36,84 @@ def create_files(entities: List[Entity]): is_chest_boat = "chest_boat" in entity.entity_type or "chest_raft" in entity.entity_type output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["since_57"] if is_chest_boat else ctx.data entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv"] = Function([ - f"# Initial Logic for rod reeling {entity_type_no_prefix}", - "# @s = player who fished", - "# at @s", - f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}", - f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}", - "\nexecute if entity @s[gamemode=adventure] run return fail", - "\nfunction gm4_reeling_rods:store_player_pos", - "\ntag @s add gm4_reeling_rods.player\n", - "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", - "\tif function gm4_reeling_rods:fishing/owns_bobber \\", - f"\tat @s positioned ~ ~{entity.vertical_displacement} ~ \\", - f"\tas @e[type={entity.entity_type},distance=..0.00001,limit=1] \\", - "\tunless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \\", - f"\trun function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", - "\ntag @s remove gm4_reeling_rods.player" - ]) + # Create advancement file + advancement_json : JsonDict = { + "criteria":{ + "fishing_rod_hooked":{ + "trigger":"minecraft:fishing_rod_hooked", + "conditions":{ + "entity":{ + "type" : entity.entity_type + } + } + } + }, + "rewards":{ + "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" + } + } if entity.needs_enchantment: - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}"] = Advancement({ + recursive_merge(advancement_json,{ "criteria":{ "fishing_rod_hooked":{ - "trigger": "minecraft:fishing_rod_hooked", - "conditions": { - "rod": { - "predicates": { - "minecraft:enchantments": [ - { - "enchantments": "gm4_reeling_rods:reeling" - } + "conditions":{ + "rod":{ + "predicates":{ + "minecraft:enchantments":[ + {"enchantments":"gm4_reeling_rods:reeling"} ] } - }, - "entity": { - "type": entity.entity_type } } } - }, - "rewards": { - "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" } }) - else: - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}"] = Advancement({ + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}"] = Advancement(advancement_json) + if entity.can_be_baby: + advancement_json_baby:JsonDict = deepcopy(advancement_json) + recursive_merge(advancement_json_baby,{ "criteria":{ "fishing_rod_hooked":{ - "trigger":"minecraft:fishing_rod_hooked", "conditions":{ "entity":{ - "type": entity.entity_type + "flags":{ + "is_baby": True + } } } } }, "rewards":{ - "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" + "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv_baby" } }) + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby"] = Advancement(advancement_json_baby) + # Create adv function + adv_func : List[str] = [ + f"# Initial Logic for rod reeling {entity_type_no_prefix}", + "# @s = player who fished", + "# at @s", + f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}", + f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}", + "\nexecute if entity @s[gamemode=adventure] run return fail", + "\nfunction gm4_reeling_rods:store_player_pos", + "\ntag @s add gm4_reeling_rods.player\n", + "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", + "\tif function gm4_reeling_rods:fishing/owns_bobber \\", + f"\tat @s positioned ~ ~{entity.vertical_displacement} ~ \\", + f"\tas @e[type={entity.entity_type},distance=..0.00001,limit=1] \\", + "\tunless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \\", + f"\trun function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", + "\ntag @s remove gm4_reeling_rods.player" + ] + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv"] = Function(adv_func) + if entity.can_be_baby: + adv_func_baby = deepcopy(adv_func) + adv_func_baby[0] = f"# Initial Logic for rod reeling baby {entity_type_no_prefix}" + adv_func_baby[3] = f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby" + adv_func_baby[4] = f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby" + adv_func_baby[10] = f"\tat @s positioned ~ ~{str(float(entity.vertical_displacement) / 2)} ~ \\" + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv_baby"] = Function(adv_func_baby) if not ("minecart" in entity.entity_type or is_chest_boat): # Other entity types need to have actions defined manually continue if "minecart" in entity.entity_type: # minecart types @@ -134,20 +168,20 @@ def create_lookup_file(): entity_list: List[Entity] = [] # Vertical displacement for mobs is -0.8 * the entities hibox height. Entities with hitboxes that arent just width and height are different - entity_list.append(Entity("minecraft:leash_knot","-0.4",False)) - entity_list.append(Entity("minecraft:allay","-0.48",True)) - entity_list.append(Entity("minecraft:shulker","-0.8",False)) - entity_list.append(Entity("minecraft:end_crystal","-1.6",False)) + entity_list.append(Entity("minecraft:leash_knot",False,"-0.4",False)) + entity_list.append(Entity("minecraft:allay",False,"-0.48",True)) + entity_list.append(Entity("minecraft:shulker",False,"-0.8",False)) + entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: - entity_list.append(Entity(chest_boat,"-0.45",True)) + entity_list.append(Entity(chest_boat,False,"-0.45",True)) for minecart in ["minecraft:chest_minecart","minecraft:furnace_minecart","minecraft:hopper_minecart","minecraft:tnt_minecart"]: - entity_list.append(Entity(minecart,"-0.56",True)) + entity_list.append(Entity(minecart,False,"-0.56",True)) for special_hitbox in ["minecraft:painting","minecraft:item_frame", "minecraft:glow_item_frame"]: - entity_list.append(Entity(special_hitbox,"-0.4",False)) + entity_list.append(Entity(special_hitbox,False,"-0.4",False)) for villager_height in ["minecraft:witch","minecraft:villager"]: - entity_list.append(Entity(villager_height,"-1.56",True)) + entity_list.append(Entity(villager_height,False,"-1.56",True)) create_files(entity_list) create_lookup_file() \ No newline at end of file From 7c22088aa850357fe44341f7555ecbdb1e868846 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 11 Mar 2025 20:30:31 +0900 Subject: [PATCH 12/37] Add fox theft --- .../function/fishing/fox/action.mcfunction | 9 +++++++++ gm4_reeling_rods/generate_files.py | 1 + 2 files changed, 10 insertions(+) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction new file mode 100644 index 0000000000..bc805900d2 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction @@ -0,0 +1,9 @@ +# Action for reeled fox +# @s = fox +# at @s +# run from fishing/fox/adv and fishing/fox/adv_baby + +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +data modify entity @s HandItems[0] set value {} +function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 789c8624fc..f73844acf0 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -172,6 +172,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:allay",False,"-0.48",True)) entity_list.append(Entity("minecraft:shulker",False,"-0.8",False)) entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False)) + entity_list.append(Entity("minecraft:fox",True,"-0.56",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: From 2bffbbe1b74145c7bdffb0ba06a5ff5e7df487f9 Mon Sep 17 00:00:00 2001 From: runcows Date: Wed, 12 Mar 2025 05:14:10 +0900 Subject: [PATCH 13/37] Add witch theft limit --- .../function/fishing/witch/action.mcfunction | 6 ++++++ .../function/fishing/witch/limit.mcfunction | 8 ++++++++ .../data/gm4_reeling_rods/function/init.mcfunction | 1 + 3 files changed, 15 insertions(+) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction index 388b44bcd9..8f604c7fe6 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction @@ -3,6 +3,12 @@ # at @s # run from gm4_reeling_rods:fishing/witch/adv +# return if no item in mainhand +execute unless data entity @s HandItems[0].id run return fail + +execute if score @s gm4_reeling_rods.entities matches 2 run return run function gm4_reeling_rods:fishing/witch/limit +scoreboard players add @s gm4_reeling_rods.entities 1 + data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] data modify entity @s HandItems[0] set value {} execute positioned ~ ~1.2 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction new file mode 100644 index 0000000000..57e13e8513 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction @@ -0,0 +1,8 @@ +# Sets a limit on witch so player cant steal any more +# @s = witch +# at @s +# run from gm4_reeling_rods:fishing/witch/action + +tag @s add gm4_reeling_rods.immune +particle minecraft:witch ~ ~1.2 ~ 0.5 0.7 0.5 40 25 +playsound minecraft:entity.witch.celebrate hostile @a[distance=..16] ~ ~1.5 ~ diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction index 36500c6f3a..33486c7cab 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction @@ -5,6 +5,7 @@ scoreboard players set reeling_rods gm4_modules 1 scoreboard objectives add gm4_reeling_rods.math dummy "gm4_reeling math" scoreboard objectives add gm4_reeling_rods.lookup dummy "gm4_reeling lookup table" +scoreboard objectives add gm4_reeling_rods.entities dummy "gm4_reeling entity specific" # set_lookup_table generated in generate_files.py function gm4_reeling_rods:set_lookup_table From 72be04adde7eb2d19d968261bee079b6337ea0fc Mon Sep 17 00:00:00 2001 From: runcows Date: Wed, 12 Mar 2025 05:32:24 +0900 Subject: [PATCH 14/37] Add pig desaddling --- .../function/fishing/pig/action.mcfunction | 11 +++++++++++ gm4_reeling_rods/generate_files.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction new file mode 100644 index 0000000000..a36a8d7ff7 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction @@ -0,0 +1,11 @@ +# Action for reeled pig +# @s = pig +# at @s +# run from fishing/pig/adv and fishing/pig/adv_baby + +# fail if no saddle +execute unless data entity @s {Saddle:1b} run return fail + +data modify entity @s Saddle set value 0b +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:saddle",count:1} +execute positioned ~ ~0.5 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index f73844acf0..4a6776f2fb 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -173,6 +173,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:shulker",False,"-0.8",False)) entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False)) entity_list.append(Entity("minecraft:fox",True,"-0.56",True)) + entity_list.append(Entity("minecraft:pig",True,"-0.72",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: From 96857d50f06972c750a108f424262e9f818fe24b Mon Sep 17 00:00:00 2001 From: runcows Date: Wed, 12 Mar 2025 05:38:33 +0900 Subject: [PATCH 15/37] Add strider desaddling --- .../function/fishing/strider/action.mcfunction | 11 +++++++++++ gm4_reeling_rods/generate_files.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction new file mode 100644 index 0000000000..ed8303638c --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction @@ -0,0 +1,11 @@ +# Action for reeled strider +# @s = strider +# at @s +# run from fishing/strider/adv and fishing/strider/adv_baby + +# fail if no saddle +execute unless data entity @s {Saddle:1b} run return fail + +data modify entity @s Saddle set value 0b +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:saddle",count:1} +execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 4a6776f2fb..da89f4677a 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -174,6 +174,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False)) entity_list.append(Entity("minecraft:fox",True,"-0.56",True)) entity_list.append(Entity("minecraft:pig",True,"-0.72",True)) + entity_list.append(Entity("minecraft:strider",True,"-1.36",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: From f33d99e59a69eb308f030f705747c6270aecff94 Mon Sep 17 00:00:00 2001 From: runcows Date: Wed, 12 Mar 2025 16:54:52 +0900 Subject: [PATCH 16/37] Add snow golem beheading --- .../function/fishing/snow_golem/action.mcfunction | 11 +++++++++++ gm4_reeling_rods/generate_files.py | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction new file mode 100644 index 0000000000..5e0dae8a66 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction @@ -0,0 +1,11 @@ +# Action for reeled snow_golem +# @s = snow_golem +# at @s +# run from fishing/snow_golem/adv + +# fail if no Pumpkin +execute unless data entity @s {Pumpkin:1b} run return fail + +data modify entity @s Pumpkin set value 0b +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:carved_pumpkin",count:1} +execute positioned ~ ~1.2 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index da89f4677a..93fcc7fe11 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -166,7 +166,7 @@ def create_lookup_file(): ctx.data["gm4_reeling_rods:set_lookup_table"] = Function(strList) entity_list: List[Entity] = [] - # Vertical displacement for mobs is -0.8 * the entities hibox height. Entities with hitboxes that arent just width and height are different + # Vertical displacement for mobs is -0.8 * the entities hitbox height. Entities with hitboxes that arent just width and height are different entity_list.append(Entity("minecraft:leash_knot",False,"-0.4",False)) entity_list.append(Entity("minecraft:allay",False,"-0.48",True)) @@ -175,6 +175,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:fox",True,"-0.56",True)) entity_list.append(Entity("minecraft:pig",True,"-0.72",True)) entity_list.append(Entity("minecraft:strider",True,"-1.36",True)) + entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: From 0b10b5146e5008b4eb9b23d7a306a62df0cd62b6 Mon Sep 17 00:00:00 2001 From: runcows Date: Wed, 12 Mar 2025 16:56:12 +0900 Subject: [PATCH 17/37] Add entity TODO list --- gm4_reeling_rods/generate_files.py | 52 +++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 93fcc7fe11..a3966232c8 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -188,4 +188,54 @@ def create_lookup_file(): entity_list.append(Entity(villager_height,False,"-1.56",True)) create_files(entity_list) create_lookup_file() - \ No newline at end of file + + ''' + My goal for right now is to go to the maximum scope and then have things cut back. + Push this idea as far as I can, then reign it in. + + TODO: + ALL DISMOUNT + Check if passenger, dismount. + Prepend this logic to all entity list action function + Return if dismounting + Horse, Skele Horse, Zomb Horse : + Steal Armor? + Desaddle + Donkey, Mule : + ChestedHorse + Items + Desaddle + Llama, Trader Llama : + ChestedHorse + Items + Carpet stored in armor.body + Pufferfish : + Fully Puff? Only able to hook outside of water + Do they already do this? + Sheep : + Shear? + Wandering Trader : + Theft Trades? + Steal llamas? + Wolf : + Steal armor? + Piglin, Zomb Piglin, Piglin Brute, Bogged, + Skeleton, Stray, Husk, Drowned, Pillager, + Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: + Steal held item. No threat? Armor instead? + Balance issues per mob + Creaking : + Look into how fishing one works in vanilla. + If rooted on ground, unroot and fly at player + Evoker : + ???? + Illusioner : + ???? + Player : + Steal hand items? + Armor? Too busted? + + NOTE: --- NO --- + Enderman: NOT FEASIBLE. Block state stored, not item data. + Steal held block + Could setblock with the block state, then get drop from breaking + Could map block type to item, but that's far too much work and not maintainable + ''' From 340319aef89e338cbe060e66592f94717fc74d2d Mon Sep 17 00:00:00 2001 From: runcows Date: Thu, 13 Mar 2025 09:15:07 +0900 Subject: [PATCH 18/37] Add wolf armor stealing --- .../function/fishing/wolf/action.mcfunction | 11 +++++++++++ gm4_reeling_rods/generate_files.py | 16 ++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction new file mode 100644 index 0000000000..caf7fbff98 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction @@ -0,0 +1,11 @@ +# Action for reeled wolf +# @s = wolf +# at @s +# run from fishing/wolf/adv and fishing/wolf/adv_baby + +# fail if no Owner +execute unless data entity @s Owner run return fail + +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item +data remove entity @s body_armor_item +execute positioned ~ ~0.4 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index a3966232c8..52d6014397 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -176,6 +176,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:pig",True,"-0.72",True)) entity_list.append(Entity("minecraft:strider",True,"-1.36",True)) entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True)) + entity_list.append(Entity("minecraft:wolf",True,"-0.68",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: @@ -207,24 +208,14 @@ def create_lookup_file(): Llama, Trader Llama : ChestedHorse + Items Carpet stored in armor.body - Pufferfish : - Fully Puff? Only able to hook outside of water - Do they already do this? - Sheep : - Shear? Wandering Trader : Theft Trades? Steal llamas? - Wolf : - Steal armor? Piglin, Zomb Piglin, Piglin Brute, Bogged, Skeleton, Stray, Husk, Drowned, Pillager, Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: Steal held item. No threat? Armor instead? Balance issues per mob - Creaking : - Look into how fishing one works in vanilla. - If rooted on ground, unroot and fly at player Evoker : ???? Illusioner : @@ -238,4 +229,9 @@ def create_lookup_file(): Steal held block Could setblock with the block state, then get drop from breaking Could map block type to item, but that's far too much work and not maintainable + Pufferfish : Setting PuffState has issues. Also stupid hitbox changes size >:( + Puff up a bit + Sheep : Would need a map from Color Byte to string. Annoying. Maybe revisit + Shear? + ''' From 7f4c66e0eba672f84aa33dd4657822a0a614af22 Mon Sep 17 00:00:00 2001 From: runcows Date: Thu, 13 Mar 2025 10:42:26 +0900 Subject: [PATCH 19/37] Add horse type mob item yoinking --- .../function/fishing/donkey/action.mcfunction | 12 +++++++ .../function/fishing/horse/action.mcfunction | 11 +++++++ .../function/fishing/mule/action.mcfunction | 12 +++++++ gm4_reeling_rods/generate_files.py | 31 ++++++++++++------- 4 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction new file mode 100644 index 0000000000..8331c6a5e2 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction @@ -0,0 +1,12 @@ +# Action for reeled donkey +# @s = donkey +# at @s +# run from fishing/donkey/adv and fishing/donkey/adv_baby + +data modify storage gm4_reeling_rods:temp entity_data set from entity @s +data modify storage gm4_reeling_rods:temp item_data set value {} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem +execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} +execute positioned ~ ~0.7 ~ run function gm4_reeling_rods:separate +data modify entity @s ChestedHorse set value 0b +execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:"minecraft:saddle"}}} run item replace entity @s horse.saddle with minecraft:air diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction new file mode 100644 index 0000000000..fb8a1b611e --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction @@ -0,0 +1,11 @@ +# Action for reeled horse +# @s = horse +# at @s +# run from fishing/horse/adv and fishing/horse/adv_baby + +data modify storage gm4_reeling_rods:temp item_data set value {} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem +execute store result score $armored gm4_reeling_rods.math if data entity @s body_armor_item run data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item +execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate +execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:"minecraft:saddle"}}} run item replace entity @s horse.saddle with minecraft:air +execute if score $armored gm4_reeling_rods.math matches 1 run item replace entity @s armor.body with minecraft:air diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction new file mode 100644 index 0000000000..030d3ec556 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction @@ -0,0 +1,12 @@ +# Action for reeled mule +# @s = mule +# at @s +# run from fishing/mule/adv and fishing/mule/adv_baby + +data modify storage gm4_reeling_rods:temp entity_data set from entity @s +data modify storage gm4_reeling_rods:temp item_data set value {} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem +execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} +execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate +data modify entity @s ChestedHorse set value 0b +execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:"minecraft:saddle"}}} run item replace entity @s horse.saddle with minecraft:air diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 52d6014397..4a8a1399e5 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -114,8 +114,7 @@ def create_files(entities: List[Entity]): adv_func_baby[4] = f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby" adv_func_baby[10] = f"\tat @s positioned ~ ~{str(float(entity.vertical_displacement) / 2)} ~ \\" output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv_baby"] = Function(adv_func_baby) - if not ("minecart" in entity.entity_type or is_chest_boat): # Other entity types need to have actions defined manually - continue + # Some generated action files if "minecart" in entity.entity_type: # minecart types output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ f"# Action for reeled {entity_type_no_prefix}", @@ -146,6 +145,18 @@ def create_files(entities: List[Entity]): "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" ]) continue + if "_horse" in entity.entity_type: # skele and zombie horses + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp item_data set value {}", + "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem", + "execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate", + "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" + ]) + continue def create_lookup_file(): lookup_keys = [0] @@ -177,6 +188,7 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:strider",True,"-1.36",True)) entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True)) entity_list.append(Entity("minecraft:wolf",True,"-0.68",True)) + entity_list.append(Entity("minecraft:donkey",True,"-1.2",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: @@ -187,6 +199,8 @@ def create_lookup_file(): entity_list.append(Entity(special_hitbox,False,"-0.4",False)) for villager_height in ["minecraft:witch","minecraft:villager"]: entity_list.append(Entity(villager_height,False,"-1.56",True)) + for horse_height in ["minecraft:mule","minecraft:horse", "minecraft:zombie_horse", "minecraft:skeleton_horse"]: + entity_list.append(Entity(horse_height,True,"-1.28",True)) create_files(entity_list) create_lookup_file() @@ -199,18 +213,9 @@ def create_lookup_file(): Check if passenger, dismount. Prepend this logic to all entity list action function Return if dismounting - Horse, Skele Horse, Zomb Horse : - Steal Armor? - Desaddle - Donkey, Mule : - ChestedHorse + Items - Desaddle Llama, Trader Llama : ChestedHorse + Items Carpet stored in armor.body - Wandering Trader : - Theft Trades? - Steal llamas? Piglin, Zomb Piglin, Piglin Brute, Bogged, Skeleton, Stray, Husk, Drowned, Pillager, Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: @@ -233,5 +238,7 @@ def create_lookup_file(): Puff up a bit Sheep : Would need a map from Color Byte to string. Annoying. Maybe revisit Shear? - + Wandering Trader : Doesn't hold items. Maybe revist + Theft Trades? + Steal llamas? ''' From 5cc008608041423121a6045124c9ef3daf2027fd Mon Sep 17 00:00:00 2001 From: runcows Date: Thu, 13 Mar 2025 11:02:16 +0900 Subject: [PATCH 20/37] Fix Donkey and Mule code a bit --- .../function/fishing/donkey/action.mcfunction | 4 ++-- .../gm4_reeling_rods/function/fishing/mule/action.mcfunction | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction index 8331c6a5e2..176755d571 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction @@ -8,5 +8,5 @@ data modify storage gm4_reeling_rods:temp item_data set value {} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} execute positioned ~ ~0.7 ~ run function gm4_reeling_rods:separate -data modify entity @s ChestedHorse set value 0b -execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:"minecraft:saddle"}}} run item replace entity @s horse.saddle with minecraft:air +execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b +item replace entity @s horse.saddle with minecraft:air diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction index 030d3ec556..b1b2a5ca7d 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction @@ -8,5 +8,5 @@ data modify storage gm4_reeling_rods:temp item_data set value {} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate -data modify entity @s ChestedHorse set value 0b -execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:"minecraft:saddle"}}} run item replace entity @s horse.saddle with minecraft:air +execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b +item replace entity @s horse.saddle with minecraft:air From ca05491a81c2cf924c51fe6315d9016998e0e178 Mon Sep 17 00:00:00 2001 From: runcows Date: Thu, 13 Mar 2025 11:02:34 +0900 Subject: [PATCH 21/37] Add Llama yoinking --- gm4_reeling_rods/generate_files.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 4a8a1399e5..cb84df655a 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -157,6 +157,21 @@ def create_files(entities: List[Entity]): "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" ]) continue + if "llama" in entity.entity_type: # llama and trader_llama + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data set value {}", + "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item", + "execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", + "execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate", + "execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b", + "item replace entity @s armor.body with minecraft:air" + ]) + continue def create_lookup_file(): lookup_keys = [0] @@ -189,6 +204,8 @@ def create_lookup_file(): entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True)) entity_list.append(Entity("minecraft:wolf",True,"-0.68",True)) entity_list.append(Entity("minecraft:donkey",True,"-1.2",True)) + entity_list.append(Entity("minecraft:llama",True,"-1.496",True)) + entity_list.append(Entity("minecraft:trader_llama",True,"-1.496",True)) item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: @@ -213,9 +230,6 @@ def create_lookup_file(): Check if passenger, dismount. Prepend this logic to all entity list action function Return if dismounting - Llama, Trader Llama : - ChestedHorse + Items - Carpet stored in armor.body Piglin, Zomb Piglin, Piglin Brute, Bogged, Skeleton, Stray, Husk, Drowned, Pillager, Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: From cd3233e0ce7f851004cb94b7015d5a2aebef2e91 Mon Sep 17 00:00:00 2001 From: runcows Date: Sat, 15 Mar 2025 14:11:25 +0900 Subject: [PATCH 22/37] Python refactor & the start of Dismounting work --- .../function/fishing/is_passenger.mcfunction | 6 + gm4_reeling_rods/generate_files.py | 470 ++++++++++-------- 2 files changed, 270 insertions(+), 206 deletions(-) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction new file mode 100644 index 0000000000..5a73a238b8 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction @@ -0,0 +1,6 @@ +# checks if @s is a passenger +# @s = entity to check +# at @s +# run from fishing/{entity_type}/action + +return run execute on vehicle if entity @s diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index cb84df655a..7546835459 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -1,235 +1,71 @@ from typing import List -from beet import Context, Advancement, Function +from beet import Context, Advancement, Function, DataPack from beet.contrib.vanilla import Vanilla from beet.core.utils import JsonDict import math from copy import deepcopy class Entity: - def __init__(self, entity_type: str, can_be_baby: bool, vertical_displacement: str, needs_enchantment: bool): + def __init__(self, entity_type: str, can_be_baby: bool, vertical_displacement: str, needs_enchantment: bool, can_dismount: bool): self.entity_type = entity_type self.vertical_displacement = vertical_displacement self.needs_enchantment = needs_enchantment self.can_be_baby = can_be_baby - -# Function from: https://www.geeksforgeeks.org/recursively-merge-dictionaries-in-python/ -def recursive_merge(dict1:JsonDict, dict2:JsonDict): - for key, value in dict2.items(): - if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict): - # Recursively merge nested dictionaries - dict1[key] = recursive_merge(dict1[key], value) # type: ignore - else: - # Merge non-dictionary values - dict1[key] = value - return dict1 + self.can_dismount = can_dismount def beet_default(ctx: Context): """generates the advancements, the subsequent functions for handling reeling, and set_lookup_table.mcfunction NOTE: Only generates action functions for minecarts and chest boats. Others will have to be defined manually""" - + create_lookup_file(ctx) + vanilla = ctx.inject(Vanilla) vanilla.minecraft_version = '1.21.4' + item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags - def create_files(entities: List[Entity]): - for entity in entities: - since_61 = "pale_oak" in entity.entity_type - is_chest_boat = "chest_boat" in entity.entity_type or "chest_raft" in entity.entity_type - output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["since_57"] if is_chest_boat else ctx.data - entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') - # Create advancement file - advancement_json : JsonDict = { - "criteria":{ - "fishing_rod_hooked":{ - "trigger":"minecraft:fishing_rod_hooked", - "conditions":{ - "entity":{ - "type" : entity.entity_type - } - } - } - }, - "rewards":{ - "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv" - } - } - if entity.needs_enchantment: - recursive_merge(advancement_json,{ - "criteria":{ - "fishing_rod_hooked":{ - "conditions":{ - "rod":{ - "predicates":{ - "minecraft:enchantments":[ - {"enchantments":"gm4_reeling_rods:reeling"} - ] - } - } - } - } - } - }) - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}"] = Advancement(advancement_json) - if entity.can_be_baby: - advancement_json_baby:JsonDict = deepcopy(advancement_json) - recursive_merge(advancement_json_baby,{ - "criteria":{ - "fishing_rod_hooked":{ - "conditions":{ - "entity":{ - "flags":{ - "is_baby": True - } - } - } - } - }, - "rewards":{ - "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv_baby" - } - }) - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby"] = Advancement(advancement_json_baby) - # Create adv function - adv_func : List[str] = [ - f"# Initial Logic for rod reeling {entity_type_no_prefix}", - "# @s = player who fished", - "# at @s", - f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}", - f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}", - "\nexecute if entity @s[gamemode=adventure] run return fail", - "\nfunction gm4_reeling_rods:store_player_pos", - "\ntag @s add gm4_reeling_rods.player\n", - "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", - "\tif function gm4_reeling_rods:fishing/owns_bobber \\", - f"\tat @s positioned ~ ~{entity.vertical_displacement} ~ \\", - f"\tas @e[type={entity.entity_type},distance=..0.00001,limit=1] \\", - "\tunless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \\", - f"\trun function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", - "\ntag @s remove gm4_reeling_rods.player" - ] - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv"] = Function(adv_func) - if entity.can_be_baby: - adv_func_baby = deepcopy(adv_func) - adv_func_baby[0] = f"# Initial Logic for rod reeling baby {entity_type_no_prefix}" - adv_func_baby[3] = f"# run from advancement gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby" - adv_func_baby[4] = f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{entity_type_no_prefix}_baby" - adv_func_baby[10] = f"\tat @s positioned ~ ~{str(float(entity.vertical_displacement) / 2)} ~ \\" - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv_baby"] = Function(adv_func_baby) - # Some generated action files - if "minecart" in entity.entity_type: # minecart types - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", - "function gm4_reeling_rods:separate", - "tp @s ~ -1000 ~", - "data remove storage gm4_reeling_rods:temp entity_data.UUID", - "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" - ]) - continue - if is_chest_boat: # chest boats / raft specific - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", - "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", - "tp @s ~ -1000 ~", - "data remove storage gm4_reeling_rods:temp entity_data.UUID", - f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" - ]) - continue - if "_horse" in entity.entity_type: # skele and zombie horses - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp item_data set value {}", - "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem", - "execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate", - "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" - ]) - continue - if "llama" in entity.entity_type: # llama and trader_llama - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data set value {}", - "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item", - "execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", - "execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate", - "execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b", - "item replace entity @s armor.body with minecraft:air" - ]) - continue - - def create_lookup_file(): - lookup_keys = [0] - for dx in range(0,34): - for dy in range(0,34): - for dz in range(0,34): - potenital_key = (dx * dx) + (dy * dy) + (dz * dz) - if (math.sqrt(potenital_key) > 33): # ignore values out of fishing bobber range - continue - if potenital_key in lookup_keys: # ignore if already found - continue - lookup_keys.append(potenital_key) - lookup_keys.sort() - strList: List[str] = [] - for key in lookup_keys: - value = math.floor(100*(0.08*math.sqrt(math.sqrt(key)))) - strList.append(f"scoreboard players set ${key} gm4_reeling_rods.lookup {value}") - ctx.data["gm4_reeling_rods:set_lookup_table"] = Function(strList) - entity_list: List[Entity] = [] # Vertical displacement for mobs is -0.8 * the entities hitbox height. Entities with hitboxes that arent just width and height are different + entity_list.append(Entity("minecraft:leash_knot",False,"-0.4",False,False)) + entity_list.append(Entity("minecraft:allay",False,"-0.48",True,True)) + entity_list.append(Entity("minecraft:shulker",False,"-0.8",False,True)) + entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False,False)) + entity_list.append(Entity("minecraft:fox",True,"-0.56",True,True)) + entity_list.append(Entity("minecraft:pig",True,"-0.72",True,True)) + entity_list.append(Entity("minecraft:strider",True,"-1.36",True,True)) + entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True,True)) + entity_list.append(Entity("minecraft:wolf",True,"-0.68",True,True)) + entity_list.append(Entity("minecraft:donkey",True,"-1.2",True,True)) + entity_list.append(Entity("minecraft:llama",True,"-1.496",True,True)) + entity_list.append(Entity("minecraft:trader_llama",True,"-1.496",True,True)) - entity_list.append(Entity("minecraft:leash_knot",False,"-0.4",False)) - entity_list.append(Entity("minecraft:allay",False,"-0.48",True)) - entity_list.append(Entity("minecraft:shulker",False,"-0.8",False)) - entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False)) - entity_list.append(Entity("minecraft:fox",True,"-0.56",True)) - entity_list.append(Entity("minecraft:pig",True,"-0.72",True)) - entity_list.append(Entity("minecraft:strider",True,"-1.36",True)) - entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True)) - entity_list.append(Entity("minecraft:wolf",True,"-0.68",True)) - entity_list.append(Entity("minecraft:donkey",True,"-1.2",True)) - entity_list.append(Entity("minecraft:llama",True,"-1.496",True)) - entity_list.append(Entity("minecraft:trader_llama",True,"-1.496",True)) - - item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags for chest_boat in item_tags["minecraft:chest_boats"].data['values']: - entity_list.append(Entity(chest_boat,False,"-0.45",True)) + entity_list.append(Entity(chest_boat,False,"-0.45",True,False)) for minecart in ["minecraft:chest_minecart","minecraft:furnace_minecart","minecraft:hopper_minecart","minecraft:tnt_minecart"]: - entity_list.append(Entity(minecart,False,"-0.56",True)) + entity_list.append(Entity(minecart,False,"-0.56",True,False)) for special_hitbox in ["minecraft:painting","minecraft:item_frame", "minecraft:glow_item_frame"]: - entity_list.append(Entity(special_hitbox,False,"-0.4",False)) + entity_list.append(Entity(special_hitbox,False,"-0.4",False,False)) for villager_height in ["minecraft:witch","minecraft:villager"]: - entity_list.append(Entity(villager_height,False,"-1.56",True)) + entity_list.append(Entity(villager_height,False,"-1.56",True,True)) for horse_height in ["minecraft:mule","minecraft:horse", "minecraft:zombie_horse", "minecraft:skeleton_horse"]: - entity_list.append(Entity(horse_height,True,"-1.28",True)) - create_files(entity_list) - create_lookup_file() - - ''' - My goal for right now is to go to the maximum scope and then have things cut back. - Push this idea as far as I can, then reign it in. - + entity_list.append(Entity(horse_height,True,"-1.28",True,True)) + create_files(ctx, entity_list) +''' +My goal for right now is to go to the maximum scope and then have things cut back. +Push this idea as far as I can, then reign it in. + TODO: + Figure out how to account for different hitbox heights : + Different entity states. Like camel laying down, or player swimming + Multiple checks in the adv function + Slime Dismounting: Size Tag + Advancement checks? + Would need an advancement and function for each size. Maybe just do the normal vanilla 3 + Technically I could do all possible values..... But thats a lot of advancements + Could have 3 separate checks in the adv function. Same as camel and player plans + Attribute, minecraft:scale + Catch 22. Can't factor it in because we need to use it to select the entity. Can't use it before selecting. + ALL DISMOUNT - Check if passenger, dismount. - Prepend this logic to all entity list action function - Return if dismounting + Add more mobs. Hopefully all.... Piglin, Zomb Piglin, Piglin Brute, Bogged, Skeleton, Stray, Husk, Drowned, Pillager, Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: @@ -242,7 +78,8 @@ def create_lookup_file(): Player : Steal hand items? Armor? Too busted? - + Multiple hitbox sizes..... + NOTE: --- NO --- Enderman: NOT FEASIBLE. Block state stored, not item data. Steal held block @@ -255,4 +92,225 @@ def create_lookup_file(): Wandering Trader : Doesn't hold items. Maybe revist Theft Trades? Steal llamas? - ''' +''' + +def create_lookup_file(ctx: Context): + lookup_keys = [0] + for dx in range(0,34): + for dy in range(0,34): + for dz in range(0,34): + potenital_key = (dx * dx) + (dy * dy) + (dz * dz) + if (math.sqrt(potenital_key) > 33): # ignore values out of fishing bobber range + continue + if potenital_key in lookup_keys: # ignore if already found + continue + lookup_keys.append(potenital_key) + lookup_keys.sort() + strList: List[str] = [] + for key in lookup_keys: + value = math.floor(100*(0.08*math.sqrt(math.sqrt(key)))) + strList.append(f"scoreboard players set ${key} gm4_reeling_rods.lookup {value}") + ctx.data["gm4_reeling_rods:set_lookup_table"] = Function(strList) + +# Function from: https://www.geeksforgeeks.org/recursively-merge-dictionaries-in-python/ +def recursive_merge(dict1:JsonDict, dict2:JsonDict): + for key, value in dict2.items(): + if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict): + # Recursively merge nested dictionaries + dict1[key] = recursive_merge(dict1[key], value) # type: ignore + else: + # Merge non-dictionary values + dict1[key] = value + return dict1 + +def create_adv_and_func(output_pack: DataPack, function_name: str, advancement_name: str,entity: Entity, run_on_entity: str, function_desc: str): + entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') + advancement_json : JsonDict = { + "criteria":{ + "fishing_rod_hooked":{ + "trigger":"minecraft:fishing_rod_hooked", + "conditions":{ + "entity":{ + "type" : entity.entity_type + } + } + } + }, + "rewards":{ + "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}" + } + } + if entity.needs_enchantment: + recursive_merge(advancement_json,{ + "criteria":{ + "fishing_rod_hooked":{ + "conditions":{ + "rod":{ + "predicates":{ + "minecraft:enchantments":[ + {"enchantments":"gm4_reeling_rods:reeling"} + ] + } + } + } + } + } + }) + adv_func : List[str] = [ + function_desc, + "# @s = player who fished", + "# at @s", + f"# run from advancement gm4_reeling_rods:fishing/{advancement_name}", + f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{advancement_name}", + "\nexecute if entity @s[gamemode=adventure] run return fail", + "\nfunction gm4_reeling_rods:store_player_pos", + "\ntag @s add gm4_reeling_rods.player\n", + "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", + "\tif function gm4_reeling_rods:fishing/owns_bobber \\", + f"\tat @s positioned ~ ~{entity.vertical_displacement} ~ \\", + f"\tas @e[type={entity.entity_type},distance=..0.00001,limit=1] \\", + "\tunless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \\", + run_on_entity, + "\ntag @s remove gm4_reeling_rods.player" + ] + if entity.can_be_baby: + # change normal advancement to be for explicitly not baby + recursive_merge(advancement_json,{ + "criteria":{ + "fishing_rod_hooked":{ + "conditions":{ + "entity":{ + "flags":{ + "is_baby": False + } + } + } + } + } + }) + # new advancement for explicitly baby + advancement_json_baby:JsonDict = deepcopy(advancement_json) + recursive_merge(advancement_json_baby,{ + "criteria":{ + "fishing_rod_hooked":{ + "conditions":{ + "entity":{ + "flags":{ + "is_baby": True + } + } + } + } + }, + "rewards":{ + "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}_baby" + } + }) + adv_func_baby = deepcopy(adv_func) + adv_func_baby[0] = f"{function_desc}_baby" + adv_func_baby[3] = f"# run from advancement gm4_reeling_rods:fishing/{advancement_name}_baby" + adv_func_baby[4] = f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{advancement_name}_baby" + adv_func_baby[10] = f"\tat @s positioned ~ ~{str(float(entity.vertical_displacement) / 2)} ~ \\" + + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}_baby"] = Function(adv_func_baby) + output_pack[f"gm4_reeling_rods:fishing/{advancement_name}_baby"] = Advancement(advancement_json_baby) + + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}"] = Function(adv_func) + output_pack[f"gm4_reeling_rods:fishing/{advancement_name}"] = Advancement(advancement_json) + +def create_files(ctx: Context, entities: List[Entity]): + for entity in entities: + since_61 = "pale_oak" in entity.entity_type + is_chest_boat = "chest_boat" in entity.entity_type or "chest_raft" in entity.entity_type + output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["since_57"] if is_chest_boat else ctx.data + entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') + create_adv_and_func( + output_pack, + "adv", + entity_type_no_prefix, + entity, + f"\trun function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", + f"# Initial Logic for rod reeling {entity_type_no_prefix}" + ) + # Some generated action files + if "minecart" in entity.entity_type: # minecart types + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", + "function gm4_reeling_rods:separate", + "tp @s ~ -1000 ~", + "data remove storage gm4_reeling_rods:temp entity_data.UUID", + "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + ]) + elif is_chest_boat: # chest boats / raft specific + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", + "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", + "tp @s ~ -1000 ~", + "data remove storage gm4_reeling_rods:temp entity_data.UUID", + f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + ]) + elif "_horse" in entity.entity_type: # skele and zombie horses + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp item_data set value {}", + "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem", + "execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate", + "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" + ]) + elif "llama" in entity.entity_type: # llama and trader_llama + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data set value {}", + "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item", + "execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", + "execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate", + "execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b", + "item replace entity @s armor.body with minecraft:air" + ]) + if entity.can_dismount: # Dismounting logic + if entity.needs_enchantment: # Make a new advancement and adv func for dismounting, with no enchant needed + create_adv_and_func( + output_pack, + "adv_dismount", + f"{entity_type_no_prefix}_dismount", + Entity( + entity.entity_type, + entity.can_be_baby, + entity.vertical_displacement, + False, + entity.can_dismount + ), + f"\tif function gm4_reeling_rods:fishing/is_passenger run ride @s dismount", + f"# Logic for rod dismounting {entity_type_no_prefix}" + ) + else: # prepend dismounting logic to action function + actionFunc = output_pack.functions.get(f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action") + if actionFunc != None: # if existing action, prepend dismounting + actionFunc.prepend(Function([ + "# dismounting logic", + "execute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount\n\n" + ])) + else: # if no action function, make one thats just dismounting + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + "# dismounting logic", + "execute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount" + ]) From 94e59500b9e4874d14c3e80d79ef6e464ffa7b17 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 17 Mar 2025 05:51:59 +0900 Subject: [PATCH 23/37] Remove witch limit --- .../function/fishing/witch/action.mcfunction | 4 ---- .../function/fishing/witch/limit.mcfunction | 8 -------- 2 files changed, 12 deletions(-) delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction index 8f604c7fe6..89d4c89000 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction @@ -5,10 +5,6 @@ # return if no item in mainhand execute unless data entity @s HandItems[0].id run return fail - -execute if score @s gm4_reeling_rods.entities matches 2 run return run function gm4_reeling_rods:fishing/witch/limit -scoreboard players add @s gm4_reeling_rods.entities 1 - data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] data modify entity @s HandItems[0] set value {} execute positioned ~ ~1.2 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction deleted file mode 100644 index 57e13e8513..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/limit.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# Sets a limit on witch so player cant steal any more -# @s = witch -# at @s -# run from gm4_reeling_rods:fishing/witch/action - -tag @s add gm4_reeling_rods.immune -particle minecraft:witch ~ ~1.2 ~ 0.5 0.7 0.5 40 25 -playsound minecraft:entity.witch.celebrate hostile @a[distance=..16] ~ ~1.5 ~ From 1145e15cb5be423d789f508047d3b1608caa9770 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 17 Mar 2025 06:56:56 +0900 Subject: [PATCH 24/37] Fix file new line issue --- .../data/gm4_reeling_rods/advancement/fishing/chest_boat.json | 1 - 1 file changed, 1 deletion(-) diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json index e5fb7a17f8..d7b118493d 100644 --- a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json +++ b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json @@ -22,4 +22,3 @@ "function": "gm4_reeling_rods:fishing/chest_boat/adv" } } - \ No newline at end of file From 04739d7787a104910f7273b1a49a784c5736067a Mon Sep 17 00:00:00 2001 From: runcows <124551271+runcows@users.noreply.github.com> Date: Tue, 18 Mar 2025 16:58:55 +0900 Subject: [PATCH 25/37] Switch to id based system for entity selection * Intial commit for id changes * Fix everything * overwrite old * actual overwrite old --- .../advancement/fishing/chest_boat.json | 24 -- .../fishing/chest_boat/action.mcfunction | 12 - .../fishing/chest_boat/adv.mcfunction | 21 - gm4_reeling_rods/beet.yaml | 2 +- .../function/fishing/select_type.mcfunction | 4 + .../function/id/assign.mcfunction | 20 + .../function/id/get_next.mcfunction | 18 + .../function/id/set.mcfunction | 44 ++ .../gm4_reeling_rods/function/init.mcfunction | 3 +- .../function/player/add_bit.mcfunction | 15 + .../player/find_fished_entity.mcfunction | 15 + .../owns_bobber.mcfunction | 0 .../function/player/received_bit.mcfunction | 24 ++ .../gm4_reeling_rods/function/tick.mcfunction | 4 + .../predicate/holding_reeling_rod.json | 17 + .../tags/entity_type/ignore.json | 38 ++ gm4_reeling_rods/generate_files.py | 378 +++++++----------- 17 files changed, 353 insertions(+), 286 deletions(-) delete mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json delete mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction delete mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => player}/owns_bobber.mcfunction (100%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/predicate/holding_reeling_rod.json create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json deleted file mode 100644 index d7b118493d..0000000000 --- a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/advancement/fishing/chest_boat.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "criteria": { - "fishing_rod_hooked": { - "trigger": "minecraft:fishing_rod_hooked", - "conditions": { - "rod": { - "predicates": { - "minecraft:enchantments": [ - { - "enchantments": "gm4_reeling_rods:reeling" - } - ] - } - }, - "entity": { - "type": "minecraft:chest_boat" - } - } - } - }, - "rewards": { - "function": "gm4_reeling_rods:fishing/chest_boat/adv" - } - } diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction deleted file mode 100644 index 787ca611cb..0000000000 --- a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/action.mcfunction +++ /dev/null @@ -1,12 +0,0 @@ -# Action for reeled chest_boat -# @s = chest_boat -# at @s -# run from gm4_reeling_rods:fishing/chest_boat/adv - -data modify storage gm4_reeling_rods:temp entity_data set from entity @s -data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} -execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate -tp @s ~ -1000 ~ -data remove storage gm4_reeling_rods:temp entity_data.UUID -data modify storage gm4_reeling_rods:temp entity_type set value "minecraft:boat" -function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction deleted file mode 100644 index 0d537a6a3e..0000000000 --- a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/function/fishing/chest_boat/adv.mcfunction +++ /dev/null @@ -1,21 +0,0 @@ -# Initial Logic for rod reeling chest_boat -# @s = player who fished -# at @s -# run from advancement gm4_reeling_rods:fishing/chest_boat - -advancement revoke @s only gm4_reeling_rods:fishing/chest_boat - -execute if entity @s[gamemode=adventure] run return fail - -function gm4_reeling_rods:store_player_pos - -tag @s add gm4_reeling_rods.player - -execute as @e[type=minecraft:fishing_bobber,distance=..33] \ - if function gm4_reeling_rods:fishing/owns_bobber \ - at @s positioned ~ ~-0.45 ~ \ - as @e[type=minecraft:chest_boat,distance=..0.00001,limit=1] \ - unless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \ - run function gm4_reeling_rods:fishing/chest_boat/action - -tag @s remove gm4_reeling_rods.player diff --git a/gm4_reeling_rods/beet.yaml b/gm4_reeling_rods/beet.yaml index 5801549d49..c813ac9db7 100644 --- a/gm4_reeling_rods/beet.yaml +++ b/gm4_reeling_rods/beet.yaml @@ -25,7 +25,7 @@ pipeline: meta: gm4: versioning: - schedule_loops: [] + schedule_loops: [tick] website: description: Reel in more than just fish with these rods! Yoink the chest from the chest boat and more! recommended: diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction new file mode 100644 index 0000000000..06111a4171 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction @@ -0,0 +1,4 @@ +# AAAAAAAAAAAAAAA +# @s = fished entity +# at @s +# run from player/find_fished_entity diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction new file mode 100644 index 0000000000..1e41074260 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction @@ -0,0 +1,20 @@ +# actually assigns entity tags +# with {AAAAAA} +# run from id/set + +$tag @s add $(bit_0) +$tag @s add $(bit_1) +$tag @s add $(bit_2) +$tag @s add $(bit_3) +$tag @s add $(bit_4) +$tag @s add $(bit_5) +$tag @s add $(bit_6) +$tag @s add $(bit_7) +$tag @s add $(bit_8) +$tag @s add $(bit_9) +$tag @s add $(bit_10) +$tag @s add $(bit_11) +$tag @s add $(bit_12) +$tag @s add $(bit_13) +$tag @s add $(bit_14) +$tag @s add $(bit_15) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction new file mode 100644 index 0000000000..6262e2e44d --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction @@ -0,0 +1,18 @@ +# Gets the next id +# with {bit} +# run from id/set and self + +# Data storage gm4_reeling_rods:id next + # bit_0..15 : "gm4_reeling_rods.id.<0..15>.[0|1]" + +# change bit 0 -> 1, return nothing else to do +$execute if data storage gm4_reeling_rods:id {next:{bit_$(bit):"gm4_reeling_rods.id.$(bit).0"}} \ + run return run data modify storage gm4_reeling_rods:id next.bit_$(bit) set value "gm4_reeling_rods.id.$(bit).1" + +# change bit 1 -> 0, then go on to next bit +# from here we know the bit is 1 so we don't need to check it +$data modify storage gm4_reeling_rods:id next.bit_$(bit) set value "gm4_reeling_rods.id.$(bit).0" +execute if score $bit gm4_reeling_rods.math matches 15 run return 1 +# next bit +execute store result storage gm4_reeling_rods:id bit int 1 run scoreboard players add $bit gm4_reeling_rods.math 1 +function gm4_reeling_rods:id/get_next with storage gm4_reeling_rods:id diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction new file mode 100644 index 0000000000..297cf5821d --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction @@ -0,0 +1,44 @@ +# function logic for setting an id on an entity +# @s = entity to be assigned id +# at @s +# run from tick + +execute store result storage gm4_reeling_rods:id bit int 1 run scoreboard players set $bit gm4_reeling_rods.math 0 +function gm4_reeling_rods:id/get_next with storage gm4_reeling_rods:id + +# clear tags +tag @s remove gm4_reeling_rods.id.0.0 +tag @s remove gm4_reeling_rods.id.1.0 +tag @s remove gm4_reeling_rods.id.2.0 +tag @s remove gm4_reeling_rods.id.3.0 +tag @s remove gm4_reeling_rods.id.4.0 +tag @s remove gm4_reeling_rods.id.5.0 +tag @s remove gm4_reeling_rods.id.6.0 +tag @s remove gm4_reeling_rods.id.7.0 +tag @s remove gm4_reeling_rods.id.8.0 +tag @s remove gm4_reeling_rods.id.9.0 +tag @s remove gm4_reeling_rods.id.10.0 +tag @s remove gm4_reeling_rods.id.11.0 +tag @s remove gm4_reeling_rods.id.12.0 +tag @s remove gm4_reeling_rods.id.13.0 +tag @s remove gm4_reeling_rods.id.14.0 +tag @s remove gm4_reeling_rods.id.15.0 +tag @s remove gm4_reeling_rods.id.0.1 +tag @s remove gm4_reeling_rods.id.1.1 +tag @s remove gm4_reeling_rods.id.2.1 +tag @s remove gm4_reeling_rods.id.3.1 +tag @s remove gm4_reeling_rods.id.4.1 +tag @s remove gm4_reeling_rods.id.5.1 +tag @s remove gm4_reeling_rods.id.6.1 +tag @s remove gm4_reeling_rods.id.7.1 +tag @s remove gm4_reeling_rods.id.8.1 +tag @s remove gm4_reeling_rods.id.9.1 +tag @s remove gm4_reeling_rods.id.10.1 +tag @s remove gm4_reeling_rods.id.11.1 +tag @s remove gm4_reeling_rods.id.12.1 +tag @s remove gm4_reeling_rods.id.13.1 +tag @s remove gm4_reeling_rods.id.14.1 +tag @s remove gm4_reeling_rods.id.15.1 + +# assign new id +function gm4_reeling_rods:id/assign with storage gm4_reeling_rods:id next diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction index 33486c7cab..d61da2adb7 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction @@ -6,8 +6,9 @@ scoreboard players set reeling_rods gm4_modules 1 scoreboard objectives add gm4_reeling_rods.math dummy "gm4_reeling math" scoreboard objectives add gm4_reeling_rods.lookup dummy "gm4_reeling lookup table" scoreboard objectives add gm4_reeling_rods.entities dummy "gm4_reeling entity specific" +scoreboard objectives add gm4_reeling_rods.bit_count dummy "gm4_reeling_rods bit count" # set_lookup_table generated in generate_files.py function gm4_reeling_rods:set_lookup_table -# no main function +schedule function gm4_reeling_rods:tick 1t diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction new file mode 100644 index 0000000000..6e112d43dc --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction @@ -0,0 +1,15 @@ +# Adds a bit value to the marker at players location and continues +# @s = marker at players feet +# at @s +# with {bit, bit_tag} +# run from gm4_reeling_rods:player/received_bit + +# add bit data +$data modify entity @s data.gm4_reeling_rods.id.bit_$(bit) set value "$(bit_tag)" + +# fail if not all bits +execute unless score @a[tag=gm4_reeling_rods.player,limit=1] gm4_reeling_rods.bit_count matches 16 run return fail + +# all bits received +scoreboard players set @a[tag=gm4_reeling_rods.player] gm4_reeling_rods.bit_count 0 +function gm4_reeling_rods:player/find_fished_entity with entity @s data.gm4_reeling_rods.id diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction new file mode 100644 index 0000000000..ece82d5e7c --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction @@ -0,0 +1,15 @@ +# Finds entity the player fished +# @s = marker at players feet +# at @s +# with {bit_0, bit_1, bit_2, bit_3, bit_4, bit_5, bit_6, bit_7, bit_8, bit_9, bit_10, bit_11, bit_12, bit_13, bit_14, bit_15} +# run from gm4_reeling_rods:player/received_bit + +$execute as @e[type=minecraft:fishing_bobber,distance=..33] \ + if function gm4_reeling_rods:player/owns_bobber \ + at @s as @e[distance=..42, limit=1, \ + tag=$(bit_0), tag=$(bit_1), tag=$(bit_2), tag=$(bit_3), tag=$(bit_4), tag=$(bit_5), tag=$(bit_6), tag=$(bit_7), \ + tag=$(bit_8), tag=$(bit_9), tag=$(bit_10), tag=$(bit_11), tag=$(bit_12), tag=$(bit_13), tag=$(bit_14), tag=$(bit_15)\ + ] at @s run function gm4_reeling_rods:fishing/select_type + +# kill marker after +kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/owns_bobber.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/owns_bobber.mcfunction similarity index 100% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/owns_bobber.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/player/owns_bobber.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction new file mode 100644 index 0000000000..bd00510d4f --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction @@ -0,0 +1,24 @@ +# Logic for when a player receives a bit +# @s = player who received a bit +# at @s +# with {bit, bit_tag} +# run from gm4_reeling_rods:player/bit_{bit}_{value} + +# Assumptions: + # bit and bit_tag are stored in storage gm4_reeling_rods:temp bit_data + # this score is set to 0 after all bits received +scoreboard players add @s gm4_reeling_rods.bit_count 1 + +# MARKER TAG = "gm4_reeling_rods.player_marker" +# if marker exists proceed to player/add_bit +execute as @e[type=minecraft:marker,distance=..0.001,tag=gm4_reeling_rods.player_marker,limit=1] run \ + return run function gm4_reeling_rods:player/add_bit with storage gm4_reeling_rods:temp bit_data + +# this only runs if there was no marker found, so summon one +$summon minecraft:marker ~ ~ ~ \ + {\ + Tags:["gm4_reeling_rods.player_marker","smithed.strict","smithed.entity"],\ + data:{gm4_reeling_rods:{id:{bit_$(bit):"$(bit_tag)"}}},\ + CustomName:'{"text":"gm4_reeling_rods.player_marker"}'\ + } +# as it was the first bit, we don't need to do anything else here diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction new file mode 100644 index 0000000000..90e31a0aeb --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction @@ -0,0 +1,4 @@ +# probably want to replace the type ignore tag with type supported tag thats auto generated +execute as @e[type=minecraft:fishing_bobber] at @s as @e[type=!#gm4_reeling_rods:ignore,distance=..42] at @s run function gm4_reeling_rods:id/set + +schedule function gm4_reeling_rods:tick 1t diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/predicate/holding_reeling_rod.json b/gm4_reeling_rods/data/gm4_reeling_rods/predicate/holding_reeling_rod.json new file mode 100644 index 0000000000..cd7a1fba2e --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/predicate/holding_reeling_rod.json @@ -0,0 +1,17 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "slots": { + "weapon.*": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "gm4_reeling_rods:reeling" + } + ] + } + } + } + } +} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json new file mode 100644 index 0000000000..29be513500 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json @@ -0,0 +1,38 @@ +{ + "values": [ + "minecraft:area_effect_cloud", + "minecraft:arrow", + "minecraft:block_display", + "minecraft:breeze_wind_charge", + "minecraft:command_block_minecart", + "minecraft:dragon_fireball", + "minecraft:egg", + "minecraft:ender_pearl", + "minecraft:evoker_fangs", + "minecraft:experience_bottle", + "minecraft:experience_orb", + "minecraft:eye_of_ender", + "minecraft:falling_block", + "minecraft:fireball", + "minecraft:firework_rocket", + "minecraft:fishing_bobber", + "minecraft:interaction", + "minecraft:item", + "minecraft:item_display", + "minecraft:lightning_bolt", + "minecraft:llama_spit", + "minecraft:marker", + "minecraft:ominous_item_spawner", + "minecraft:potion", + "minecraft:shulker_bullet", + "minecraft:small_fireball", + "minecraft:snowball", + "minecraft:spawner_minecart", + "minecraft:spectral_arrow", + "minecraft:text_display", + "minecraft:tnt", + "minecraft:trident", + "minecraft:wind_charge", + "minecraft:wither_skull" + ] +} diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 7546835459..fec644943b 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -1,69 +1,55 @@ from typing import List -from beet import Context, Advancement, Function, DataPack +from beet import Context, Advancement, Function, DataPack from beet.contrib.vanilla import Vanilla -from beet.core.utils import JsonDict import math -from copy import deepcopy class Entity: - def __init__(self, entity_type: str, can_be_baby: bool, vertical_displacement: str, needs_enchantment: bool, can_dismount: bool): + def __init__(self, entity_type: str, needs_enchantment: bool, can_dismount: bool): self.entity_type = entity_type - self.vertical_displacement = vertical_displacement self.needs_enchantment = needs_enchantment - self.can_be_baby = can_be_baby self.can_dismount = can_dismount def beet_default(ctx: Context): """generates the advancements, the subsequent functions for handling reeling, and set_lookup_table.mcfunction NOTE: Only generates action functions for minecarts and chest boats. Others will have to be defined manually""" create_lookup_file(ctx) + create_bit_advancements(ctx) vanilla = ctx.inject(Vanilla) vanilla.minecraft_version = '1.21.4' item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags entity_list: List[Entity] = [] - # Vertical displacement for mobs is -0.8 * the entities hitbox height. Entities with hitboxes that arent just width and height are different - entity_list.append(Entity("minecraft:leash_knot",False,"-0.4",False,False)) - entity_list.append(Entity("minecraft:allay",False,"-0.48",True,True)) - entity_list.append(Entity("minecraft:shulker",False,"-0.8",False,True)) - entity_list.append(Entity("minecraft:end_crystal",False,"-1.6",False,False)) - entity_list.append(Entity("minecraft:fox",True,"-0.56",True,True)) - entity_list.append(Entity("minecraft:pig",True,"-0.72",True,True)) - entity_list.append(Entity("minecraft:strider",True,"-1.36",True,True)) - entity_list.append(Entity("minecraft:snow_golem", False, "-1.52",True,True)) - entity_list.append(Entity("minecraft:wolf",True,"-0.68",True,True)) - entity_list.append(Entity("minecraft:donkey",True,"-1.2",True,True)) - entity_list.append(Entity("minecraft:llama",True,"-1.496",True,True)) - entity_list.append(Entity("minecraft:trader_llama",True,"-1.496",True,True)) + entity_list.append(Entity("minecraft:leash_knot",False,False)) + entity_list.append(Entity("minecraft:allay",True,True)) + entity_list.append(Entity("minecraft:shulker",False,True)) + entity_list.append(Entity("minecraft:end_crystal",False,False)) + entity_list.append(Entity("minecraft:fox",True,True)) + entity_list.append(Entity("minecraft:pig",True,True)) + entity_list.append(Entity("minecraft:strider",True,True)) + entity_list.append(Entity("minecraft:snow_golem",True,True)) + entity_list.append(Entity("minecraft:wolf",True,True)) + entity_list.append(Entity("minecraft:donkey",True,True)) + entity_list.append(Entity("minecraft:llama",True,True)) + entity_list.append(Entity("minecraft:trader_llama",True,True)) for chest_boat in item_tags["minecraft:chest_boats"].data['values']: - entity_list.append(Entity(chest_boat,False,"-0.45",True,False)) + entity_list.append(Entity(chest_boat,True,False)) + entity_list.append(Entity("minecraft:chest_boat",True,False)) for minecart in ["minecraft:chest_minecart","minecraft:furnace_minecart","minecraft:hopper_minecart","minecraft:tnt_minecart"]: - entity_list.append(Entity(minecart,False,"-0.56",True,False)) + entity_list.append(Entity(minecart,True,False)) for special_hitbox in ["minecraft:painting","minecraft:item_frame", "minecraft:glow_item_frame"]: - entity_list.append(Entity(special_hitbox,False,"-0.4",False,False)) + entity_list.append(Entity(special_hitbox,False,False)) for villager_height in ["minecraft:witch","minecraft:villager"]: - entity_list.append(Entity(villager_height,False,"-1.56",True,True)) + entity_list.append(Entity(villager_height,True,True)) for horse_height in ["minecraft:mule","minecraft:horse", "minecraft:zombie_horse", "minecraft:skeleton_horse"]: - entity_list.append(Entity(horse_height,True,"-1.28",True,True)) - create_files(ctx, entity_list) + entity_list.append(Entity(horse_height,True,True)) + create_select_type(ctx, entity_list) ''' My goal for right now is to go to the maximum scope and then have things cut back. Push this idea as far as I can, then reign it in. TODO: - Figure out how to account for different hitbox heights : - Different entity states. Like camel laying down, or player swimming - Multiple checks in the adv function - Slime Dismounting: Size Tag - Advancement checks? - Would need an advancement and function for each size. Maybe just do the normal vanilla 3 - Technically I could do all possible values..... But thats a lot of advancements - Could have 3 separate checks in the adv function. Same as camel and player plans - Attribute, minecraft:scale - Catch 22. Can't factor it in because we need to use it to select the entity. Can't use it before selecting. - ALL DISMOUNT Add more mobs. Hopefully all.... Piglin, Zomb Piglin, Piglin Brute, Bogged, @@ -79,6 +65,8 @@ def beet_default(ctx: Context): Steal hand items? Armor? Too busted? Multiple hitbox sizes..... + Pufferfish : + Puff up NOTE: --- NO --- Enderman: NOT FEASIBLE. Block state stored, not item data. @@ -112,205 +100,141 @@ def create_lookup_file(ctx: Context): strList.append(f"scoreboard players set ${key} gm4_reeling_rods.lookup {value}") ctx.data["gm4_reeling_rods:set_lookup_table"] = Function(strList) -# Function from: https://www.geeksforgeeks.org/recursively-merge-dictionaries-in-python/ -def recursive_merge(dict1:JsonDict, dict2:JsonDict): - for key, value in dict2.items(): - if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict): - # Recursively merge nested dictionaries - dict1[key] = recursive_merge(dict1[key], value) # type: ignore - else: - # Merge non-dictionary values - dict1[key] = value - return dict1 - -def create_adv_and_func(output_pack: DataPack, function_name: str, advancement_name: str,entity: Entity, run_on_entity: str, function_desc: str): - entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') - advancement_json : JsonDict = { - "criteria":{ - "fishing_rod_hooked":{ - "trigger":"minecraft:fishing_rod_hooked", - "conditions":{ - "entity":{ - "type" : entity.entity_type - } - } - } - }, - "rewards":{ - "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}" - } - } - if entity.needs_enchantment: - recursive_merge(advancement_json,{ - "criteria":{ - "fishing_rod_hooked":{ - "conditions":{ - "rod":{ - "predicates":{ - "minecraft:enchantments":[ - {"enchantments":"gm4_reeling_rods:reeling"} - ] +def create_bit_advancements(ctx: Context): + for bit in range(16): + for value in range(2): + # default adv + ctx.data[f"gm4_reeling_rods:fishing/bit_{bit}_{value}"] = Advancement({ + "criteria":{ + "fishing_rod_hooked":{ + "trigger":"minecraft:fishing_rod_hooked", + "conditions":{ + "entity":{ + "nbt": "{" + f"Tags:[\"gm4_reeling_rods.id.{bit}.{value}\"]" + "}" } } } + }, + "rewards":{ + "function": f"gm4_reeling_rods:player/bit_{bit}_{value}" } - } - }) - adv_func : List[str] = [ - function_desc, - "# @s = player who fished", + }) + ctx.data[f"gm4_reeling_rods:player/bit_{bit}_{value}"] = Function([ + f"# player adv logic for getting bit {bit} at value {value}", + f"# run from advancement fishing/bit_{bit}_{value}\n", + f"advancement revoke @s only gm4_reeling_rods:fishing/bit_{bit}_{value}\n", + "data modify storage gm4_reeling_rods:temp bit_data set value {bit_tag:\"" + f"gm4_reeling_rods.id.{bit}.{value}\", bit:\"{bit}\"" + "}", + "data remove storage gm4_reeling_rods:temp enchanted", + "execute if predicate gm4_reeling_rods:holding_reeling_rod run data modify storage gm4_reeling_rods:temp enchanted set value 1", + "function gm4_reeling_rods:store_player_pos", + "tag @s add gm4_reeling_rods.player", + "function gm4_reeling_rods:player/received_bit with storage gm4_reeling_rods:temp bit_data", + "tag @s remove gm4_reeling_rods.player" + ]) + +def finalSelectFunction(strings: List[List[str]], output_pack: DataPack): + finalFunction: List[str] = [ + "# GENERATED from generate_files.py", + "# Selects the right entity type or dismounts the entity", + "# @s = fished entity", "# at @s", - f"# run from advancement gm4_reeling_rods:fishing/{advancement_name}", - f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{advancement_name}", - "\nexecute if entity @s[gamemode=adventure] run return fail", - "\nfunction gm4_reeling_rods:store_player_pos", - "\ntag @s add gm4_reeling_rods.player\n", - "execute as @e[type=minecraft:fishing_bobber,distance=..33] \\", - "\tif function gm4_reeling_rods:fishing/owns_bobber \\", - f"\tat @s positioned ~ ~{entity.vertical_displacement} ~ \\", - f"\tas @e[type={entity.entity_type},distance=..0.00001,limit=1] \\", - "\tunless data entity @s {Invulnerable:1b} unless data entity @s Tags[] \\", - run_on_entity, - "\ntag @s remove gm4_reeling_rods.player" + "# run from player/find_fished_entity\n" ] - if entity.can_be_baby: - # change normal advancement to be for explicitly not baby - recursive_merge(advancement_json,{ - "criteria":{ - "fishing_rod_hooked":{ - "conditions":{ - "entity":{ - "flags":{ - "is_baby": False - } - } - } - } - } - }) - # new advancement for explicitly baby - advancement_json_baby:JsonDict = deepcopy(advancement_json) - recursive_merge(advancement_json_baby,{ - "criteria":{ - "fishing_rod_hooked":{ - "conditions":{ - "entity":{ - "flags":{ - "is_baby": True - } - } - } - } - }, - "rewards":{ - "function": f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}_baby" - } - }) - adv_func_baby = deepcopy(adv_func) - adv_func_baby[0] = f"{function_desc}_baby" - adv_func_baby[3] = f"# run from advancement gm4_reeling_rods:fishing/{advancement_name}_baby" - adv_func_baby[4] = f"\nadvancement revoke @s only gm4_reeling_rods:fishing/{advancement_name}_baby" - adv_func_baby[10] = f"\tat @s positioned ~ ~{str(float(entity.vertical_displacement) / 2)} ~ \\" - - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}_baby"] = Function(adv_func_baby) - output_pack[f"gm4_reeling_rods:fishing/{advancement_name}_baby"] = Advancement(advancement_json_baby) - - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/{function_name}"] = Function(adv_func) - output_pack[f"gm4_reeling_rods:fishing/{advancement_name}"] = Advancement(advancement_json) + for line in strings[0]: + finalFunction.append(line) + finalFunction.append("\n# dismounting logic\nexecute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount\n") + for line in strings[1]: + finalFunction.append(line) + output_pack["gm4_reeling_rods:fishing/select_type"] = Function(finalFunction) -def create_files(ctx: Context, entities: List[Entity]): +def create_select_type(ctx: Context, entities: List[Entity]): + selectFuncBase: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after dismount"]] + selectFuncSince61: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after dismount"]] + selectFuncBackport48: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after dismount"]] for entity in entities: since_61 = "pale_oak" in entity.entity_type - is_chest_boat = "chest_boat" in entity.entity_type or "chest_raft" in entity.entity_type - output_pack = ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["since_57"] if is_chest_boat else ctx.data + backport_48 = "minecraft:chest_boat" in entity.entity_type + since_57 = "_chest_boat" in entity.entity_type or "_chest_raft" in entity.entity_type entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') - create_adv_and_func( - output_pack, - "adv", - entity_type_no_prefix, - entity, - f"\trun function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", - f"# Initial Logic for rod reeling {entity_type_no_prefix}" + + # generate an action if its one of those types + generated_action( + ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["backport_48"] if backport_48 else ctx.data.overlays["since_57"] if since_57 else ctx.data, + entity ) - # Some generated action files - if "minecart" in entity.entity_type: # minecart types - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", - "function gm4_reeling_rods:separate", - "tp @s ~ -1000 ~", - "data remove storage gm4_reeling_rods:temp entity_data.UUID", - "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" - ]) - elif is_chest_boat: # chest boats / raft specific - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", - "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", - "tp @s ~ -1000 ~", - "data remove storage gm4_reeling_rods:temp entity_data.UUID", - f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" - ]) - elif "_horse" in entity.entity_type: # skele and zombie horses - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp item_data set value {}", - "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem", - "execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate", - "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" - ]) - elif "llama" in entity.entity_type: # llama and trader_llama - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data set value {}", - "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item", - "execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", - "execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate", - "execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b", - "item replace entity @s armor.body with minecraft:air" - ]) - if entity.can_dismount: # Dismounting logic - if entity.needs_enchantment: # Make a new advancement and adv func for dismounting, with no enchant needed - create_adv_and_func( - output_pack, - "adv_dismount", - f"{entity_type_no_prefix}_dismount", - Entity( - entity.entity_type, - entity.can_be_baby, - entity.vertical_displacement, - False, - entity.can_dismount - ), - f"\tif function gm4_reeling_rods:fishing/is_passenger run ride @s dismount", - f"# Logic for rod dismounting {entity_type_no_prefix}" - ) - else: # prepend dismounting logic to action function - actionFunc = output_pack.functions.get(f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action") - if actionFunc != None: # if existing action, prepend dismounting - actionFunc.prepend(Function([ - "# dismounting logic", - "execute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount\n\n" - ])) - else: # if no action function, make one thats just dismounting - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - "# dismounting logic", - "execute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount" - ]) + + order = 1 if entity.can_dismount else 0 # other action before or after dismounting logic + writeTo = [selectFuncSince61] if since_61 else [selectFuncBackport48] if backport_48 else [selectFuncBase, selectFuncSince61] if since_57 else [selectFuncBackport48, selectFuncBase, selectFuncSince61] + # since_61 gets since_61, since_57, else + # base gets since_57, else + # backport_48 gets backport_48, else + for write in writeTo: + command = f"execute if entity @s[type={entity.entity_type}] " + if entity.needs_enchantment: + command = command + "if data storage gm4_reeling_rods:temp enchanted " + command = command + f"run return run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action" + write[order].append(command) + finalSelectFunction(selectFuncBase, ctx.data) + finalSelectFunction(selectFuncSince61, ctx.data.overlays["since_61"]) + finalSelectFunction(selectFuncBackport48, ctx.data.overlays["backport_48"]) + + +def generated_action(output_pack: DataPack, entity: Entity): + entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') + if "minecart" in entity.entity_type: # minecart types + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", + "function gm4_reeling_rods:separate", + "tp @s ~ -1000 ~", + "data remove storage gm4_reeling_rods:temp entity_data.UUID", + "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + ]) + return + if "chest" in entity.entity_type: # chest boats / raft specific + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", + "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", + "tp @s ~ -1000 ~", + "data remove storage gm4_reeling_rods:temp entity_data.UUID", + f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + ]) + return + if "_horse" in entity.entity_type: # skele and zombie horses + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp item_data set value {}", + "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem", + "execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate", + "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" + ]) + return + if "llama" in entity.entity_type: # llama and trader_llama + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + f"# Action for reeled {entity_type_no_prefix}", + f"# @s = {entity_type_no_prefix}", + "# at @s", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", + "data modify storage gm4_reeling_rods:temp item_data set value {}", + "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item", + "execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", + "execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate", + "execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b", + "item replace entity @s armor.body with minecraft:air" + ]) + return From 1f0d012bfe9738aef63f52d8a41a9dac24743ed9 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 18 Mar 2025 17:22:44 +0900 Subject: [PATCH 26/37] minor text fixes --- .../function/fishing/select_type.mcfunction | 4 ---- .../gm4_reeling_rods/function/id/assign.mcfunction | 5 +++-- gm4_reeling_rods/generate_files.py | 11 ++++------- 3 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction deleted file mode 100644 index 06111a4171..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/select_type.mcfunction +++ /dev/null @@ -1,4 +0,0 @@ -# AAAAAAAAAAAAAAA -# @s = fished entity -# at @s -# run from player/find_fished_entity diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction index 1e41074260..de205c8ecc 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction @@ -1,5 +1,6 @@ -# actually assigns entity tags -# with {AAAAAA} +# assigns @s bit tags +# @s = entity to set tags +# with {bit_0, bit_1, bit_2, bit_3, bit_4, bit_5, bit_6, bit_7, bit_8, bit_9, bit_10, bit_11, bit_12, bit_13, bit_14, bit_15} # run from id/set $tag @s add $(bit_0) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index fec644943b..7fc32ac53b 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -1,5 +1,5 @@ from typing import List -from beet import Context, Advancement, Function, DataPack +from beet import Context, Advancement, Function, DataPack from beet.contrib.vanilla import Vanilla import math @@ -50,8 +50,6 @@ def beet_default(ctx: Context): Push this idea as far as I can, then reign it in. TODO: - ALL DISMOUNT - Add more mobs. Hopefully all.... Piglin, Zomb Piglin, Piglin Brute, Bogged, Skeleton, Stray, Husk, Drowned, Pillager, Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: @@ -64,17 +62,16 @@ def beet_default(ctx: Context): Player : Steal hand items? Armor? Too busted? - Multiple hitbox sizes..... - Pufferfish : - Puff up NOTE: --- NO --- Enderman: NOT FEASIBLE. Block state stored, not item data. Steal held block Could setblock with the block state, then get drop from breaking Could map block type to item, but that's far too much work and not maintainable - Pufferfish : Setting PuffState has issues. Also stupid hitbox changes size >:( + Pufferfish : Puff up a bit + ISSUE: Setting PuffState has issues. Set once is fine. Once it deflates a bit, setting again flashes and then reverts. + Probably an MC bug Sheep : Would need a map from Color Byte to string. Annoying. Maybe revisit Shear? Wandering Trader : Doesn't hold items. Maybe revist From ec84e1efe3e719b46f65bf5d10782e13b9d8a937 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 18 Mar 2025 18:40:56 +0900 Subject: [PATCH 27/37] more fixes from the id change --- gm4_reeling_rods/generate_files.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 7fc32ac53b..c51984f9a8 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -120,6 +120,7 @@ def create_bit_advancements(ctx: Context): f"# player adv logic for getting bit {bit} at value {value}", f"# run from advancement fishing/bit_{bit}_{value}\n", f"advancement revoke @s only gm4_reeling_rods:fishing/bit_{bit}_{value}\n", + "execute if entity @s[gamemode=adventure] run return fail\n", "data modify storage gm4_reeling_rods:temp bit_data set value {bit_tag:\"" + f"gm4_reeling_rods.id.{bit}.{value}\", bit:\"{bit}\"" + "}", "data remove storage gm4_reeling_rods:temp enchanted", "execute if predicate gm4_reeling_rods:holding_reeling_rod run data modify storage gm4_reeling_rods:temp enchanted set value 1", @@ -166,10 +167,10 @@ def create_select_type(ctx: Context, entities: List[Entity]): # base gets since_57, else # backport_48 gets backport_48, else for write in writeTo: - command = f"execute if entity @s[type={entity.entity_type}] " + command = f"execute if entity @s[type={entity.entity_type}] return " if entity.needs_enchantment: - command = command + "if data storage gm4_reeling_rods:temp enchanted " - command = command + f"run return run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action" + command = command + "run execute if data storage gm4_reeling_rods:temp enchanted " + command = command + f"run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action" write[order].append(command) finalSelectFunction(selectFuncBase, ctx.data) finalSelectFunction(selectFuncSince61, ctx.data.overlays["since_61"]) From 013328e43b6c1f8d9091b5a5a5a88d847990e003 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 18 Mar 2025 19:03:36 +0900 Subject: [PATCH 28/37] Fix wrong command syntax :( --- gm4_reeling_rods/generate_files.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index c51984f9a8..f098d68b19 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -10,8 +10,12 @@ def __init__(self, entity_type: str, needs_enchantment: bool, can_dismount: bool self.can_dismount = can_dismount def beet_default(ctx: Context): - """generates the advancements, the subsequent functions for handling reeling, and set_lookup_table.mcfunction - NOTE: Only generates action functions for minecarts and chest boats. Others will have to be defined manually""" + """generates files + - set_lookup_table + - advancements and reward functions for every bit state of an entity's tagged id + - fishing/select_type and overlays + - a few action functions for specified entity types + """ create_lookup_file(ctx) create_bit_advancements(ctx) @@ -167,7 +171,7 @@ def create_select_type(ctx: Context, entities: List[Entity]): # base gets since_57, else # backport_48 gets backport_48, else for write in writeTo: - command = f"execute if entity @s[type={entity.entity_type}] return " + command = f"execute if entity @s[type={entity.entity_type}] run return " if entity.needs_enchantment: command = command + "run execute if data storage gm4_reeling_rods:temp enchanted " command = command + f"run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action" From 419ede3633b709ea37501a3d86637989cf487cc1 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 18 Mar 2025 19:27:34 +0900 Subject: [PATCH 29/37] Re-Add smithed.entity ignore --- .../function/player/find_fished_entity.mcfunction | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction index ece82d5e7c..6cc4e590dd 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction @@ -9,7 +9,7 @@ $execute as @e[type=minecraft:fishing_bobber,distance=..33] \ at @s as @e[distance=..42, limit=1, \ tag=$(bit_0), tag=$(bit_1), tag=$(bit_2), tag=$(bit_3), tag=$(bit_4), tag=$(bit_5), tag=$(bit_6), tag=$(bit_7), \ tag=$(bit_8), tag=$(bit_9), tag=$(bit_10), tag=$(bit_11), tag=$(bit_12), tag=$(bit_13), tag=$(bit_14), tag=$(bit_15)\ - ] at @s run function gm4_reeling_rods:fishing/select_type + ] unless entity @s[tag=smithed.entity] at @s run function gm4_reeling_rods:fishing/select_type # kill marker after kill @s From 1546ed1accafb0f16ebf485037b72152c128acd0 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 18 Mar 2025 19:46:15 +0900 Subject: [PATCH 30/37] Change id tags to be removed when unneeded --- .../function/id/assign.mcfunction | 1 + .../function/id/clear.mcfunction | 37 +++++++++++++++++++ .../function/id/set.mcfunction | 35 +----------------- .../gm4_reeling_rods/function/tick.mcfunction | 4 +- 4 files changed, 42 insertions(+), 35 deletions(-) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/id/clear.mcfunction diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction index de205c8ecc..fc2f0c5a20 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/assign.mcfunction @@ -19,3 +19,4 @@ $tag @s add $(bit_12) $tag @s add $(bit_13) $tag @s add $(bit_14) $tag @s add $(bit_15) +tag @s add gm4_reeling_rods.id.tagged diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/clear.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/clear.mcfunction new file mode 100644 index 0000000000..50d3d6372c --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/clear.mcfunction @@ -0,0 +1,37 @@ +# clears all id tags off of @s +# @s = entity with tag gm4_reeling_rods.id.tagged +# run from tick + +tag @s remove gm4_reeling_rods.id.0.0 +tag @s remove gm4_reeling_rods.id.1.0 +tag @s remove gm4_reeling_rods.id.2.0 +tag @s remove gm4_reeling_rods.id.3.0 +tag @s remove gm4_reeling_rods.id.4.0 +tag @s remove gm4_reeling_rods.id.5.0 +tag @s remove gm4_reeling_rods.id.6.0 +tag @s remove gm4_reeling_rods.id.7.0 +tag @s remove gm4_reeling_rods.id.8.0 +tag @s remove gm4_reeling_rods.id.9.0 +tag @s remove gm4_reeling_rods.id.10.0 +tag @s remove gm4_reeling_rods.id.11.0 +tag @s remove gm4_reeling_rods.id.12.0 +tag @s remove gm4_reeling_rods.id.13.0 +tag @s remove gm4_reeling_rods.id.14.0 +tag @s remove gm4_reeling_rods.id.15.0 +tag @s remove gm4_reeling_rods.id.0.1 +tag @s remove gm4_reeling_rods.id.1.1 +tag @s remove gm4_reeling_rods.id.2.1 +tag @s remove gm4_reeling_rods.id.3.1 +tag @s remove gm4_reeling_rods.id.4.1 +tag @s remove gm4_reeling_rods.id.5.1 +tag @s remove gm4_reeling_rods.id.6.1 +tag @s remove gm4_reeling_rods.id.7.1 +tag @s remove gm4_reeling_rods.id.8.1 +tag @s remove gm4_reeling_rods.id.9.1 +tag @s remove gm4_reeling_rods.id.10.1 +tag @s remove gm4_reeling_rods.id.11.1 +tag @s remove gm4_reeling_rods.id.12.1 +tag @s remove gm4_reeling_rods.id.13.1 +tag @s remove gm4_reeling_rods.id.14.1 +tag @s remove gm4_reeling_rods.id.15.1 +tag @s remove gm4_reeling_rods.id.tagged diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction index 297cf5821d..44f018c33d 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/set.mcfunction @@ -3,42 +3,9 @@ # at @s # run from tick +# get new id execute store result storage gm4_reeling_rods:id bit int 1 run scoreboard players set $bit gm4_reeling_rods.math 0 function gm4_reeling_rods:id/get_next with storage gm4_reeling_rods:id -# clear tags -tag @s remove gm4_reeling_rods.id.0.0 -tag @s remove gm4_reeling_rods.id.1.0 -tag @s remove gm4_reeling_rods.id.2.0 -tag @s remove gm4_reeling_rods.id.3.0 -tag @s remove gm4_reeling_rods.id.4.0 -tag @s remove gm4_reeling_rods.id.5.0 -tag @s remove gm4_reeling_rods.id.6.0 -tag @s remove gm4_reeling_rods.id.7.0 -tag @s remove gm4_reeling_rods.id.8.0 -tag @s remove gm4_reeling_rods.id.9.0 -tag @s remove gm4_reeling_rods.id.10.0 -tag @s remove gm4_reeling_rods.id.11.0 -tag @s remove gm4_reeling_rods.id.12.0 -tag @s remove gm4_reeling_rods.id.13.0 -tag @s remove gm4_reeling_rods.id.14.0 -tag @s remove gm4_reeling_rods.id.15.0 -tag @s remove gm4_reeling_rods.id.0.1 -tag @s remove gm4_reeling_rods.id.1.1 -tag @s remove gm4_reeling_rods.id.2.1 -tag @s remove gm4_reeling_rods.id.3.1 -tag @s remove gm4_reeling_rods.id.4.1 -tag @s remove gm4_reeling_rods.id.5.1 -tag @s remove gm4_reeling_rods.id.6.1 -tag @s remove gm4_reeling_rods.id.7.1 -tag @s remove gm4_reeling_rods.id.8.1 -tag @s remove gm4_reeling_rods.id.9.1 -tag @s remove gm4_reeling_rods.id.10.1 -tag @s remove gm4_reeling_rods.id.11.1 -tag @s remove gm4_reeling_rods.id.12.1 -tag @s remove gm4_reeling_rods.id.13.1 -tag @s remove gm4_reeling_rods.id.14.1 -tag @s remove gm4_reeling_rods.id.15.1 - # assign new id function gm4_reeling_rods:id/assign with storage gm4_reeling_rods:id next diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction index 90e31a0aeb..7e3aa7b18c 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction @@ -1,4 +1,6 @@ -# probably want to replace the type ignore tag with type supported tag thats auto generated +# reset clear all id tags +execute as @e[tag=gm4_reeling_rods.id.tagged] run function gm4_reeling_rods:id/clear +# set new id tags if needed execute as @e[type=minecraft:fishing_bobber] at @s as @e[type=!#gm4_reeling_rods:ignore,distance=..42] at @s run function gm4_reeling_rods:id/set schedule function gm4_reeling_rods:tick 1t From c1a424952266a3f8ff6cda88112ac04c270837a6 Mon Sep 17 00:00:00 2001 From: runcows Date: Wed, 19 Mar 2025 15:15:46 +0900 Subject: [PATCH 31/37] Vehicle separation passenger transfer --- gm4_reeling_rods/generate_files.py | 37 +++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index f098d68b19..cb618cd2df 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -188,14 +188,25 @@ def generated_action(output_pack: DataPack, entity: Entity): f"# Action for reeled {entity_type_no_prefix}", f"# @s = {entity_type_no_prefix}", "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + f"# run from gm4_reeling_rods:fishing/select_type", "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", "function gm4_reeling_rods:separate", - "tp @s ~ -1000 ~", "data remove storage gm4_reeling_rods:temp entity_data.UUID", + "data remove storage gm4_reeling_rods:temp entity_data.Passengers", "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp", + f"execute on passengers run function gm4_reeling_rods:fishing/minecart_passenger_transfer", + "tp @s ~ -1000 ~", + ]) + # technically this is generated 4 times, but its just one file, so uh idk + output_pack[f"gm4_reeling_rods:fishing/minecart_passenger_transfer"] = Function([ + "# transfer old passenger to new minecart", + f"# @s = passengers of {entity_type_no_prefix}", + f"# at old {entity_type_no_prefix}", + "# run from gm4_reeling_rods:fishing/{all_minecart}/action", + "\nride @s dismount", + "ride @s mount @e[type=minecraft:minecart,distance=..0.00001,limit=1]" ]) return if "chest" in entity.entity_type: # chest boats / raft specific @@ -203,18 +214,28 @@ def generated_action(output_pack: DataPack, entity: Entity): f"# Action for reeled {entity_type_no_prefix}", f"# @s = {entity_type_no_prefix}", "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", + f"# run from gm4_reeling_rods:fishing/select_type", "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", - "tp @s ~ -1000 ~", "data remove storage gm4_reeling_rods:temp entity_data.UUID", + "data remove storage gm4_reeling_rods:temp entity_data.Passengers", f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp" + "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp", + f"execute on passengers run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/passenger_transfer", + "tp @s ~ -1000 ~" + ]) + output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/passenger_transfer"] = Function([ + "# transfer old passenger to new boat", + f"# @s = passengers of {entity_type_no_prefix}", + f"# at old {entity_type_no_prefix}", + f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", + "\nride @s dismount", + f"ride @s mount @e[type={entity.entity_type.replace('_chest','')},distance=..0.00001,limit=1]" ]) return if "_horse" in entity.entity_type: # skele and zombie horses - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + output_pack[f"gm4_reeling_rods:fishing/select_type"] = Function([ f"# Action for reeled {entity_type_no_prefix}", f"# @s = {entity_type_no_prefix}", "# at @s", @@ -226,7 +247,7 @@ def generated_action(output_pack: DataPack, entity: Entity): ]) return if "llama" in entity.entity_type: # llama and trader_llama - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ + output_pack[f"gm4_reeling_rods:fishing/select_type"] = Function([ f"# Action for reeled {entity_type_no_prefix}", f"# @s = {entity_type_no_prefix}", "# at @s", From f0f3f640022eed78dcd394eead2f9d7642602bff Mon Sep 17 00:00:00 2001 From: runcows Date: Thu, 20 Mar 2025 08:06:13 +0900 Subject: [PATCH 32/37] Add live catch to recommended --- gm4_reeling_rods/beet.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/gm4_reeling_rods/beet.yaml b/gm4_reeling_rods/beet.yaml index c813ac9db7..7911b62099 100644 --- a/gm4_reeling_rods/beet.yaml +++ b/gm4_reeling_rods/beet.yaml @@ -30,6 +30,7 @@ meta: description: Reel in more than just fish with these rods! Yoink the chest from the chest boat and more! recommended: - gm4_end_fishing + - gm4_live_catch notes: [] #modrinth: #project_id: From 68173db9fee182ebce4cadc0668c40b986398de2 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 24 Mar 2025 07:43:03 +0900 Subject: [PATCH 33/37] Misc comments because I need these file changes on my laptop to work on this while not at home --- .../player/find_fished_entity.mcfunction | 2 + gm4_reeling_rods/generate_files.py | 37 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction index 6cc4e590dd..934a0a8e95 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction @@ -4,6 +4,8 @@ # with {bit_0, bit_1, bit_2, bit_3, bit_4, bit_5, bit_6, bit_7, bit_8, bit_9, bit_10, bit_11, bit_12, bit_13, bit_14, bit_15} # run from gm4_reeling_rods:player/received_bit +# distance to fishing bobber is ..33 as 33 blocks is the farthest a fishing bobber can be from the caster +# distance from bobber to entity is ..42 as that represents a vanilla entity of 3.28 blocks tall at a max of 16x scale and then 80% of the height to find the fishing bobber $execute as @e[type=minecraft:fishing_bobber,distance=..33] \ if function gm4_reeling_rods:player/owns_bobber \ at @s as @e[distance=..42, limit=1, \ diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index cb618cd2df..8ccef1860a 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -54,33 +54,42 @@ def beet_default(ctx: Context): Push this idea as far as I can, then reign it in. TODO: - Piglin, Zomb Piglin, Piglin Brute, Bogged, - Skeleton, Stray, Husk, Drowned, Pillager, - Vindicator, Vex, Wither Skele, Zombie, Zomb Villager: - Steal held item. No threat? Armor instead? - Balance issues per mob - Evoker : - ???? - Illusioner : - ???? - Player : - Steal hand items? - Armor? Too busted? + Hand & Armor Yoinking + Should pull a random of those that exist + + Villagers can have armor dispensed onto them, but only the head slot will render + Illager types can have armor on them through commands, but it doesn't render. Ignore armor then + + Should return success of yoinking and have select_type return if yoinked item. I think, idk, i'll figure it out later + + + Bogged, Skeleton, Stray, Wither Skele, + Husk, Drowned, Zombie, Zomb Villager, + Piglin, Zomb Piglin, Piglin Brute, PLAYER: + Random item of hand or armor + Player might need special handling + Vindicator, Vex, Pillager, Illusioner, Allay: + Random of Hands + Allay will need to be revisited NOTE: --- NO --- - Enderman: NOT FEASIBLE. Block state stored, not item data. + Enderman : Steal held block + ISSUE: Block state stored, not item data. Could setblock with the block state, then get drop from breaking Could map block type to item, but that's far too much work and not maintainable Pufferfish : Puff up a bit ISSUE: Setting PuffState has issues. Set once is fine. Once it deflates a bit, setting again flashes and then reverts. Probably an MC bug - Sheep : Would need a map from Color Byte to string. Annoying. Maybe revisit + Sheep : Shear? + ISSUE: Would need a map from Color Byte to string. Annoying. Maybe revisit Wandering Trader : Doesn't hold items. Maybe revist Theft Trades? Steal llamas? + Evoker : + No Ideas ''' def create_lookup_file(ctx: Context): From f2014ee43965668d3fa010a86394a55237326423 Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 25 Mar 2025 09:47:04 +0900 Subject: [PATCH 34/37] misc beet changes --- gm4_reeling_rods/generate_files.py | 74 ++++++++++++++++++------------ 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 8ccef1860a..b155fc5b0c 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -23,31 +23,39 @@ def beet_default(ctx: Context): vanilla.minecraft_version = '1.21.4' item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags + # Here we define all entities with a specific action, those not listed will simply dismount if possible + needsEnchant_canDismount: List[str] = [ + "minecraft:allay", "minecraft:fox", "minecraft:pig", + "minecraft:strider", "minecraft:snow_golem", "minecraft:wolf", + "minecraft:donkey", "minecraft:llama", "minecraft:trader_llama", + "minecraft:witch","minecraft:villager", "minecraft:mule", + "minecraft:horse", "minecraft:zombie_horse", "minecraft:skeleton_horse" + ] + noEnchant_canDismount: List[str] = [ + "minecraft:shulker" + ] + needsEnchant_noDismount: List[str] = [ + "minecraft:chest_minecart", "minecraft:furnace_minecart", "minecraft:hopper_minecart", + "minecraft:tnt_minecart", "minecraft:chest_boat" + ] + for chest_boat in item_tags["minecraft:chest_boats"].data['values']: + needsEnchant_noDismount.append(chest_boat) + + noEnchant_noDismount: List[str] = [ + "minecraft:leash_knot", "minecraft:end_crystal", "minecraft:painting", + "minecraft:item_frame", "minecraft:glow_item_frame" + ] + entity_list: List[Entity] = [] - entity_list.append(Entity("minecraft:leash_knot",False,False)) - entity_list.append(Entity("minecraft:allay",True,True)) - entity_list.append(Entity("minecraft:shulker",False,True)) - entity_list.append(Entity("minecraft:end_crystal",False,False)) - entity_list.append(Entity("minecraft:fox",True,True)) - entity_list.append(Entity("minecraft:pig",True,True)) - entity_list.append(Entity("minecraft:strider",True,True)) - entity_list.append(Entity("minecraft:snow_golem",True,True)) - entity_list.append(Entity("minecraft:wolf",True,True)) - entity_list.append(Entity("minecraft:donkey",True,True)) - entity_list.append(Entity("minecraft:llama",True,True)) - entity_list.append(Entity("minecraft:trader_llama",True,True)) + for name in needsEnchant_canDismount: + entity_list.append(Entity(name,True,True)) + for name in noEnchant_canDismount: + entity_list.append(Entity(name,False,True)) + for name in needsEnchant_noDismount: + entity_list.append(Entity(name,True,False)) + for name in noEnchant_noDismount: + entity_list.append(Entity(name,False,False)) - for chest_boat in item_tags["minecraft:chest_boats"].data['values']: - entity_list.append(Entity(chest_boat,True,False)) - entity_list.append(Entity("minecraft:chest_boat",True,False)) - for minecart in ["minecraft:chest_minecart","minecraft:furnace_minecart","minecraft:hopper_minecart","minecraft:tnt_minecart"]: - entity_list.append(Entity(minecart,True,False)) - for special_hitbox in ["minecraft:painting","minecraft:item_frame", "minecraft:glow_item_frame"]: - entity_list.append(Entity(special_hitbox,False,False)) - for villager_height in ["minecraft:witch","minecraft:villager"]: - entity_list.append(Entity(villager_height,True,True)) - for horse_height in ["minecraft:mule","minecraft:horse", "minecraft:zombie_horse", "minecraft:skeleton_horse"]: - entity_list.append(Entity(horse_height,True,True)) create_select_type(ctx, entity_list) ''' My goal for right now is to go to the maximum scope and then have things cut back. @@ -65,12 +73,17 @@ def beet_default(ctx: Context): Bogged, Skeleton, Stray, Wither Skele, Husk, Drowned, Zombie, Zomb Villager, - Piglin, Zomb Piglin, Piglin Brute, PLAYER: + Piglin, Zomb Piglin, Piglin Brute, + Player, Villager, Allay, Witch: Random item of hand or armor Player might need special handling - Vindicator, Vex, Pillager, Illusioner, Allay: + Villager will need special handling due to consequences + Allay and Witch can't have armor, but that means it should just fail + They also need to be revisted and have the old code scrapped + Vindicator, Vex, Pillager, Illusioner: Random of Hands - Allay will need to be revisited + Can have armor with commands, but we don't want to yoink? + What if we did? Would it actually be a problem? NOTE: --- NO --- Enderman : @@ -151,17 +164,20 @@ def finalSelectFunction(strings: List[List[str]], output_pack: DataPack): "# at @s", "# run from player/find_fished_entity\n" ] + # entities that don't dismount for line in strings[0]: finalFunction.append(line) + # dismount logic finalFunction.append("\n# dismounting logic\nexecute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount\n") + # entities that do dismount, only runs if not dismounting for line in strings[1]: finalFunction.append(line) output_pack["gm4_reeling_rods:fishing/select_type"] = Function(finalFunction) def create_select_type(ctx: Context, entities: List[Entity]): - selectFuncBase: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after dismount"]] - selectFuncSince61: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after dismount"]] - selectFuncBackport48: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after dismount"]] + selectFuncBase: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] + selectFuncSince61: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] + selectFuncBackport48: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] for entity in entities: since_61 = "pale_oak" in entity.entity_type backport_48 = "minecraft:chest_boat" in entity.entity_type From 2c59b253eb6830ec362dce5e3b14ac2b10b4e236 Mon Sep 17 00:00:00 2001 From: runcows Date: Mon, 14 Apr 2025 15:47:53 +0900 Subject: [PATCH 35/37] py comment restructure --- gm4_reeling_rods/generate_files.py | 73 +++++++++++++++++++----------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index b155fc5b0c..d7a774e0f7 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -10,7 +10,7 @@ def __init__(self, entity_type: str, needs_enchantment: bool, can_dismount: bool self.can_dismount = can_dismount def beet_default(ctx: Context): - """generates files + """NOTE: generates files - set_lookup_table - advancements and reward functions for every bit state of an entity's tagged id - fishing/select_type and overlays @@ -61,31 +61,52 @@ def beet_default(ctx: Context): My goal for right now is to go to the maximum scope and then have things cut back. Push this idea as far as I can, then reign it in. - TODO: - Hand & Armor Yoinking + TODO: Hand & Armor Yoinking + Treat this as an action. No entity should have an action AND have item theft + Therefore, it should take place after a failed dismount + As a consequence of no overlap, we can just return run the theft function, no need to conditional it + Should pull a random of those that exist + Use the random check order that you have in your notebook + Yoinked item height. + Previously, in manually defined yoinking, the item height was hard coded per entity + This is not easily possible with a generic item yoink + What do we do? + We could pass a value with a macro, same principal as hard coding the value, not pretty but it works + Is it possible to get the entity hitbox height? If we can then we can math out the location + Use a type tag list for which entities can have items yoinked + + + NOTE: Specific Entities + Villagers: + -{ Special Exception }- + Currently are set up as a manually defined mainhand theft with reputational harm and trade sell out + Needs to implement theft for armor as well (armor can be dispensed onto them; only head renders) + Does the armor theft cause reputational damage to player? + Illagers: + [ Vindicator, Vex, Pillager, Illusioner, Evoker? ] + Can have armor on them through commands (not dispensed), but doesn't render + Probably shouldn't theft armor that can't be applied by players, that's the realm of datapackers + Should use a special hand item theft function + Fox, Allay, Witch: + Needs to have old code scrapped + Cannot have armor (<1.21.5) + Should use a special hand item theft funciton (for clarity) + Player: + Try to implement using the generic entity item yoinking + But if there's player specific problems, just split player off into a special case + All the rest: + [ Bogged, Skeleton, Stray, Wither Skeleton ] + [ Husk, Drowned, Zombie, Zombie Villager ] + [ Piglin, Piglin Brute, Zombie Piglin ] + + Steal armor or hand item just fine + Nugget idea? + Try to use drop chances for armor and if it fails drop armor material? + What about datapack armor?... I worry about compatibility - Villagers can have armor dispensed onto them, but only the head slot will render - Illager types can have armor on them through commands, but it doesn't render. Ignore armor then - - Should return success of yoinking and have select_type return if yoinked item. I think, idk, i'll figure it out later - - - Bogged, Skeleton, Stray, Wither Skele, - Husk, Drowned, Zombie, Zomb Villager, - Piglin, Zomb Piglin, Piglin Brute, - Player, Villager, Allay, Witch: - Random item of hand or armor - Player might need special handling - Villager will need special handling due to consequences - Allay and Witch can't have armor, but that means it should just fail - They also need to be revisted and have the old code scrapped - Vindicator, Vex, Pillager, Illusioner: - Random of Hands - Can have armor with commands, but we don't want to yoink? - What if we did? Would it actually be a problem? - NOTE: --- NO --- + \\ ---[ REJECTED FOR A REASON ]--- \\ Enderman : Steal held block ISSUE: Block state stored, not item data. @@ -94,15 +115,13 @@ def beet_default(ctx: Context): Pufferfish : Puff up a bit ISSUE: Setting PuffState has issues. Set once is fine. Once it deflates a bit, setting again flashes and then reverts. - Probably an MC bug + Probably an MC bug, should make an issue for it if it doesn't exist Sheep : Shear? - ISSUE: Would need a map from Color Byte to string. Annoying. Maybe revisit + ISSUE: Would need to map from Color Byte to string. Annoying. Maybe revisit Wandering Trader : Doesn't hold items. Maybe revist Theft Trades? Steal llamas? - Evoker : - No Ideas ''' def create_lookup_file(ctx: Context): From 1d2df27c2e523fe38ec3e74762534694e4a6cd6b Mon Sep 17 00:00:00 2001 From: runcows Date: Tue, 29 Apr 2025 11:27:50 +0900 Subject: [PATCH 36/37] Refactor in prep for generic item yoinking --- .../tags/entity_type/leashable.json | 41 ---- .../empty_container_entity.mcfunction | 2 +- .../action.mcfunction => allay.mcfunction} | 2 +- .../boat_passenger_transfer.mcfunction | 7 + .../function/fishing/chest_boat.mcfunction | 15 ++ .../action.mcfunction => donkey.mcfunction} | 2 +- .../fishing/end_crystal/action.mcfunction | 6 - .../{fox/action.mcfunction => fox.mcfunction} | 2 +- .../fishing/glow_item_frame/action.mcfunction | 10 - .../action.mcfunction => horse.mcfunction} | 2 +- .../function/fishing/is_passenger.mcfunction | 2 +- ...ction.mcfunction => item_frame.mcfunction} | 9 +- .../fishing/leash_knot/action.mcfunction | 2 +- .../function/fishing/llama.mcfunction | 12 ++ .../minecart_passenger_transfer.mcfunction | 7 + .../function/fishing/minecart_type.mcfunction | 15 ++ .../action.mcfunction => mule.mcfunction} | 2 +- .../action.mcfunction => painting.mcfunction} | 2 +- .../{pig/action.mcfunction => pig.mcfunction} | 2 +- .../fishing/shulker/action.mcfunction | 6 - ...ction.mcfunction => snow_golem.mcfunction} | 2 +- .../action.mcfunction => strider.mcfunction} | 2 +- .../function/fishing/undead_horse.mcfunction | 9 + .../fishing/villager/action.mcfunction | 2 +- .../action.mcfunction => witch.mcfunction} | 2 +- .../action.mcfunction => wolf.mcfunction} | 2 +- .../function/id/get_next.mcfunction | 1 - .../gm4_reeling_rods/function/init.mcfunction | 1 - .../function/player/add_bit.mcfunction | 2 +- .../player/find_fished_entity.mcfunction | 2 +- .../function/player/owns_bobber.mcfunction | 2 +- .../function/player/received_bit.mcfunction | 6 +- .../function/separate.mcfunction | 2 +- .../function/store_player_pos.mcfunction | 2 +- .../function/summon_entity.mcfunction | 2 +- .../gm4_reeling_rods/function/tick.mcfunction | 2 + .../tags/entity_type/leashable.json | 20 +- .../tags/entity_type/llamas.json | 6 + .../tags/entity_type/undead_horse.json | 6 + gm4_reeling_rods/entities.csv | 35 ++++ gm4_reeling_rods/generate_files.py | 186 +++--------------- .../tags/entity_type/leashable.json | 50 ----- 42 files changed, 175 insertions(+), 317 deletions(-) delete mode 100644 gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{allay/action.mcfunction => allay.mcfunction} (82%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{donkey/action.mcfunction => donkey.mcfunction} (91%) delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{fox/action.mcfunction => fox.mcfunction} (84%) delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{horse/action.mcfunction => horse.mcfunction} (92%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{item_frame/action.mcfunction => item_frame.mcfunction} (53%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{mule/action.mcfunction => mule.mcfunction} (92%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{painting/action.mcfunction => painting.mcfunction} (83%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{pig/action.mcfunction => pig.mcfunction} (86%) delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{snow_golem/action.mcfunction => snow_golem.mcfunction} (91%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{strider/action.mcfunction => strider.mcfunction} (85%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{witch/action.mcfunction => witch.mcfunction} (88%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/{wolf/action.mcfunction => wolf.mcfunction} (85%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/undead_horse.json create mode 100644 gm4_reeling_rods/entities.csv delete mode 100644 gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json diff --git a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json deleted file mode 100644 index 4a06361e37..0000000000 --- a/gm4_reeling_rods/backport_48/data/gm4_reeling_rods/tags/entity_type/leashable.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "values": [ - "minecraft:boat", - "minecraft:chest_boat", - "minecraft:skeleton_horse", - "minecraft:zombie_horse", - "minecraft:horse", - "minecraft:allay", - "minecraft:armadillo", - "minecraft:axolotl", - "minecraft:bee", - "minecraft:camel", - "minecraft:cat", - "minecraft:chicken", - "minecraft:cow", - "minecraft:dolphin", - "minecraft:donkey", - "minecraft:fox", - "minecraft:frog", - "minecraft:glow_squid", - "minecraft:goat", - "minecraft:hoglin", - "minecraft:iron_golem", - "minecraft:llama", - "minecraft:mooshroom", - "minecraft:mule", - "minecraft:ocelot", - "minecraft:parrot", - "minecraft:pig", - "minecraft:polar_bear", - "minecraft:rabbit", - "minecraft:sheep", - "minecraft:sniffer", - "minecraft:snow_golem", - "minecraft:squid", - "minecraft:strider", - "minecraft:trader_llama", - "minecraft:wolf", - "minecraft:zoglin" - ] -} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction index e4481ae697..305869ea56 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/empty_container_entity.mcfunction @@ -24,7 +24,7 @@ execute store result storage gm4_reeling_rods:temp item_data.Motion[1] double 0. scoreboard players operation $motionY gm4_reeling_rods.math += $randomY gm4_reeling_rods.math execute store result storage gm4_reeling_rods:temp item_data.Motion[2] double 0.006 run \ scoreboard players operation $motionZ gm4_reeling_rods.math += $randomZ gm4_reeling_rods.math -# scale 0.01 for same magnitude as main item +# scale 0.01 for same magnitude as main item, currently 0.006 to be slower # summon item with data function gm4_reeling_rods:summon_item with storage gm4_reeling_rods:temp diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction similarity index 82% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction index 568c691135..8a875c8a2d 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction @@ -1,7 +1,7 @@ # Action for reeled allay # @s = allay # at @s -# run from gm4_reeling_rods:fishing/allay/adv +# run from fishing/select_type data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] data modify entity @s HandItems[0] set value {} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction new file mode 100644 index 0000000000..4476d384ed --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction @@ -0,0 +1,7 @@ +# transfer old passenger to new boat +# @s = passengers of chest boat type +# at old chest boat type +# run from fishing/chest_boat + +ride @s dismount +ride @s mount @e[type=#gm4:boats,distance=..0.00001,limit=1] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction new file mode 100644 index 0000000000..dfae2182e5 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction @@ -0,0 +1,15 @@ +# Action for reeled chest_boat +# @s = chest_boat type +# at @s +# with {boat_type} +# run from fishing/select_type + +data modify storage gm4_reeling_rods:temp entity_data set from entity @s +data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} +execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate +data remove storage gm4_reeling_rods:temp entity_data.UUID +data remove storage gm4_reeling_rods:temp entity_data.Passengers +$data modify storage gm4_reeling_rods:temp entity_type set value "$(boat_type)" +function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp +execute on passengers run function gm4_reeling_rods:fishing/boat_passenger_transfer +tp @s ~ -1000 ~ diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey.mcfunction similarity index 91% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey.mcfunction index 176755d571..93684ebe6d 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey.mcfunction @@ -1,7 +1,7 @@ # Action for reeled donkey # @s = donkey # at @s -# run from fishing/donkey/adv and fishing/donkey/adv_baby +# run from fishing/selec_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s data modify storage gm4_reeling_rods:temp item_data set value {} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction deleted file mode 100644 index 36fa31748e..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/end_crystal/action.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# Action for reeled end crystal -# @s = end_crystal -# at @s -# run from gm4_reeling_rods:fishing/end_crystal/adv - -damage @s 1 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction similarity index 84% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction index bc805900d2..42053fa770 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction @@ -1,7 +1,7 @@ # Action for reeled fox # @s = fox # at @s -# run from fishing/fox/adv and fishing/fox/adv_baby +# run from fishing/select_type data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction deleted file mode 100644 index 62fa7d6ba5..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/glow_item_frame/action.mcfunction +++ /dev/null @@ -1,10 +0,0 @@ -# Action for reeled glow item frame -# @s = glow item frame -# at @s -# run from gm4_reeling_rods:fishing/glow_item_frame/adv - -data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:glow_item_frame",count:1} -data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Item -execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate -execute unless data entity @s Item run return run kill @s -data remove entity @s Item diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse.mcfunction similarity index 92% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse.mcfunction index fb8a1b611e..826b39c042 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse.mcfunction @@ -1,7 +1,7 @@ # Action for reeled horse # @s = horse # at @s -# run from fishing/horse/adv and fishing/horse/adv_baby +# run from fishing/select_type data modify storage gm4_reeling_rods:temp item_data set value {} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction index 5a73a238b8..9a3b0fae04 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction @@ -1,6 +1,6 @@ # checks if @s is a passenger # @s = entity to check # at @s -# run from fishing/{entity_type}/action +# run from fishing/select_type return run execute on vehicle if entity @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame.mcfunction similarity index 53% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame.mcfunction index 65e1b5e8ce..b98bb43eb9 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame.mcfunction @@ -1,9 +1,10 @@ -# Action for reeled item frame -# @s = item frame +# Action for reeled item frame or glow item frame +# @s = item frame or glow item frame # at @s -# run from gm4_reeling_rods:fishing/item_frame/adv +# with {type} +# run from fishing/select_type -data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:item_frame",count:1} +$data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"$(type)",count:1} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Item execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate execute unless data entity @s Item run return run kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction index f9e8e13369..0475cd7220 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction @@ -1,7 +1,7 @@ # Action for reeled leash knot # @s = leash knot # at @s -# run from gm4_reeling_rods:fishing/leash_knot/adv +# run from fishing/select_type tag @s add gm4_reeling_rods.leash_knot diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction new file mode 100644 index 0000000000..0626c94267 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction @@ -0,0 +1,12 @@ +# Action for reeled llama or trader llama +# @s = llama or trader llama +# at @s +# run from fishing/select_type + +data modify storage gm4_reeling_rods:temp entity_data set from entity @s +data modify storage gm4_reeling_rods:temp item_data set value {} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item +execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} +execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate +execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b +item replace entity @s armor.body with minecraft:air diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction new file mode 100644 index 0000000000..59d6f0e761 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction @@ -0,0 +1,7 @@ +# transfer old passenger to new minecart +# @s = passengers of *_minecart +# at old *_minecart +# run from fishing/minecart_type + +ride @s dismount +ride @s mount @e[type=minecraft:minecart,distance=..0.00001,limit=1] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction new file mode 100644 index 0000000000..7915d21363 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction @@ -0,0 +1,15 @@ +# Action for reeled *_minecart +# @s = *_minecart +# at @s +# with {block} +# run from fishing/select_type + +data modify storage gm4_reeling_rods:temp entity_data set from entity @s +$data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"$(block)",count:1} +function gm4_reeling_rods:separate +data remove storage gm4_reeling_rods:temp entity_data.UUID +data remove storage gm4_reeling_rods:temp entity_data.Passengers +data modify storage gm4_reeling_rods:temp entity_type set value "minecraft:minecart" +function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp +execute on passengers run function gm4_reeling_rods:fishing/minecart_passenger_transfer +tp @s ~ -1000 ~ diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule.mcfunction similarity index 92% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule.mcfunction index b1b2a5ca7d..e8a3275ede 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule.mcfunction @@ -1,7 +1,7 @@ # Action for reeled mule # @s = mule # at @s -# run from fishing/mule/adv and fishing/mule/adv_baby +# run from fishing/select_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s data modify storage gm4_reeling_rods:temp item_data set value {} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting.mcfunction similarity index 83% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting.mcfunction index 266b7dbfc6..0c8b078ca0 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting.mcfunction @@ -1,7 +1,7 @@ # Action for reeled painting # @s = painting # at @s -# run from gm4_reeling_rods:fishing/painting/adv +# run from fishing/select_type data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:painting",count:1} execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig.mcfunction similarity index 86% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig.mcfunction index a36a8d7ff7..6e41e186ae 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig.mcfunction @@ -1,7 +1,7 @@ # Action for reeled pig # @s = pig # at @s -# run from fishing/pig/adv and fishing/pig/adv_baby +# run from fishing/select_type # fail if no saddle execute unless data entity @s {Saddle:1b} run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction deleted file mode 100644 index 2d7dd0e62d..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/shulker/action.mcfunction +++ /dev/null @@ -1,6 +0,0 @@ -# Action for reeled shulker -# @s = shulker -# at @s -# run from gm4_reeling_rods:fishing/shulker/adv - -execute facing entity @a[tag=gm4_reeling_rods.player,distance=..33,limit=1] eyes run tp @s ^ ^ ^1 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem.mcfunction similarity index 91% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem.mcfunction index 5e0dae8a66..6debadee18 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem.mcfunction @@ -1,7 +1,7 @@ # Action for reeled snow_golem # @s = snow_golem # at @s -# run from fishing/snow_golem/adv +# run from fishing/select_type # fail if no Pumpkin execute unless data entity @s {Pumpkin:1b} run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider.mcfunction similarity index 85% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider.mcfunction index ed8303638c..171ca62461 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider.mcfunction @@ -1,7 +1,7 @@ # Action for reeled strider # @s = strider # at @s -# run from fishing/strider/adv and fishing/strider/adv_baby +# run from fishing/select_type # fail if no saddle execute unless data entity @s {Saddle:1b} run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction new file mode 100644 index 0000000000..1940948293 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction @@ -0,0 +1,9 @@ +# Action for reeled zombie horse or skele horse +# @s = zombie horse or skele horse +# at @s +# run from fishing/select_type + +data modify storage gm4_reeling_rods:temp item_data set value {} +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem +execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate +execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:"minecraft:saddle"}}} run item replace entity @s horse.saddle with minecraft:air diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction index 171d119d14..97726700d2 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction @@ -1,7 +1,7 @@ # Action for reeled villager # @s = villager # at @s -# run from gm4_reeling_rods:fishing/villager/adv +# run from fishing/select_type # fail if baby execute store result score $misc gm4_reeling_rods.math run data get entity @s Age diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction similarity index 88% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction index 89d4c89000..fc9b7f4990 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction @@ -1,7 +1,7 @@ # Action for reeled witch # @s = witch # at @s -# run from gm4_reeling_rods:fishing/witch/adv +# run from fishing/select_type # return if no item in mainhand execute unless data entity @s HandItems[0].id run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf.mcfunction similarity index 85% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf.mcfunction index caf7fbff98..7717084422 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf/action.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf.mcfunction @@ -1,7 +1,7 @@ # Action for reeled wolf # @s = wolf # at @s -# run from fishing/wolf/adv and fishing/wolf/adv_baby +# run from fishing/select_type # fail if no Owner execute unless data entity @s Owner run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction index 6262e2e44d..b791d423d6 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/id/get_next.mcfunction @@ -10,7 +10,6 @@ $execute if data storage gm4_reeling_rods:id {next:{bit_$(bit):"gm4_reeling_rods run return run data modify storage gm4_reeling_rods:id next.bit_$(bit) set value "gm4_reeling_rods.id.$(bit).1" # change bit 1 -> 0, then go on to next bit -# from here we know the bit is 1 so we don't need to check it $data modify storage gm4_reeling_rods:id next.bit_$(bit) set value "gm4_reeling_rods.id.$(bit).0" execute if score $bit gm4_reeling_rods.math matches 15 run return 1 # next bit diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction index d61da2adb7..44051458d7 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/init.mcfunction @@ -2,7 +2,6 @@ execute unless score reeling_rods gm4_modules matches 1 run data modify storage execute unless score reeling_rods gm4_earliest_version < reeling_rods gm4_modules run scoreboard players operation reeling_rods gm4_earliest_version = reeling_rods gm4_modules scoreboard players set reeling_rods gm4_modules 1 - scoreboard objectives add gm4_reeling_rods.math dummy "gm4_reeling math" scoreboard objectives add gm4_reeling_rods.lookup dummy "gm4_reeling lookup table" scoreboard objectives add gm4_reeling_rods.entities dummy "gm4_reeling entity specific" diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction index 6e112d43dc..5144711455 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/add_bit.mcfunction @@ -2,7 +2,7 @@ # @s = marker at players feet # at @s # with {bit, bit_tag} -# run from gm4_reeling_rods:player/received_bit +# run from player/received_bit # add bit data $data modify entity @s data.gm4_reeling_rods.id.bit_$(bit) set value "$(bit_tag)" diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction index 934a0a8e95..569e56ad15 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction @@ -2,7 +2,7 @@ # @s = marker at players feet # at @s # with {bit_0, bit_1, bit_2, bit_3, bit_4, bit_5, bit_6, bit_7, bit_8, bit_9, bit_10, bit_11, bit_12, bit_13, bit_14, bit_15} -# run from gm4_reeling_rods:player/received_bit +# run from player/add_bit # distance to fishing bobber is ..33 as 33 blocks is the farthest a fishing bobber can be from the caster # distance from bobber to entity is ..42 as that represents a vanilla entity of 3.28 blocks tall at a max of 16x scale and then 80% of the height to find the fishing bobber diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/owns_bobber.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/owns_bobber.mcfunction index 9e97065849..4e2a119250 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/owns_bobber.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/owns_bobber.mcfunction @@ -1,6 +1,6 @@ # Checks if a fishing bobber belongs to the targeted owner # @s = a fishing bobber # at owner -# run from fishing/{entity}/adv +# run from player/find_fished_entity return run execute on origin if entity @s[tag=gm4_reeling_rods.player] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction index bd00510d4f..283f5984d8 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/received_bit.mcfunction @@ -2,23 +2,21 @@ # @s = player who received a bit # at @s # with {bit, bit_tag} -# run from gm4_reeling_rods:player/bit_{bit}_{value} +# run from player/bit_{bit}_{value} # Assumptions: # bit and bit_tag are stored in storage gm4_reeling_rods:temp bit_data # this score is set to 0 after all bits received scoreboard players add @s gm4_reeling_rods.bit_count 1 -# MARKER TAG = "gm4_reeling_rods.player_marker" # if marker exists proceed to player/add_bit execute as @e[type=minecraft:marker,distance=..0.001,tag=gm4_reeling_rods.player_marker,limit=1] run \ return run function gm4_reeling_rods:player/add_bit with storage gm4_reeling_rods:temp bit_data -# this only runs if there was no marker found, so summon one +# first bit, no marker found, summon one $summon minecraft:marker ~ ~ ~ \ {\ Tags:["gm4_reeling_rods.player_marker","smithed.strict","smithed.entity"],\ data:{gm4_reeling_rods:{id:{bit_$(bit):"$(bit_tag)"}}},\ CustomName:'{"text":"gm4_reeling_rods.player_marker"}'\ } -# as it was the first bit, we don't need to do anything else here diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction index 801cf2ad0d..59584b0958 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction @@ -1,7 +1,7 @@ # Separates an entity that needs it # @s = entity to be separated # at @s -# run from fishing/{entity}/action +# run from fishing/{entity} (/action) function gm4_reeling_rods:get_motion_to_player function gm4_reeling_rods:summon_item with storage gm4_reeling_rods:temp diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction index cdbac992cb..56e5268f34 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/store_player_pos.mcfunction @@ -1,7 +1,7 @@ # stores players postion # @s = Player # at @s -# run from fishing/{entity}/adv +# run from player/bit_{bit}_{value} data modify storage gm4_reeling_rods:temp player_data.Pos set from entity @s Pos execute store result score $motionX gm4_reeling_rods.math run data get storage gm4_reeling_rods:temp player_data.Pos[0] 1 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction index d53b8adb37..ea49ad2fd6 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction @@ -1,5 +1,5 @@ # Summons a generic entity with data # with {entity_data} -# run from fishing/{entity}/action +# run from fishing/{entity} $summon $(entity_type) ~ ~ ~ $(entity_data) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction index 7e3aa7b18c..950803fd48 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/tick.mcfunction @@ -1,6 +1,8 @@ # reset clear all id tags execute as @e[tag=gm4_reeling_rods.id.tagged] run function gm4_reeling_rods:id/clear + # set new id tags if needed +# distance from bobber to entity is ..42 as that represents a vanilla entity of 3.28 blocks tall at a max of 16x scale and then 80% of the height to find the fishing bobber execute as @e[type=minecraft:fishing_bobber] at @s as @e[type=!#gm4_reeling_rods:ignore,distance=..42] at @s run function gm4_reeling_rods:id/set schedule function gm4_reeling_rods:tick 1t diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json index d4a2d4449f..2649426f8b 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/leashable.json @@ -1,18 +1,9 @@ { "values": [ - "#minecraft:boat", - "minecraft:acacia_chest_boat", - "minecraft:oak_chest_boat", - "minecraft:cherry_chest_boat", - "minecraft:birch_chest_boat", - "minecraft:bamboo_chest_raft", - "minecraft:jungle_chest_boat", - "minecraft:spruce_chest_boat", - "minecraft:dark_oak_chest_boat", - "minecraft:mangrove_chest_boat", - "minecraft:skeleton_horse", - "minecraft:zombie_horse", - "minecraft:horse", + "#gm4:boats", + "#gm4:chest_boats", + "#gm4_reeling_rods:llamas", + "#gm4_reeling_rods:undead_horse", "minecraft:allay", "minecraft:armadillo", "minecraft:axolotl", @@ -28,8 +19,8 @@ "minecraft:glow_squid", "minecraft:goat", "minecraft:hoglin", + "minecraft:horse", "minecraft:iron_golem", - "minecraft:llama", "minecraft:mooshroom", "minecraft:mule", "minecraft:ocelot", @@ -42,7 +33,6 @@ "minecraft:snow_golem", "minecraft:squid", "minecraft:strider", - "minecraft:trader_llama", "minecraft:wolf", "minecraft:zoglin" ] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json new file mode 100644 index 0000000000..6e94bfce7d --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:llama", + "minecraft:trader_llama" + ] +} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/undead_horse.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/undead_horse.json new file mode 100644 index 0000000000..ab5a10544b --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/undead_horse.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:skeleton_horse", + "minecraft:zombie_horse" + ] +} diff --git a/gm4_reeling_rods/entities.csv b/gm4_reeling_rods/entities.csv new file mode 100644 index 0000000000..0419a43f9b --- /dev/null +++ b/gm4_reeling_rods/entities.csv @@ -0,0 +1,35 @@ +id,needs_enchantment,can_dismount,command +minecraft:allay,TRUE,TRUE,"run function gm4_reeling_rods:fishing/allay" +minecraft:fox,TRUE,TRUE,"run function gm4_reeling_rods:fishing/fox" +minecraft:pig,TRUE,TRUE,"run function gm4_reeling_rods:fishing/pig" +minecraft:strider,TRUE,TRUE,"run function gm4_reeling_rods:fishing/strider" +minecraft:snow_golem,TRUE,TRUE,"run function gm4_reeling_rods:fishing/snow_golem" +minecraft:wolf,TRUE,TRUE,"run function gm4_reeling_rods:fishing/wolf" +minecraft:donkey,TRUE,TRUE,"run function gm4_reeling_rods:fishing/donkey" +#gm4_reeling_rods:llamas,TRUE,TRUE,"run function gm4_reeling_rods:fishing/llama" +minecraft:witch,TRUE,TRUE,"run function gm4_reeling_rods:fishing/witch" +minecraft:villager,TRUE,TRUE,"run function gm4_reeling_rods:fishing/villager/action" +minecraft:mule,TRUE,TRUE,"run function gm4_reeling_rods:fishing/mule" +minecraft:horse,TRUE,TRUE,"run function gm4_reeling_rods:fishing/horse" +#gm4_reeling_rods:undead_horse,TRUE,TRUE,"run function gm4_reeling_rods:fishing/undead_horse" +minecraft:shulker,FALSE,TRUE,"run execute facing entity @a[tag=gm4_reeling_rods.player,distance=..33,limit=1] eyes run tp @s ^ ^ ^1" +minecraft:chest_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:chest'}" +minecraft:furnace_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:furnace'}" +minecraft:hopper_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:hopper'}" +minecraft:tnt_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:tnt'}" +minecraft:chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:boat'}" +minecraft:acacia_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:acacia_boat'}" +minecraft:bamboo_chest_raft,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:bamboo_raft'}" +minecraft:birch_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:birch_boat'}" +minecraft:cherry_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:cherry_boat'}" +minecraft:dark_oak_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:dark_oak_boat'}" +minecraft:jungle_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:jungle_boat'}" +minecraft:mangrove_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:mangrove_boat'}" +minecraft:oak_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:oak_boat'}" +minecraft:pale_oak_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:pale_oak_boat'}" +minecraft:spruce_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:spruce_boat'}" +minecraft:leash_knot,FALSE,FALSE,"run function gm4_reeling_rods:fishing/leash_knot/action" +minecraft:end_crystal,FALSE,FALSE,"run damage @s 1" +minecraft:painting,FALSE,FALSE,"run function gm4_reeling_rods:fishing/painting" +minecraft:item_frame,FALSE,FALSE,"run function gm4_reeling_rods:fishing/item_frame {type:'minecraft:item_frame'}" +minecraft:glow_item_frame,FALSE,FALSE,"run function gm4_reeling_rods:fishing/item_frame {type:'minecraft:glow_item_frame'}" diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index d7a774e0f7..873741d939 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -1,60 +1,19 @@ from typing import List from beet import Context, Advancement, Function, DataPack -from beet.contrib.vanilla import Vanilla import math - -class Entity: - def __init__(self, entity_type: str, needs_enchantment: bool, can_dismount: bool): - self.entity_type = entity_type - self.needs_enchantment = needs_enchantment - self.can_dismount = can_dismount +from pathlib import Path +from gm4.utils import CSV def beet_default(ctx: Context): """NOTE: generates files - set_lookup_table - advancements and reward functions for every bit state of an entity's tagged id - - fishing/select_type and overlays - - a few action functions for specified entity types + - fishing/select_type and overlays of it """ create_lookup_file(ctx) create_bit_advancements(ctx) - vanilla = ctx.inject(Vanilla) - vanilla.minecraft_version = '1.21.4' - item_tags = vanilla.mount("data/minecraft/tags/item").data.item_tags - - # Here we define all entities with a specific action, those not listed will simply dismount if possible - needsEnchant_canDismount: List[str] = [ - "minecraft:allay", "minecraft:fox", "minecraft:pig", - "minecraft:strider", "minecraft:snow_golem", "minecraft:wolf", - "minecraft:donkey", "minecraft:llama", "minecraft:trader_llama", - "minecraft:witch","minecraft:villager", "minecraft:mule", - "minecraft:horse", "minecraft:zombie_horse", "minecraft:skeleton_horse" - ] - noEnchant_canDismount: List[str] = [ - "minecraft:shulker" - ] - needsEnchant_noDismount: List[str] = [ - "minecraft:chest_minecart", "minecraft:furnace_minecart", "minecraft:hopper_minecart", - "minecraft:tnt_minecart", "minecraft:chest_boat" - ] - for chest_boat in item_tags["minecraft:chest_boats"].data['values']: - needsEnchant_noDismount.append(chest_boat) - - noEnchant_noDismount: List[str] = [ - "minecraft:leash_knot", "minecraft:end_crystal", "minecraft:painting", - "minecraft:item_frame", "minecraft:glow_item_frame" - ] - - entity_list: List[Entity] = [] - for name in needsEnchant_canDismount: - entity_list.append(Entity(name,True,True)) - for name in noEnchant_canDismount: - entity_list.append(Entity(name,False,True)) - for name in needsEnchant_noDismount: - entity_list.append(Entity(name,True,False)) - for name in noEnchant_noDismount: - entity_list.append(Entity(name,False,False)) + entity_list = CSV.from_file(Path('gm4_reeling_rods','entities.csv')) create_select_type(ctx, entity_list) ''' @@ -175,6 +134,30 @@ def create_bit_advancements(ctx: Context): "tag @s remove gm4_reeling_rods.player" ]) +def create_select_type(ctx: Context, entities: CSV): + selectFuncBase: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] + selectFuncSince61: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] + selectFuncBackport48: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] + for entity in entities: + since_61 = "pale_oak" in entity['id'] + backport_48 = "minecraft:chest_boat" in entity['id'] + since_57 = "_chest_boat" in entity['id'] or "_chest_raft" in entity['id'] + + order = 1 if entity['can_dismount'] == "TRUE" else 0 # other action before or after dismounting logic + writeTo = [selectFuncSince61] if since_61 else [selectFuncBackport48] if backport_48 else [selectFuncBase, selectFuncSince61] if since_57 else [selectFuncBackport48, selectFuncBase, selectFuncSince61] + # since_61 gets since_61, since_57, else + # base gets since_57, else + # backport_48 gets backport_48, else + for write in writeTo: + command = f"execute if entity @s[type={entity['id']}] run return " + if entity['needs_enchantment'] == "TRUE": + command = command + "run execute if data storage gm4_reeling_rods:temp enchanted " + command = command + entity['command'] + write[order].append(command) + finalSelectFunction(selectFuncBase, ctx.data.overlays["since_57"]) # should just be ctx.data when moved to 1.21.5, these overlays are gonna be a nightmare to update.,., Figure it out later + finalSelectFunction(selectFuncSince61, ctx.data.overlays["since_61"]) + finalSelectFunction(selectFuncBackport48, ctx.data.overlays["backport_48"]) + def finalSelectFunction(strings: List[List[str]], output_pack: DataPack): finalFunction: List[str] = [ "# GENERATED from generate_files.py", @@ -192,116 +175,3 @@ def finalSelectFunction(strings: List[List[str]], output_pack: DataPack): for line in strings[1]: finalFunction.append(line) output_pack["gm4_reeling_rods:fishing/select_type"] = Function(finalFunction) - -def create_select_type(ctx: Context, entities: List[Entity]): - selectFuncBase: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] - selectFuncSince61: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] - selectFuncBackport48: List[List[str]] = [["# non-dismount entities"],["# dismountable entities, action after failed dismount"]] - for entity in entities: - since_61 = "pale_oak" in entity.entity_type - backport_48 = "minecraft:chest_boat" in entity.entity_type - since_57 = "_chest_boat" in entity.entity_type or "_chest_raft" in entity.entity_type - entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') - - # generate an action if its one of those types - generated_action( - ctx.data.overlays["since_61"] if since_61 else ctx.data.overlays["backport_48"] if backport_48 else ctx.data.overlays["since_57"] if since_57 else ctx.data, - entity - ) - - order = 1 if entity.can_dismount else 0 # other action before or after dismounting logic - writeTo = [selectFuncSince61] if since_61 else [selectFuncBackport48] if backport_48 else [selectFuncBase, selectFuncSince61] if since_57 else [selectFuncBackport48, selectFuncBase, selectFuncSince61] - # since_61 gets since_61, since_57, else - # base gets since_57, else - # backport_48 gets backport_48, else - for write in writeTo: - command = f"execute if entity @s[type={entity.entity_type}] run return " - if entity.needs_enchantment: - command = command + "run execute if data storage gm4_reeling_rods:temp enchanted " - command = command + f"run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/action" - write[order].append(command) - finalSelectFunction(selectFuncBase, ctx.data) - finalSelectFunction(selectFuncSince61, ctx.data.overlays["since_61"]) - finalSelectFunction(selectFuncBackport48, ctx.data.overlays["backport_48"]) - - -def generated_action(output_pack: DataPack, entity: Entity): - entity_type_no_prefix = entity.entity_type.removeprefix('minecraft:') - if "minecart" in entity.entity_type: # minecart types - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/select_type", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"" + entity.entity_type.removesuffix('_minecart') + "\",count:1}", - "function gm4_reeling_rods:separate", - "data remove storage gm4_reeling_rods:temp entity_data.UUID", - "data remove storage gm4_reeling_rods:temp entity_data.Passengers", - "data modify storage gm4_reeling_rods:temp entity_type set value \"minecraft:minecart\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp", - f"execute on passengers run function gm4_reeling_rods:fishing/minecart_passenger_transfer", - "tp @s ~ -1000 ~", - ]) - # technically this is generated 4 times, but its just one file, so uh idk - output_pack[f"gm4_reeling_rods:fishing/minecart_passenger_transfer"] = Function([ - "# transfer old passenger to new minecart", - f"# @s = passengers of {entity_type_no_prefix}", - f"# at old {entity_type_no_prefix}", - "# run from gm4_reeling_rods:fishing/{all_minecart}/action", - "\nride @s dismount", - "ride @s mount @e[type=minecraft:minecart,distance=..0.00001,limit=1]" - ]) - return - if "chest" in entity.entity_type: # chest boats / raft specific - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/action"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/select_type", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", - "execute positioned ~ ~0.75 ~ run function gm4_reeling_rods:separate", - "data remove storage gm4_reeling_rods:temp entity_data.UUID", - "data remove storage gm4_reeling_rods:temp entity_data.Passengers", - f"data modify storage gm4_reeling_rods:temp entity_type set value \"{entity.entity_type.replace('_chest','')}\"", - "function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp", - f"execute on passengers run function gm4_reeling_rods:fishing/{entity_type_no_prefix}/passenger_transfer", - "tp @s ~ -1000 ~" - ]) - output_pack[f"gm4_reeling_rods:fishing/{entity_type_no_prefix}/passenger_transfer"] = Function([ - "# transfer old passenger to new boat", - f"# @s = passengers of {entity_type_no_prefix}", - f"# at old {entity_type_no_prefix}", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/action", - "\nride @s dismount", - f"ride @s mount @e[type={entity.entity_type.replace('_chest','')},distance=..0.00001,limit=1]" - ]) - return - if "_horse" in entity.entity_type: # skele and zombie horses - output_pack[f"gm4_reeling_rods:fishing/select_type"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp item_data set value {}", - "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem", - "execute positioned ~ ~0.8 ~ run function gm4_reeling_rods:separate", - "execute if data storage gm4_reeling_rods:temp {item_data:{Item:{id:\"minecraft:saddle\"}}} run item replace entity @s horse.saddle with minecraft:air" - ]) - return - if "llama" in entity.entity_type: # llama and trader_llama - output_pack[f"gm4_reeling_rods:fishing/select_type"] = Function([ - f"# Action for reeled {entity_type_no_prefix}", - f"# @s = {entity_type_no_prefix}", - "# at @s", - f"# run from gm4_reeling_rods:fishing/{entity_type_no_prefix}/adv", - "\ndata modify storage gm4_reeling_rods:temp entity_data set from entity @s", - "data modify storage gm4_reeling_rods:temp item_data set value {}", - "data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s body_armor_item", - "execute if data entity @s {ChestedHorse:1b} run data modify storage gm4_reeling_rods:temp item_data.Item set value {id:\"minecraft:chest\",count:1}", - "execute positioned ~ ~1 ~ run function gm4_reeling_rods:separate", - "execute if data entity @s {ChestedHorse:1b} run return run data modify entity @s ChestedHorse set value 0b", - "item replace entity @s armor.body with minecraft:air" - ]) - return diff --git a/gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json b/gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json deleted file mode 100644 index 8d73a3466c..0000000000 --- a/gm4_reeling_rods/since_61/data/gm4_reeling_rods/tags/entity_type/leashable.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "values": [ - "#minecraft:boat", - "minecraft:acacia_chest_boat", - "minecraft:oak_chest_boat", - "minecraft:cherry_chest_boat", - "minecraft:birch_chest_boat", - "minecraft:bamboo_chest_raft", - "minecraft:jungle_chest_boat", - "minecraft:spruce_chest_boat", - "minecraft:dark_oak_chest_boat", - "minecraft:pale_oak_chest_boat", - "minecraft:mangrove_chest_boat", - "minecraft:skeleton_horse", - "minecraft:zombie_horse", - "minecraft:horse", - "minecraft:allay", - "minecraft:armadillo", - "minecraft:axolotl", - "minecraft:bee", - "minecraft:camel", - "minecraft:cat", - "minecraft:chicken", - "minecraft:cow", - "minecraft:dolphin", - "minecraft:donkey", - "minecraft:fox", - "minecraft:frog", - "minecraft:glow_squid", - "minecraft:goat", - "minecraft:hoglin", - "minecraft:iron_golem", - "minecraft:llama", - "minecraft:mooshroom", - "minecraft:mule", - "minecraft:ocelot", - "minecraft:parrot", - "minecraft:pig", - "minecraft:polar_bear", - "minecraft:rabbit", - "minecraft:sheep", - "minecraft:sniffer", - "minecraft:snow_golem", - "minecraft:squid", - "minecraft:strider", - "minecraft:trader_llama", - "minecraft:wolf", - "minecraft:zoglin" - ] -} From 3910c3cf009b2b67e8e07681456a13ee0df58005 Mon Sep 17 00:00:00 2001 From: runcows Date: Thu, 1 May 2025 16:15:38 +0900 Subject: [PATCH 37/37] Refactor & Add Generic Hand/Armor Yoinking --- .../chest_boat/action.mcfunction} | 4 +- .../chest_boat/passenger_transfer.mcfunction} | 2 +- .../{fishing => fished}/donkey.mcfunction | 2 +- .../{fishing => fished}/horse.mcfunction | 2 +- .../{fishing => fished}/item_frame.mcfunction | 2 +- .../fished/leash_knot/action.mcfunction | 14 ++++ .../leash_knot/change_leader.mcfunction | 2 +- .../leash_knot/leaded_by_knot.mcfunction | 2 +- .../{fishing => fished}/llama.mcfunction | 2 +- .../minecart/action.mcfunction} | 4 +- .../minecart/passenger_transfer.mcfunction} | 2 +- .../{fishing => fished}/mule.mcfunction | 2 +- .../{fishing => fished}/painting.mcfunction | 2 +- .../{fishing => fished}/pig.mcfunction | 2 +- .../{fishing => fished}/snow_golem.mcfunction | 2 +- .../stealable/order/equipment_1.mcfunction | 19 ++++++ .../stealable/order/equipment_2.mcfunction | 19 ++++++ .../stealable/order/equipment_3.mcfunction | 19 ++++++ .../stealable/order/equipment_4.mcfunction | 19 ++++++ .../stealable/order/equipment_5.mcfunction | 19 ++++++ .../stealable/order/equipment_6.mcfunction | 19 ++++++ .../fished/stealable/order/hands_1.mcfunction | 9 +++ .../fished/stealable/order/hands_2.mcfunction | 9 +++ .../stealable/steal_equipment.mcfunction | 13 ++++ .../fished/stealable/steal_hand.mcfunction | 9 +++ .../stealable/steal_slot/chest.mcfunction | 14 ++++ .../stealable/steal_slot/feet.mcfunction | 14 ++++ .../stealable/steal_slot/head.mcfunction | 14 ++++ .../stealable/steal_slot/legs.mcfunction | 14 ++++ .../stealable/steal_slot/mainhand.mcfunction | 14 ++++ .../stealable/steal_slot/offhand.mcfunction | 14 ++++ .../{fishing => fished}/strider.mcfunction | 2 +- .../undead_horse.mcfunction | 2 +- .../fished/villager/action.mcfunction | 27 ++++++++ .../villager/add_gossip.mcfunction | 2 +- .../villager/sell_out.mcfunction | 2 +- .../{fishing => fished}/wolf.mcfunction | 2 +- .../function/fishing/allay.mcfunction | 8 --- .../function/fishing/fox.mcfunction | 9 --- .../fishing/leash_knot/action.mcfunction | 13 ---- .../fishing/villager/action.mcfunction | 30 -------- .../function/fishing/witch.mcfunction | 10 --- .../{fishing => }/is_passenger.mcfunction | 2 +- .../player/find_fished_entity.mcfunction | 2 +- .../function/separate.mcfunction | 2 +- .../function/summon_entity.mcfunction | 4 +- .../tags/entity_type/ignore.json | 68 +++++++++---------- .../tags/entity_type/llamas.json | 4 +- .../tags/entity_type/steal_equipment.json | 16 +++++ .../tags/entity_type/steal_hand.json | 11 +++ gm4_reeling_rods/entities.csv | 67 +++++++++--------- gm4_reeling_rods/generate_files.py | 60 ++++++---------- 52 files changed, 421 insertions(+), 206 deletions(-) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing/chest_boat.mcfunction => fished/chest_boat/action.mcfunction} (83%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing/boat_passenger_transfer.mcfunction => fished/chest_boat/passenger_transfer.mcfunction} (83%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/donkey.mcfunction (95%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/horse.mcfunction (95%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/item_frame.mcfunction (93%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/action.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/leash_knot/change_leader.mcfunction (88%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/leash_knot/leaded_by_knot.mcfunction (82%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/llama.mcfunction (95%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing/minecart_type.mcfunction => fished/minecart/action.mcfunction} (82%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing/minecart_passenger_transfer.mcfunction => fished/minecart/passenger_transfer.mcfunction} (84%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/mule.mcfunction (95%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/painting.mcfunction (88%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/pig.mcfunction (91%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/snow_golem.mcfunction (91%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_1.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_2.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_3.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_4.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_5.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_6.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_1.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_2.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_equipment.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_hand.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/chest.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/feet.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/head.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/legs.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/mainhand.mcfunction create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/offhand.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/strider.mcfunction (91%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/undead_horse.mcfunction (93%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/action.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/villager/add_gossip.mcfunction (96%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/villager/sell_out.mcfunction (92%) rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => fished}/wolf.mcfunction (91%) delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction delete mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction rename gm4_reeling_rods/data/gm4_reeling_rods/function/{fishing => }/is_passenger.mcfunction (77%) create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_equipment.json create mode 100644 gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_hand.json diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/chest_boat/action.mcfunction similarity index 83% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/chest_boat/action.mcfunction index dfae2182e5..b97b489c24 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/chest_boat.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/chest_boat/action.mcfunction @@ -2,7 +2,7 @@ # @s = chest_boat type # at @s # with {boat_type} -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:chest",count:1} @@ -11,5 +11,5 @@ data remove storage gm4_reeling_rods:temp entity_data.UUID data remove storage gm4_reeling_rods:temp entity_data.Passengers $data modify storage gm4_reeling_rods:temp entity_type set value "$(boat_type)" function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp -execute on passengers run function gm4_reeling_rods:fishing/boat_passenger_transfer +execute on passengers run function gm4_reeling_rods:fished/chest_boat/passenger_transfer tp @s ~ -1000 ~ diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/chest_boat/passenger_transfer.mcfunction similarity index 83% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/chest_boat/passenger_transfer.mcfunction index 4476d384ed..3cbec803a6 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/boat_passenger_transfer.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/chest_boat/passenger_transfer.mcfunction @@ -1,7 +1,7 @@ # transfer old passenger to new boat # @s = passengers of chest boat type # at old chest boat type -# run from fishing/chest_boat +# run from fished/chest_boat/action ride @s dismount ride @s mount @e[type=#gm4:boats,distance=..0.00001,limit=1] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/donkey.mcfunction similarity index 95% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/donkey.mcfunction index 93684ebe6d..63fbcd675e 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/donkey.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/donkey.mcfunction @@ -1,7 +1,7 @@ # Action for reeled donkey # @s = donkey # at @s -# run from fishing/selec_type +# run from fished/selec_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s data modify storage gm4_reeling_rods:temp item_data set value {} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/horse.mcfunction similarity index 95% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/horse.mcfunction index 826b39c042..927999d4e1 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/horse.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/horse.mcfunction @@ -1,7 +1,7 @@ # Action for reeled horse # @s = horse # at @s -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp item_data set value {} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/item_frame.mcfunction similarity index 93% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/item_frame.mcfunction index b98bb43eb9..26abbbd4f3 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/item_frame.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/item_frame.mcfunction @@ -2,7 +2,7 @@ # @s = item frame or glow item frame # at @s # with {type} -# run from fishing/select_type +# run from fished/select_type $data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"$(type)",count:1} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Item diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/action.mcfunction new file mode 100644 index 0000000000..d1c0161790 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/action.mcfunction @@ -0,0 +1,14 @@ +# Action for reeled leash knot +# @s = leash knot +# at @s +# run from fished/select_type + +tag @s add gm4_reeling_rods.leash_knot + +# distance=..10 is leash distance UNTIL 1.21.6 +execute as @e[type=#gm4_reeling_rods:leashable,distance=..10] \ + if function gm4_reeling_rods:fished/leash_knot/leaded_by_knot \ + run function gm4_reeling_rods:fished/leash_knot/change_leader + + +kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/change_leader.mcfunction similarity index 88% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/change_leader.mcfunction index 254d0ffcdb..63d0f7d782 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/change_leader.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/change_leader.mcfunction @@ -1,7 +1,7 @@ # Changes a leashed entities leader from a leash knot to a tagged player # @s = entity leaded to leash knot # at leash knot -# run from fishing/leash_knot/action +# run from fished/leash_knot/action data remove entity @s leash data modify entity @s leash.UUID set from entity @e[type=player,tag=gm4_reeling_rods.player,distance=..45,limit=1] UUID diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/leaded_by_knot.mcfunction similarity index 82% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/leaded_by_knot.mcfunction index efbe8444c5..c8d23ccc6b 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/leaded_by_knot.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/leash_knot/leaded_by_knot.mcfunction @@ -1,6 +1,6 @@ # Checks if an entity is leashed by the knot in question # @s = a leashable entity # at owner -# run from fishing/leash_knot/action +# run from fished/leash_knot/action return run execute on leasher if entity @s[tag=gm4_reeling_rods.leash_knot] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/llama.mcfunction similarity index 95% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/llama.mcfunction index 0626c94267..e877c4ab95 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/llama.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/llama.mcfunction @@ -1,7 +1,7 @@ # Action for reeled llama or trader llama # @s = llama or trader llama # at @s -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s data modify storage gm4_reeling_rods:temp item_data set value {} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/minecart/action.mcfunction similarity index 82% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/minecart/action.mcfunction index 7915d21363..61edcc441f 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_type.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/minecart/action.mcfunction @@ -2,7 +2,7 @@ # @s = *_minecart # at @s # with {block} -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s $data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"$(block)",count:1} @@ -11,5 +11,5 @@ data remove storage gm4_reeling_rods:temp entity_data.UUID data remove storage gm4_reeling_rods:temp entity_data.Passengers data modify storage gm4_reeling_rods:temp entity_type set value "minecraft:minecart" function gm4_reeling_rods:summon_entity with storage gm4_reeling_rods:temp -execute on passengers run function gm4_reeling_rods:fishing/minecart_passenger_transfer +execute on passengers run function gm4_reeling_rods:fished/minecart/passenger_transfer tp @s ~ -1000 ~ diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/minecart/passenger_transfer.mcfunction similarity index 84% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/minecart/passenger_transfer.mcfunction index 59d6f0e761..b98fc0079a 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/minecart_passenger_transfer.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/minecart/passenger_transfer.mcfunction @@ -1,7 +1,7 @@ # transfer old passenger to new minecart # @s = passengers of *_minecart # at old *_minecart -# run from fishing/minecart_type +# run from fished/minecart/action ride @s dismount ride @s mount @e[type=minecraft:minecart,distance=..0.00001,limit=1] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/mule.mcfunction similarity index 95% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/mule.mcfunction index e8a3275ede..210c5ecc07 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/mule.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/mule.mcfunction @@ -1,7 +1,7 @@ # Action for reeled mule # @s = mule # at @s -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp entity_data set from entity @s data modify storage gm4_reeling_rods:temp item_data set value {} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/painting.mcfunction similarity index 88% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/painting.mcfunction index 0c8b078ca0..eda6f6985d 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/painting.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/painting.mcfunction @@ -1,7 +1,7 @@ # Action for reeled painting # @s = painting # at @s -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp item_data.Item set value {id:"minecraft:painting",count:1} execute align xz positioned ~0.5 ~ ~0.5 run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/pig.mcfunction similarity index 91% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/pig.mcfunction index 6e41e186ae..d4f4e1f408 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/pig.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/pig.mcfunction @@ -1,7 +1,7 @@ # Action for reeled pig # @s = pig # at @s -# run from fishing/select_type +# run from fished/select_type # fail if no saddle execute unless data entity @s {Saddle:1b} run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/snow_golem.mcfunction similarity index 91% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/snow_golem.mcfunction index 6debadee18..98701dfb16 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/snow_golem.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/snow_golem.mcfunction @@ -1,7 +1,7 @@ # Action for reeled snow_golem # @s = snow_golem # at @s -# run from fishing/select_type +# run from fished/select_type # fail if no Pumpkin execute unless data entity @s {Pumpkin:1b} run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_1.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_1.mcfunction new file mode 100644 index 0000000000..49734f8749 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_1.mcfunction @@ -0,0 +1,19 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/steal_equipment + +# 1 +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand +# 3 +execute if items entity @s armor.head * run return run function gm4_reeling_rods:fished/stealable/steal_slot/head +# 5 +execute if items entity @s armor.legs * run return run function gm4_reeling_rods:fished/stealable/steal_slot/legs +# 2 +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand +# 4 +execute if items entity @s armor.chest * run return run function gm4_reeling_rods:fished/stealable/steal_slot/chest +# 6 +execute if items entity @s armor.feet * run return run function gm4_reeling_rods:fished/stealable/steal_slot/feet + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_2.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_2.mcfunction new file mode 100644 index 0000000000..ac3a7ad446 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_2.mcfunction @@ -0,0 +1,19 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/steal_equipment + +# 2 +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand +# 4 +execute if items entity @s armor.chest * run return run function gm4_reeling_rods:fished/stealable/steal_slot/chest +# 6 +execute if items entity @s armor.feet * run return run function gm4_reeling_rods:fished/stealable/steal_slot/feet +# 1 +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand +# 3 +execute if items entity @s armor.head * run return run function gm4_reeling_rods:fished/stealable/steal_slot/head +# 5 +execute if items entity @s armor.legs * run return run function gm4_reeling_rods:fished/stealable/steal_slot/legs + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_3.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_3.mcfunction new file mode 100644 index 0000000000..672d93dbcf --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_3.mcfunction @@ -0,0 +1,19 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/steal_equipment + +# 3 +execute if items entity @s armor.head * run return run function gm4_reeling_rods:fished/stealable/steal_slot/head +# 5 +execute if items entity @s armor.legs * run return run function gm4_reeling_rods:fished/stealable/steal_slot/legs +# 2 +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand +# 4 +execute if items entity @s armor.chest * run return run function gm4_reeling_rods:fished/stealable/steal_slot/chest +# 6 +execute if items entity @s armor.feet * run return run function gm4_reeling_rods:fished/stealable/steal_slot/feet +# 1 +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_4.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_4.mcfunction new file mode 100644 index 0000000000..5c5c889b7a --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_4.mcfunction @@ -0,0 +1,19 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/steal_equipment + +# 4 +execute if items entity @s armor.chest * run return run function gm4_reeling_rods:fished/stealable/steal_slot/chest +# 6 +execute if items entity @s armor.feet * run return run function gm4_reeling_rods:fished/stealable/steal_slot/feet +# 1 +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand +# 3 +execute if items entity @s armor.head * run return run function gm4_reeling_rods:fished/stealable/steal_slot/head +# 5 +execute if items entity @s armor.legs * run return run function gm4_reeling_rods:fished/stealable/steal_slot/legs +# 2 +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_5.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_5.mcfunction new file mode 100644 index 0000000000..0f52fa86df --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_5.mcfunction @@ -0,0 +1,19 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/steal_equipment + +# 5 +execute if items entity @s armor.legs * run return run function gm4_reeling_rods:fished/stealable/steal_slot/legs +# 2 +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand +# 4 +execute if items entity @s armor.chest * run return run function gm4_reeling_rods:fished/stealable/steal_slot/chest +# 6 +execute if items entity @s armor.feet * run return run function gm4_reeling_rods:fished/stealable/steal_slot/feet +# 1 +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand +# 3 +execute if items entity @s armor.head * run return run function gm4_reeling_rods:fished/stealable/steal_slot/head + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_6.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_6.mcfunction new file mode 100644 index 0000000000..3b8ee03c6a --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/equipment_6.mcfunction @@ -0,0 +1,19 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/steal_equipment + +# 6 +execute if items entity @s armor.feet * run return run function gm4_reeling_rods:fished/stealable/steal_slot/feet +# 1 +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand +# 3 +execute if items entity @s armor.head * run return run function gm4_reeling_rods:fished/stealable/steal_slot/head +# 5 +execute if items entity @s armor.legs * run return run function gm4_reeling_rods:fished/stealable/steal_slot/legs +# 2 +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand +# 4 +execute if items entity @s armor.chest * run return run function gm4_reeling_rods:fished/stealable/steal_slot/chest + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_1.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_1.mcfunction new file mode 100644 index 0000000000..7648fdaab6 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_1.mcfunction @@ -0,0 +1,9 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_hand +# at @s +# run from fished/stealable/steal_hand + +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_2.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_2.mcfunction new file mode 100644 index 0000000000..1cf37d796c --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/order/hands_2.mcfunction @@ -0,0 +1,9 @@ +# Checks slots to steal +# @s = #gm4_reeling_rods:steal_hand +# at @s +# run from fished/stealable/steal_hand + +execute if items entity @s weapon.offhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/offhand +execute if items entity @s weapon.mainhand * run return run function gm4_reeling_rods:fished/stealable/steal_slot/mainhand + +return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_equipment.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_equipment.mcfunction new file mode 100644 index 0000000000..5509109608 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_equipment.mcfunction @@ -0,0 +1,13 @@ +# Pick an order to check equipment slots for stealing +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/select_type & fished/villager/action + +execute store result score $order gm4_reeling_rods.math run random value 1..6 + +execute if score $order gm4_reeling_rods.math matches 1 run return run function gm4_reeling_rods:fished/stealable/order/equipment_1 +execute if score $order gm4_reeling_rods.math matches 2 run return run function gm4_reeling_rods:fished/stealable/order/equipment_2 +execute if score $order gm4_reeling_rods.math matches 3 run return run function gm4_reeling_rods:fished/stealable/order/equipment_3 +execute if score $order gm4_reeling_rods.math matches 4 run return run function gm4_reeling_rods:fished/stealable/order/equipment_4 +execute if score $order gm4_reeling_rods.math matches 5 run return run function gm4_reeling_rods:fished/stealable/order/equipment_5 +execute if score $order gm4_reeling_rods.math matches 6 run return run function gm4_reeling_rods:fished/stealable/order/equipment_6 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_hand.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_hand.mcfunction new file mode 100644 index 0000000000..34e5a411fc --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_hand.mcfunction @@ -0,0 +1,9 @@ +# Pick an order to check hand slots for stealing +# @s = #gm4_reeling_rods:steal_hand +# at @s +# run from fished/select_type + +execute store result score $order gm4_reeling_rods.math run random value 1..2 + +execute if score $order gm4_reeling_rods.math matches 1 run return run function gm4_reeling_rods:fished/stealable/order/hands_1 +execute if score $order gm4_reeling_rods.math matches 2 run return run function gm4_reeling_rods:fished/stealable/order/hands_2 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/chest.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/chest.mcfunction new file mode 100644 index 0000000000..a3303ead55 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/chest.mcfunction @@ -0,0 +1,14 @@ +# Steal Chest +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/order/equipment_* + +data modify storage gm4_reeling_rods:temp item_data.Item set value {} +# NEEDS UPDATING FOR 1.21.5, USE EQUIPMENT TAG +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Inventory[{Slot:102b}] +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s ArmorItems[2] +item replace entity @s armor.chest with minecraft:air +data remove storage gm4_reeling_rods:temp item_data.Item.Slot +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +execute positioned ~ ~.7 ~ run function gm4_reeling_rods:separate +return 4 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/feet.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/feet.mcfunction new file mode 100644 index 0000000000..3c0c239fde --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/feet.mcfunction @@ -0,0 +1,14 @@ +# Steal Feet +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/order/equipment_* + +data modify storage gm4_reeling_rods:temp item_data.Item set value {} +# NEEDS UPDATING FOR 1.21.5, USE EQUIPMENT TAG +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Inventory[{Slot:100b}] +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s ArmorItems[0] +item replace entity @s armor.feet with minecraft:air +data remove storage gm4_reeling_rods:temp item_data.Item.Slot +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +execute positioned ~ ~.7 ~ run function gm4_reeling_rods:separate +return 6 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/head.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/head.mcfunction new file mode 100644 index 0000000000..2ae2999d60 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/head.mcfunction @@ -0,0 +1,14 @@ +# Steal Head +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/order/equipment_* + +data modify storage gm4_reeling_rods:temp item_data.Item set value {} +# NEEDS UPDATING FOR 1.21.5, USE EQUIPMENT TAG +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Inventory[{Slot:103b}] +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s ArmorItems[3] +item replace entity @s armor.head with minecraft:air +data remove storage gm4_reeling_rods:temp item_data.Item.Slot +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +execute positioned ~ ~.7 ~ run function gm4_reeling_rods:separate +return 3 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/legs.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/legs.mcfunction new file mode 100644 index 0000000000..dc9a210a9d --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/legs.mcfunction @@ -0,0 +1,14 @@ +# Steal Legs +# @s = #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/order/equipment_* + +data modify storage gm4_reeling_rods:temp item_data.Item set value {} +# NEEDS UPDATING FOR 1.21.5, USE EQUIPMENT TAG +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Inventory[{Slot:101b}] +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s ArmorItems[1] +item replace entity @s armor.legs with minecraft:air +data remove storage gm4_reeling_rods:temp item_data.Item.Slot +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +execute positioned ~ ~.7 ~ run function gm4_reeling_rods:separate +return 5 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/mainhand.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/mainhand.mcfunction new file mode 100644 index 0000000000..a8201f2a71 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/mainhand.mcfunction @@ -0,0 +1,14 @@ +# Steal Mainhand +# @s = #gm4_reeling_rods:steal_hand or #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/order/* + +data modify storage gm4_reeling_rods:temp item_data.Item set value {} +# NEEDS UPDATING FOR 1.21.5, USE EQUIPMENT TAG +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Inventory[{Slot:0b}] +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] +item replace entity @s weapon.mainhand with minecraft:air +data remove storage gm4_reeling_rods:temp item_data.Item.Slot +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +execute positioned ~ ~.7 ~ run function gm4_reeling_rods:separate +return 1 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/offhand.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/offhand.mcfunction new file mode 100644 index 0000000000..d69b9e8547 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/stealable/steal_slot/offhand.mcfunction @@ -0,0 +1,14 @@ +# Steal Offhand +# @s = #gm4_reeling_rods:steal_hand or #gm4_reeling_rods:steal_equipment +# at @s +# run from fished/stealable/order/* + +data modify storage gm4_reeling_rods:temp item_data.Item set value {} +# NEEDS UPDATING FOR 1.21.5, USE EQUIPMENT TAG +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s Inventory[{Slot:-106b}] +data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[1] +item replace entity @s weapon.offhand with minecraft:air +data remove storage gm4_reeling_rods:temp item_data.Item.Slot +data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s +execute positioned ~ ~.7 ~ run function gm4_reeling_rods:separate +return 2 diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/strider.mcfunction similarity index 91% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/strider.mcfunction index 171ca62461..8c14108abd 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/strider.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/strider.mcfunction @@ -1,7 +1,7 @@ # Action for reeled strider # @s = strider # at @s -# run from fishing/select_type +# run from fished/select_type # fail if no saddle execute unless data entity @s {Saddle:1b} run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/undead_horse.mcfunction similarity index 93% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/undead_horse.mcfunction index 1940948293..eb52f02ea6 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/undead_horse.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/undead_horse.mcfunction @@ -1,7 +1,7 @@ # Action for reeled zombie horse or skele horse # @s = zombie horse or skele horse # at @s -# run from fishing/select_type +# run from fished/select_type data modify storage gm4_reeling_rods:temp item_data set value {} data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s SaddleItem diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/action.mcfunction new file mode 100644 index 0000000000..ebbb642a19 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/action.mcfunction @@ -0,0 +1,27 @@ +# Action for reeled villager +# @s = villager +# at @s +# run from fished/select_type + +# store mainhand data for a potential trade steal +data modify storage gm4_reeling_rods:temp entity_data set value {} +data modify storage gm4_reeling_rods:temp entity_data.mainhand set from entity @s HandItems[0] + +# try to steal +execute store result score $slot gm4_reeling_rods.math run function gm4_reeling_rods:fished/stealable/steal_equipment +# if not mainhand, return +execute unless score $slot gm4_reeling_rods.math matches 1 run return fail + +## mainhand stolen (TRADED ITEM) + +# find trade and sell it out +function gm4_reeling_rods:fished/villager/sell_out with storage gm4_reeling_rods:temp entity_data + +# adds 20 "major_negative" gossip of the player to the villager +data modify storage gm4_reeling_rods:temp entity_data.gossip.Target set from entity @a[tag=gm4_reeling_rods.player,limit=1,distance=..33] UUID +function gm4_reeling_rods:fished/villager/add_gossip with storage gm4_reeling_rods:temp entity_data.gossip + +# angry particles +particle minecraft:angry_villager ~ ~1.5 ~ 0.3 0.3 0.3 20 3 +# angry sound +playsound minecraft:entity.villager.hurt neutral @a[distance=..16] ~ ~1.5 ~ diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/add_gossip.mcfunction similarity index 96% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/add_gossip.mcfunction index e30b69c30a..7b6e1f0d03 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/add_gossip.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/add_gossip.mcfunction @@ -2,7 +2,7 @@ # @s = villager # at @s # with {Target} -# run from fishing/villager/action +# run from fished/villager/action $execute store success score $success gm4_reeling_rods.math run \ data modify storage gm4_reeling_rods:temp entity_data.gossip merge from entity @s Gossips[{Type:"major_negative",Target:$(Target)}] diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/sell_out.mcfunction similarity index 92% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/sell_out.mcfunction index 0e44e3e048..390fdc51d9 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/sell_out.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/villager/sell_out.mcfunction @@ -2,7 +2,7 @@ # @s = villager # at @s # with {mainhand} -# run from fishing/villager/action +# run from fished/villager/action # for some reason on the first item after a restock?? it fails to set uses, but succeeds after that? This double set doesn't fix that though $data modify entity @s Offers.Recipes[{sell:$(mainhand)}] merge value {uses:0} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/wolf.mcfunction similarity index 91% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/fished/wolf.mcfunction index 7717084422..fce50f0808 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/wolf.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/fished/wolf.mcfunction @@ -1,7 +1,7 @@ # Action for reeled wolf # @s = wolf # at @s -# run from fishing/select_type +# run from fished/select_type # fail if no Owner execute unless data entity @s Owner run return fail diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction deleted file mode 100644 index 8a875c8a2d..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/allay.mcfunction +++ /dev/null @@ -1,8 +0,0 @@ -# Action for reeled allay -# @s = allay -# at @s -# run from fishing/select_type - -data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] -data modify entity @s HandItems[0] set value {} -function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction deleted file mode 100644 index 42053fa770..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/fox.mcfunction +++ /dev/null @@ -1,9 +0,0 @@ -# Action for reeled fox -# @s = fox -# at @s -# run from fishing/select_type - -data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] -data modify storage gm4_reeling_rods:temp item_data.PickupDelay set value 10s -data modify entity @s HandItems[0] set value {} -function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction deleted file mode 100644 index 0475cd7220..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/leash_knot/action.mcfunction +++ /dev/null @@ -1,13 +0,0 @@ -# Action for reeled leash knot -# @s = leash knot -# at @s -# run from fishing/select_type - -tag @s add gm4_reeling_rods.leash_knot - -execute as @e[type=#gm4_reeling_rods:leashable,distance=..10] \ - if function gm4_reeling_rods:fishing/leash_knot/leaded_by_knot \ - run function gm4_reeling_rods:fishing/leash_knot/change_leader - - -kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction deleted file mode 100644 index 97726700d2..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/villager/action.mcfunction +++ /dev/null @@ -1,30 +0,0 @@ -# Action for reeled villager -# @s = villager -# at @s -# run from fishing/select_type - -# fail if baby -execute store result score $misc gm4_reeling_rods.math run data get entity @s Age -execute unless score $misc gm4_reeling_rods.math matches 0.. run return fail - -# fail if not holding anything -execute unless data entity @s HandItems[0].id run return fail - -# find trade and sell it out -data modify storage gm4_reeling_rods:temp entity_data set value {} -data modify storage gm4_reeling_rods:temp entity_data.mainhand set from entity @s HandItems[0] -function gm4_reeling_rods:fishing/villager/sell_out with storage gm4_reeling_rods:temp entity_data - -# adds 20 "major_negative" gossip of the player to the villager -data modify storage gm4_reeling_rods:temp entity_data.gossip.Target set from entity @a[tag=gm4_reeling_rods.player,limit=1,distance=..33] UUID -function gm4_reeling_rods:fishing/villager/add_gossip with storage gm4_reeling_rods:temp entity_data.gossip - -# angry particles -particle minecraft:angry_villager ~ ~1.5 ~ 0.3 0.3 0.3 20 3 -# angry sound -playsound minecraft:entity.villager.hurt neutral @a[distance=..16] ~ ~1.5 ~ - -# pulls item -data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] -data modify entity @s HandItems[0] set value {} -execute positioned ~ ~1.1 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction deleted file mode 100644 index fc9b7f4990..0000000000 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/witch.mcfunction +++ /dev/null @@ -1,10 +0,0 @@ -# Action for reeled witch -# @s = witch -# at @s -# run from fishing/select_type - -# return if no item in mainhand -execute unless data entity @s HandItems[0].id run return fail -data modify storage gm4_reeling_rods:temp item_data.Item set from entity @s HandItems[0] -data modify entity @s HandItems[0] set value {} -execute positioned ~ ~1.2 ~ run function gm4_reeling_rods:separate diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/is_passenger.mcfunction similarity index 77% rename from gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction rename to gm4_reeling_rods/data/gm4_reeling_rods/function/is_passenger.mcfunction index 9a3b0fae04..6282558dac 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/fishing/is_passenger.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/is_passenger.mcfunction @@ -1,6 +1,6 @@ # checks if @s is a passenger # @s = entity to check # at @s -# run from fishing/select_type +# run from fished/select_type return run execute on vehicle if entity @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction index 569e56ad15..8f8cf3433b 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/player/find_fished_entity.mcfunction @@ -11,7 +11,7 @@ $execute as @e[type=minecraft:fishing_bobber,distance=..33] \ at @s as @e[distance=..42, limit=1, \ tag=$(bit_0), tag=$(bit_1), tag=$(bit_2), tag=$(bit_3), tag=$(bit_4), tag=$(bit_5), tag=$(bit_6), tag=$(bit_7), \ tag=$(bit_8), tag=$(bit_9), tag=$(bit_10), tag=$(bit_11), tag=$(bit_12), tag=$(bit_13), tag=$(bit_14), tag=$(bit_15)\ - ] unless entity @s[tag=smithed.entity] at @s run function gm4_reeling_rods:fishing/select_type + ] unless entity @s[tag=smithed.entity] at @s run function gm4_reeling_rods:fished/select_type # kill marker after kill @s diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction index 59584b0958..b3f873dc2c 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/separate.mcfunction @@ -1,7 +1,7 @@ # Separates an entity that needs it # @s = entity to be separated # at @s -# run from fishing/{entity} (/action) +# run from fished/* & fished/*/action & fished/stealable/steal_slot/* function gm4_reeling_rods:get_motion_to_player function gm4_reeling_rods:summon_item with storage gm4_reeling_rods:temp diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction index ea49ad2fd6..83e23266a2 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction +++ b/gm4_reeling_rods/data/gm4_reeling_rods/function/summon_entity.mcfunction @@ -1,5 +1,5 @@ # Summons a generic entity with data -# with {entity_data} -# run from fishing/{entity} +# with {entity_type, entity_data} +# run from fished/{minecart/chest_boat}/action $summon $(entity_type) ~ ~ ~ $(entity_data) diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json index 29be513500..79d0f04ca6 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/ignore.json @@ -1,38 +1,38 @@ { "values": [ - "minecraft:area_effect_cloud", - "minecraft:arrow", - "minecraft:block_display", - "minecraft:breeze_wind_charge", - "minecraft:command_block_minecart", - "minecraft:dragon_fireball", - "minecraft:egg", - "minecraft:ender_pearl", - "minecraft:evoker_fangs", - "minecraft:experience_bottle", - "minecraft:experience_orb", - "minecraft:eye_of_ender", - "minecraft:falling_block", - "minecraft:fireball", - "minecraft:firework_rocket", - "minecraft:fishing_bobber", - "minecraft:interaction", - "minecraft:item", - "minecraft:item_display", - "minecraft:lightning_bolt", - "minecraft:llama_spit", - "minecraft:marker", - "minecraft:ominous_item_spawner", - "minecraft:potion", - "minecraft:shulker_bullet", - "minecraft:small_fireball", - "minecraft:snowball", - "minecraft:spawner_minecart", - "minecraft:spectral_arrow", - "minecraft:text_display", - "minecraft:tnt", - "minecraft:trident", - "minecraft:wind_charge", - "minecraft:wither_skull" + "minecraft:area_effect_cloud", + "minecraft:arrow", + "minecraft:block_display", + "minecraft:breeze_wind_charge", + "minecraft:command_block_minecart", + "minecraft:dragon_fireball", + "minecraft:egg", + "minecraft:ender_pearl", + "minecraft:evoker_fangs", + "minecraft:experience_bottle", + "minecraft:experience_orb", + "minecraft:eye_of_ender", + "minecraft:falling_block", + "minecraft:fireball", + "minecraft:firework_rocket", + "minecraft:fishing_bobber", + "minecraft:interaction", + "minecraft:item", + "minecraft:item_display", + "minecraft:lightning_bolt", + "minecraft:llama_spit", + "minecraft:marker", + "minecraft:ominous_item_spawner", + "minecraft:potion", + "minecraft:shulker_bullet", + "minecraft:small_fireball", + "minecraft:snowball", + "minecraft:spawner_minecart", + "minecraft:spectral_arrow", + "minecraft:text_display", + "minecraft:tnt", + "minecraft:trident", + "minecraft:wind_charge", + "minecraft:wither_skull" ] } diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json index 6e94bfce7d..4560fcfee3 100644 --- a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/llamas.json @@ -1,6 +1,6 @@ { "values": [ - "minecraft:llama", - "minecraft:trader_llama" + "minecraft:llama", + "minecraft:trader_llama" ] } diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_equipment.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_equipment.json new file mode 100644 index 0000000000..83ae295d49 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_equipment.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:bogged", + "minecraft:drowned", + "minecraft:husk", + "minecraft:piglin", + "minecraft:piglin_brute", + "minecraft:player", + "minecraft:skeleton", + "minecraft:stray", + "minecraft:wither_skeleton", + "minecraft:zombie", + "minecraft:zombie_villager", + "minecraft:zombified_piglin" + ] +} diff --git a/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_hand.json b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_hand.json new file mode 100644 index 0000000000..66c0801214 --- /dev/null +++ b/gm4_reeling_rods/data/gm4_reeling_rods/tags/entity_type/steal_hand.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:allay", + "minecraft:fox", + "minecraft:illusioner", + "minecraft:pillager", + "minecraft:vex", + "minecraft:vindicator", + "minecraft:witch" + ] +} diff --git a/gm4_reeling_rods/entities.csv b/gm4_reeling_rods/entities.csv index 0419a43f9b..7fd852e9fb 100644 --- a/gm4_reeling_rods/entities.csv +++ b/gm4_reeling_rods/entities.csv @@ -1,35 +1,34 @@ id,needs_enchantment,can_dismount,command -minecraft:allay,TRUE,TRUE,"run function gm4_reeling_rods:fishing/allay" -minecraft:fox,TRUE,TRUE,"run function gm4_reeling_rods:fishing/fox" -minecraft:pig,TRUE,TRUE,"run function gm4_reeling_rods:fishing/pig" -minecraft:strider,TRUE,TRUE,"run function gm4_reeling_rods:fishing/strider" -minecraft:snow_golem,TRUE,TRUE,"run function gm4_reeling_rods:fishing/snow_golem" -minecraft:wolf,TRUE,TRUE,"run function gm4_reeling_rods:fishing/wolf" -minecraft:donkey,TRUE,TRUE,"run function gm4_reeling_rods:fishing/donkey" -#gm4_reeling_rods:llamas,TRUE,TRUE,"run function gm4_reeling_rods:fishing/llama" -minecraft:witch,TRUE,TRUE,"run function gm4_reeling_rods:fishing/witch" -minecraft:villager,TRUE,TRUE,"run function gm4_reeling_rods:fishing/villager/action" -minecraft:mule,TRUE,TRUE,"run function gm4_reeling_rods:fishing/mule" -minecraft:horse,TRUE,TRUE,"run function gm4_reeling_rods:fishing/horse" -#gm4_reeling_rods:undead_horse,TRUE,TRUE,"run function gm4_reeling_rods:fishing/undead_horse" -minecraft:shulker,FALSE,TRUE,"run execute facing entity @a[tag=gm4_reeling_rods.player,distance=..33,limit=1] eyes run tp @s ^ ^ ^1" -minecraft:chest_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:chest'}" -minecraft:furnace_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:furnace'}" -minecraft:hopper_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:hopper'}" -minecraft:tnt_minecart,TRUE,FALSE,"run function gm4_reeling_rods:fishing/minecart_type {block:'minecraft:tnt'}" -minecraft:chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:boat'}" -minecraft:acacia_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:acacia_boat'}" -minecraft:bamboo_chest_raft,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:bamboo_raft'}" -minecraft:birch_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:birch_boat'}" -minecraft:cherry_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:cherry_boat'}" -minecraft:dark_oak_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:dark_oak_boat'}" -minecraft:jungle_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:jungle_boat'}" -minecraft:mangrove_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:mangrove_boat'}" -minecraft:oak_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:oak_boat'}" -minecraft:pale_oak_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:pale_oak_boat'}" -minecraft:spruce_chest_boat,TRUE,FALSE,"run function gm4_reeling_rods:fishing/chest_boat {boat_type:'minecraft:spruce_boat'}" -minecraft:leash_knot,FALSE,FALSE,"run function gm4_reeling_rods:fishing/leash_knot/action" -minecraft:end_crystal,FALSE,FALSE,"run damage @s 1" -minecraft:painting,FALSE,FALSE,"run function gm4_reeling_rods:fishing/painting" -minecraft:item_frame,FALSE,FALSE,"run function gm4_reeling_rods:fishing/item_frame {type:'minecraft:item_frame'}" -minecraft:glow_item_frame,FALSE,FALSE,"run function gm4_reeling_rods:fishing/item_frame {type:'minecraft:glow_item_frame'}" +#gm4_reeling_rods:llamas,TRUE,TRUE,"function gm4_reeling_rods:fished/llama" +#gm4_reeling_rods:steal_hand,TRUE,TRUE,"function gm4_reeling_rods:fished/stealable/steal_hand" +#gm4_reeling_rods:steal_equipment,TRUE,TRUE,"function gm4_reeling_rods:fished/stealable/steal_equipment" +#gm4_reeling_rods:undead_horse,TRUE,TRUE,"function gm4_reeling_rods:fished/undead_horse" +minecraft:donkey,TRUE,TRUE,"function gm4_reeling_rods:fished/donkey" +minecraft:horse,TRUE,TRUE,"function gm4_reeling_rods:fished/horse" +minecraft:mule,TRUE,TRUE,"function gm4_reeling_rods:fished/mule" +minecraft:pig,TRUE,TRUE,"function gm4_reeling_rods:fished/pig" +minecraft:snow_golem,TRUE,TRUE,"function gm4_reeling_rods:fished/snow_golem" +minecraft:strider,TRUE,TRUE,"function gm4_reeling_rods:fished/strider" +minecraft:villager,TRUE,TRUE,"function gm4_reeling_rods:fished/villager/action" +minecraft:wolf,TRUE,TRUE,"function gm4_reeling_rods:fished/wolf" +minecraft:shulker,FALSE,TRUE,"execute facing entity @a[tag=gm4_reeling_rods.player,distance=..33,limit=1] eyes run tp @s ^ ^ ^1" +minecraft:chest_minecart,TRUE,FALSE,"function gm4_reeling_rods:fished/minecart/action {block:'minecraft:chest'}" +minecraft:furnace_minecart,TRUE,FALSE,"function gm4_reeling_rods:fished/minecart/action {block:'minecraft:furnace'}" +minecraft:hopper_minecart,TRUE,FALSE,"function gm4_reeling_rods:fished/minecart/action {block:'minecraft:hopper'}" +minecraft:tnt_minecart,TRUE,FALSE,"function gm4_reeling_rods:fished/minecart/action {block:'minecraft:tnt'}" +minecraft:chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:boat'}" +minecraft:acacia_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:acacia_boat'}" +minecraft:bamboo_chest_raft,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:bamboo_raft'}" +minecraft:birch_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:birch_boat'}" +minecraft:cherry_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:cherry_boat'}" +minecraft:dark_oak_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:dark_oak_boat'}" +minecraft:jungle_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:jungle_boat'}" +minecraft:mangrove_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:mangrove_boat'}" +minecraft:oak_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:oak_boat'}" +minecraft:pale_oak_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:pale_oak_boat'}" +minecraft:spruce_chest_boat,TRUE,FALSE,"function gm4_reeling_rods:fished/chest_boat/action {boat_type:'minecraft:spruce_boat'}" +minecraft:end_crystal,FALSE,FALSE,"damage @s 1" +minecraft:glow_item_frame,FALSE,FALSE,"function gm4_reeling_rods:fished/item_frame {type:'minecraft:glow_item_frame'}" +minecraft:item_frame,FALSE,FALSE,"function gm4_reeling_rods:fished/item_frame {type:'minecraft:item_frame'}" +minecraft:leash_knot,FALSE,FALSE,"function gm4_reeling_rods:fished/leash_knot/action" +minecraft:painting,FALSE,FALSE,"function gm4_reeling_rods:fished/painting" diff --git a/gm4_reeling_rods/generate_files.py b/gm4_reeling_rods/generate_files.py index 873741d939..d0bd4265fa 100644 --- a/gm4_reeling_rods/generate_files.py +++ b/gm4_reeling_rods/generate_files.py @@ -20,49 +20,29 @@ def beet_default(ctx: Context): My goal for right now is to go to the maximum scope and then have things cut back. Push this idea as far as I can, then reign it in. - TODO: Hand & Armor Yoinking - Treat this as an action. No entity should have an action AND have item theft - Therefore, it should take place after a failed dismount - As a consequence of no overlap, we can just return run the theft function, no need to conditional it + Hand & Armor Yoinking + Treat this as an action. If an entity is in one of the tags, don't list them separately in the csv - Should pull a random of those that exist - Use the random check order that you have in your notebook Yoinked item height. Previously, in manually defined yoinking, the item height was hard coded per entity - This is not easily possible with a generic item yoink - What do we do? - We could pass a value with a macro, same principal as hard coding the value, not pretty but it works - Is it possible to get the entity hitbox height? If we can then we can math out the location - Use a type tag list for which entities can have items yoinked + This is not possible with a generic item yoink + Right now the yoinked item is .7 block above entity origin - - NOTE: Specific Entities + Specific Entities Villagers: - -{ Special Exception }- - Currently are set up as a manually defined mainhand theft with reputational harm and trade sell out - Needs to implement theft for armor as well (armor can be dispensed onto them; only head renders) Does the armor theft cause reputational damage to player? + Currently, no. Easy to change though Illagers: - [ Vindicator, Vex, Pillager, Illusioner, Evoker? ] Can have armor on them through commands (not dispensed), but doesn't render Probably shouldn't theft armor that can't be applied by players, that's the realm of datapackers - Should use a special hand item theft function - Fox, Allay, Witch: - Needs to have old code scrapped - Cannot have armor (<1.21.5) - Should use a special hand item theft funciton (for clarity) + Using hand item theft function Player: - Try to implement using the generic entity item yoinking - But if there's player specific problems, just split player off into a special case - All the rest: - [ Bogged, Skeleton, Stray, Wither Skeleton ] - [ Husk, Drowned, Zombie, Zombie Villager ] - [ Piglin, Piglin Brute, Zombie Piglin ] - - Steal armor or hand item just fine - Nugget idea? - Try to use drop chances for armor and if it fails drop armor material? - What about datapack armor?... I worry about compatibility + Technically working for < 1.21.5, but for 1.21.5 it can be collapsed + + Nugget idea? + Try to use drop chances for armor and if it fails drop armor material? + What about datapack armor?... I worry about compatibility + Probably want to implement drop chances one way though \\ ---[ REJECTED FOR A REASON ]--- \\ @@ -105,7 +85,7 @@ def create_bit_advancements(ctx: Context): for bit in range(16): for value in range(2): # default adv - ctx.data[f"gm4_reeling_rods:fishing/bit_{bit}_{value}"] = Advancement({ + ctx.data[f"gm4_reeling_rods:fished/bit_{bit}_{value}"] = Advancement({ "criteria":{ "fishing_rod_hooked":{ "trigger":"minecraft:fishing_rod_hooked", @@ -122,8 +102,8 @@ def create_bit_advancements(ctx: Context): }) ctx.data[f"gm4_reeling_rods:player/bit_{bit}_{value}"] = Function([ f"# player adv logic for getting bit {bit} at value {value}", - f"# run from advancement fishing/bit_{bit}_{value}\n", - f"advancement revoke @s only gm4_reeling_rods:fishing/bit_{bit}_{value}\n", + f"# run from advancement fished/bit_{bit}_{value}\n", + f"advancement revoke @s only gm4_reeling_rods:fished/bit_{bit}_{value}\n", "execute if entity @s[gamemode=adventure] run return fail\n", "data modify storage gm4_reeling_rods:temp bit_data set value {bit_tag:\"" + f"gm4_reeling_rods.id.{bit}.{value}\", bit:\"{bit}\"" + "}", "data remove storage gm4_reeling_rods:temp enchanted", @@ -149,9 +129,9 @@ def create_select_type(ctx: Context, entities: CSV): # base gets since_57, else # backport_48 gets backport_48, else for write in writeTo: - command = f"execute if entity @s[type={entity['id']}] run return " + command = f"execute if entity @s[type={entity['id']}] run return run " if entity['needs_enchantment'] == "TRUE": - command = command + "run execute if data storage gm4_reeling_rods:temp enchanted " + command = command + "execute if data storage gm4_reeling_rods:temp enchanted run " command = command + entity['command'] write[order].append(command) finalSelectFunction(selectFuncBase, ctx.data.overlays["since_57"]) # should just be ctx.data when moved to 1.21.5, these overlays are gonna be a nightmare to update.,., Figure it out later @@ -170,8 +150,8 @@ def finalSelectFunction(strings: List[List[str]], output_pack: DataPack): for line in strings[0]: finalFunction.append(line) # dismount logic - finalFunction.append("\n# dismounting logic\nexecute if function gm4_reeling_rods:fishing/is_passenger run return run ride @s dismount\n") + finalFunction.append("\n# dismounting logic\nexecute if function gm4_reeling_rods:is_passenger run return run ride @s dismount\n") # entities that do dismount, only runs if not dismounting for line in strings[1]: finalFunction.append(line) - output_pack["gm4_reeling_rods:fishing/select_type"] = Function(finalFunction) + output_pack["gm4_reeling_rods:fished/select_type"] = Function(finalFunction)