diff --git a/data/fzsd/advancements/game_event/on_tool_axes_used_on_block.json b/data/fzsd/advancements/game_event/on_tool_axes_used_on_block.json new file mode 100644 index 0000000..6afff2e --- /dev/null +++ b/data/fzsd/advancements/game_event/on_tool_axes_used_on_block.json @@ -0,0 +1,28 @@ +{ + "parent": "fzsd:game_event", + "criteria": { + "on_tools_exclude_axes_used_on_block": { + "trigger": "minecraft:item_used_on_block", + "conditions": { + "player": [ + { + "condition": "minecraft:reference", + "name": "fzsd:is_real_player" + } + ], + "item": { + "tag": "fzsd:tool/axes" + }, + "location": { + "__comment": "斧子剥树皮会触发两次,所以用目标方块限定只触发一次", + "block": { + "tag": "fzsd:stripped_blocks" + } + } + } + } + }, + "rewards": { + "function": "fzsd:game_event/advancement/on_tools_used_on_block" + } +} \ No newline at end of file diff --git a/data/fzsd/advancements/game_event/on_tools_used_on_block.json b/data/fzsd/advancements/game_event/on_tools_exclude_axes_used_on_block.json similarity index 84% rename from data/fzsd/advancements/game_event/on_tools_used_on_block.json rename to data/fzsd/advancements/game_event/on_tools_exclude_axes_used_on_block.json index 3a0b083..859ab54 100644 --- a/data/fzsd/advancements/game_event/on_tools_used_on_block.json +++ b/data/fzsd/advancements/game_event/on_tools_exclude_axes_used_on_block.json @@ -1,7 +1,7 @@ { "parent": "fzsd:game_event", "criteria": { - "on_tools_used_on_block": { + "on_tools_exclude_axes_used_on_block": { "__comment": "斧子剥树皮会触发两次!", "trigger": "minecraft:item_used_on_block", "conditions": { @@ -12,7 +12,7 @@ } ], "item": { - "tag": "fzsd:tools" + "tag": "fzsd:tools_exclude_axes" } } } diff --git a/data/fzsd/functions/game_event/advancement/on_tools_used_on_block.mcfunction b/data/fzsd/functions/game_event/advancement/on_tools_used_on_block.mcfunction index 5a6ed71..6845397 100644 --- a/data/fzsd/functions/game_event/advancement/on_tools_used_on_block.mcfunction +++ b/data/fzsd/functions/game_event/advancement/on_tools_used_on_block.mcfunction @@ -1,5 +1,4 @@ # 调用者:advancements/fzsd:~ -## 斧子剥树皮会触发两次!! ## 调试 execute if score fzsd.logger.level fzsd.variable.integer matches ..400 run tellraw @a [{"nbt": "fzsd.level.debug", "interpret": true, "storage": "fzsd:logger"}, {"text": "事件已触发:玩家"}, {"selector": "@s"}, {"text": "在方块上使用了工具"}] @@ -11,4 +10,5 @@ scoreboard players remove @s fzsd.event.used_tool.dig_offset 1 function #fzsd:game_event/player/on_tools_used_on_block ## 重置事件进度 -advancement revoke @s only fzsd:game_event/on_tools_used_on_block \ No newline at end of file +advancement revoke @s only fzsd:game_event/on_tool_axes_used_on_block +advancement revoke @s only fzsd:game_event/on_tools_exclude_axes_used_on_block \ No newline at end of file diff --git a/data/fzsd/functions/game_event/player/on_broke_block_with_tool/on_used_tool.mcfunction b/data/fzsd/functions/game_event/player/on_broke_block_with_tool/on_used_tool.mcfunction index 227ffb2..db1f86f 100644 --- a/data/fzsd/functions/game_event/player/on_broke_block_with_tool/on_used_tool.mcfunction +++ b/data/fzsd/functions/game_event/player/on_broke_block_with_tool/on_used_tool.mcfunction @@ -30,7 +30,7 @@ scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.eve scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.event.used_tool.wooden_pickaxe scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.event.used_tool.wooden_shovel scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.event.used_tool.wooden_sword -scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.event.used_tool.offset +scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.event.used_tool.dig_offset ## 判断分数 execute unless score fzsd.var.score fzsd.variable.integer matches ..0 run function fzsd:game_event/player/on_broke_block_with_tool \ No newline at end of file diff --git a/data/fzsd/functions/game_event/player/on_used_tool/reset_used_tool.mcfunction b/data/fzsd/functions/game_event/player/on_used_tool/reset_used_tool.mcfunction index 2e658d8..5033b05 100644 --- a/data/fzsd/functions/game_event/player/on_used_tool/reset_used_tool.mcfunction +++ b/data/fzsd/functions/game_event/player/on_used_tool/reset_used_tool.mcfunction @@ -1,4 +1,4 @@ -scoreboard players set @s fzsd.event.used_tool.offset 0 +scoreboard players set @s fzsd.event.used_tool.dig_offset 0 scoreboard players set @s fzsd.event.used_tool.diamond_axe 0 scoreboard players set @s fzsd.event.used_tool.diamond_hoe 0 scoreboard players set @s fzsd.event.used_tool.diamond_pickaxe 0 diff --git a/data/fzsd/tags/functions/game_event/player/on_tools_used_on_block.json b/data/fzsd/tags/functions/game_event/player/on_tools_used_on_block.json index 907e30b..a1dc310 100644 --- a/data/fzsd/tags/functions/game_event/player/on_tools_used_on_block.json +++ b/data/fzsd/tags/functions/game_event/player/on_tools_used_on_block.json @@ -1,6 +1,5 @@ { "replace": false, "values": [ - ] } \ No newline at end of file diff --git a/data/fzsd/tags/items/tools_exclude_axes.json b/data/fzsd/tags/items/tools_exclude_axes.json new file mode 100644 index 0000000..a219fb1 --- /dev/null +++ b/data/fzsd/tags/items/tools_exclude_axes.json @@ -0,0 +1,10 @@ +{ + "replace": false, + "values": [ + "#fzsd:tool/hoes", + "#fzsd:tool/pickaxes", + "#fzsd:tool/shears", + "#fzsd:tool/shovels", + "#fzsd:tool/swords" + ] +} \ No newline at end of file