diff --git a/gm4_metallurgy/data/gm4_metallurgy/function/shamir_in_hand.mcfunction b/gm4_metallurgy/data/gm4_metallurgy/function/shamir_in_hand.mcfunction index a891eae5f9..854801d545 100644 --- a/gm4_metallurgy/data/gm4_metallurgy/function/shamir_in_hand.mcfunction +++ b/gm4_metallurgy/data/gm4_metallurgy/function/shamir_in_hand.mcfunction @@ -1,9 +1,11 @@ # @s = player with an active shamir in their hands +# at @s # run from player execute if predicate gm4_metallurgy:arborenda_active run function gm4_arborenda_shamir:active execute if predicate gm4_metallurgy:hypexperia_active run function gm4_hypexperia_shamir:active execute if predicate gm4_metallurgy:moneo_active run function gm4_moneo_shamir:active_tool +execute if predicate gm4_metallurgy:moneo_active_offhand run function gm4_moneo_shamir:active_tool_offhand execute if entity @s[scores={gm4_note_collect=1..},predicate=gm4_metallurgy:musical_active] run function gm4_musical_shamir:active execute if predicate gm4_metallurgy:sensus_active run function gm4_sensus_shamir:active execute if predicate gm4_metallurgy:infinitas_active run function gm4_infinitas_shamir:active diff --git a/gm4_metallurgy/data/gm4_metallurgy/predicate/moneo_active_offhand.json b/gm4_metallurgy/data/gm4_metallurgy/predicate/moneo_active_offhand.json new file mode 100644 index 0000000000..b20d5d99a9 --- /dev/null +++ b/gm4_metallurgy/data/gm4_metallurgy/predicate/moneo_active_offhand.json @@ -0,0 +1,13 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "offhand": { + "predicates": { + "minecraft:custom_data": "{gm4_metallurgy:{has_shamir:1b,active_shamir:'moneo'}}" + } + } + } + } +} diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool.mcfunction index e8c439dc64..003eea2fbc 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool.mcfunction @@ -1,4 +1,5 @@ # @s = players holding a moneo tool +# at @s # run from shamir_in_hand scoreboard players set $tool_current_damage gm4_ml_data 0 diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool_offhand.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool_offhand.mcfunction new file mode 100644 index 0000000000..0d7eb4f9d3 --- /dev/null +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/active_tool_offhand.mcfunction @@ -0,0 +1,23 @@ +# @s = players holding a moneo tool +# at @s +# run from shamir_in_hand + +scoreboard players set $tool_current_damage gm4_ml_data 0 +scoreboard players set $tool_max_damage gm4_ml_data 0 + +execute store result score $tool_current_damage gm4_ml_data run data get entity @s equipment.offhand.components."minecraft:damage" +execute store result score $tool_max_damage gm4_ml_data run data get entity @s equipment.offhand.components."minecraft:custom_data".MaxDurability + +# update newly upgraded netherite gear +execute if score $tool_max_damage gm4_ml_data matches 1561 if predicate gm4_moneo_shamir:holding_netherite_offhand run function gm4_moneo_shamir:update_netherite_offhand + +# activate moneo +execute if score $tool_max_damage gm4_ml_data matches 59 run function gm4_moneo_shamir:tools/materials/wood +execute if score $tool_max_damage gm4_ml_data matches 131 run function gm4_moneo_shamir:tools/materials/stone +execute if score $tool_max_damage gm4_ml_data matches 190 run function gm4_moneo_shamir:tools/materials/copper +execute if score $tool_max_damage gm4_ml_data matches 250 run function gm4_moneo_shamir:tools/materials/iron +execute if score $tool_max_damage gm4_ml_data matches 1561 run function gm4_moneo_shamir:tools/materials/diamond +execute if score $tool_max_damage gm4_ml_data matches 2031 run function gm4_moneo_shamir:tools/materials/netherite +# | gold used to be listed as 33 max damage, this is kept for compatibility with old items +execute if score $tool_max_damage gm4_ml_data matches 32..33 run function gm4_moneo_shamir:tools/materials/gold +execute if score $tool_max_damage gm4_ml_data matches 237 run function gm4_moneo_shamir:tools/shears diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/copper.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/copper.mcfunction index dc57284f80..2b64876d44 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/copper.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/copper.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/diamond.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/diamond.mcfunction index 7e81ae009e..e1fa1fe314 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/diamond.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/diamond.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/gold.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/gold.mcfunction index 1d8130710a..0dafda74b9 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/gold.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/gold.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/iron.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/iron.mcfunction index 8b564f9c8d..ce8413d586 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/iron.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/iron.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/netherite.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/netherite.mcfunction index 7e81ae009e..e1fa1fe314 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/netherite.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/netherite.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/stone.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/stone.mcfunction index f7847068b4..c1b839a6b8 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/stone.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/stone.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/wood.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/wood.mcfunction index 7c806ae7ea..2830dbc072 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/wood.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/materials/wood.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/shears.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/shears.mcfunction index b876ef4914..242ac77fec 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/shears.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/tools/shears.mcfunction @@ -1,5 +1,6 @@ -# run from active_tool # @s = player holding the moneo tool +# at @s +# run from active_tool and active_tool_offhand scoreboard players operation $tool_max_damage gm4_ml_data -= $tool_current_damage gm4_ml_data diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite.mcfunction index b7acf6376c..416c00f751 100644 --- a/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite.mcfunction +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite.mcfunction @@ -1,4 +1,5 @@ # @s = player holding a netherite moneo tool that has the wrong MaxDurability +# at @s # run from active_tool # item modifier diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite_offhand.mcfunction b/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite_offhand.mcfunction new file mode 100644 index 0000000000..6629613f93 --- /dev/null +++ b/gm4_metallurgy/data/gm4_moneo_shamir/function/update_netherite_offhand.mcfunction @@ -0,0 +1,9 @@ +# @s = player holding a netherite moneo tool that has the wrong MaxDurability +# at @s +# run from active_tool_offhand + +# item modifier +item modify entity @s weapon.offhand gm4_moneo_shamir:netherite_update + +# correctly set the max damage +scoreboard players set $tool_max_damage gm4_ml_data 2031 diff --git a/gm4_metallurgy/data/gm4_moneo_shamir/predicate/holding_netherite_offhand.json b/gm4_metallurgy/data/gm4_moneo_shamir/predicate/holding_netherite_offhand.json new file mode 100644 index 0000000000..038b8f064e --- /dev/null +++ b/gm4_metallurgy/data/gm4_moneo_shamir/predicate/holding_netherite_offhand.json @@ -0,0 +1,11 @@ +{ + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "equipment": { + "offhand": { + "items": "#gm4_moneo_shamir:netherite_tools" + } + } + } +}