From 08f73b9b9ced6e2a715e61806cab2bf9ebb4bf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=B6=E7=9A=93?= <1214946206@qq.com> Date: Sun, 30 Oct 2022 00:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=8C=96=E6=8E=98=E6=A6=9C?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=9A=84=E6=89=A9=E5=B1=95=E6=80=A7=E3=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96here?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functions/api/get_dimension_name/default.mcfunction | 2 +- ..._used_tool.mcfunction => calculate_dig_score.mcfunction} | 5 +---- .../player/on_broke_block_with_tool/try_trigger.mcfunction | 2 ++ .../here/get_dimension_message/if_the_nether.mcfunction | 3 ++- .../module/here/get_dimension_message/overworld.mcfunction | 2 +- .../module/here/get_dimension_message/the_nether.mcfunction | 2 +- data/fzsd/functions/module/here/get_message.mcfunction | 4 ++-- data/fzsd/functions/module/here/global_message.mcfunction | 2 +- data/fzsd/functions/module/here/private_message.mcfunction | 2 +- .../on_broke_block_with_tool/calculate_dig_score.json | 6 ++++++ .../fzsd/tags/functions/game_event/player/on_used_tool.json | 3 ++- 11 files changed, 20 insertions(+), 13 deletions(-) rename data/fzsd/functions/game_event/player/on_broke_block_with_tool/{on_used_tool.mcfunction => calculate_dig_score.mcfunction} (94%) create mode 100644 data/fzsd/functions/game_event/player/on_broke_block_with_tool/try_trigger.mcfunction create mode 100644 data/fzsd/tags/functions/game_event/player/on_broke_block_with_tool/calculate_dig_score.json diff --git a/data/fzsd/functions/api/get_dimension_name/default.mcfunction b/data/fzsd/functions/api/get_dimension_name/default.mcfunction index afc12f5..dc3a371 100644 --- a/data/fzsd/functions/api/get_dimension_name/default.mcfunction +++ b/data/fzsd/functions/api/get_dimension_name/default.mcfunction @@ -1 +1 @@ -data modify storage fzsd:global fzsd.api.dimension.name set value '{"nbt": "fzsd.cache.dimension.id", "storage": "fzsd:global"}' \ No newline at end of file +data modify storage fzsd:global fzsd.api.dimension.name set value '{"nbt": "fzsd.api.dimension.id", "storage": "fzsd:global"}' \ 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/calculate_dig_score.mcfunction similarity index 94% rename from data/fzsd/functions/game_event/player/on_broke_block_with_tool/on_used_tool.mcfunction rename to data/fzsd/functions/game_event/player/on_broke_block_with_tool/calculate_dig_score.mcfunction index db1f86f..a92443b 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/calculate_dig_score.mcfunction @@ -30,7 +30,4 @@ 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.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 +scoreboard players operation fzsd.var.score fzsd.variable.integer += @s fzsd.event.used_tool.dig_offset \ No newline at end of file diff --git a/data/fzsd/functions/game_event/player/on_broke_block_with_tool/try_trigger.mcfunction b/data/fzsd/functions/game_event/player/on_broke_block_with_tool/try_trigger.mcfunction new file mode 100644 index 0000000..5d65686 --- /dev/null +++ b/data/fzsd/functions/game_event/player/on_broke_block_with_tool/try_trigger.mcfunction @@ -0,0 +1,2 @@ +## 判断分数 +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/module/here/get_dimension_message/if_the_nether.mcfunction b/data/fzsd/functions/module/here/get_dimension_message/if_the_nether.mcfunction index d94cae7..48d2e89 100644 --- a/data/fzsd/functions/module/here/get_dimension_message/if_the_nether.mcfunction +++ b/data/fzsd/functions/module/here/get_dimension_message/if_the_nether.mcfunction @@ -3,4 +3,5 @@ execute store result storage fzsd:here fzsd.overworld.x int 8 run data get entit execute store result storage fzsd:here fzsd.overworld.z int 8 run data get entity @s Pos[2] data modify storage fzsd:global fzsd.api.dimension.id set value "minecraft:overworld" function #fzsd:api/get_dimension_name -data modify storage fzsd:here fzsd.message.append set value '[{"text": ",对应", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.overworld.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.overworld.z", "storage": "fzsd:here"}, {"text": "]"}]]' \ No newline at end of file +data modify storage fzsd:here fzsd.message.append set value '[{"text": ",对应", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.overworld.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.overworld.z", "storage": "fzsd:here"}, {"text": "]"}]]' +## 恢复用于判断的维度id \ No newline at end of file diff --git a/data/fzsd/functions/module/here/get_dimension_message/overworld.mcfunction b/data/fzsd/functions/module/here/get_dimension_message/overworld.mcfunction index 71763c5..46c00ec 100644 --- a/data/fzsd/functions/module/here/get_dimension_message/overworld.mcfunction +++ b/data/fzsd/functions/module/here/get_dimension_message/overworld.mcfunction @@ -1 +1 @@ -execute if data storage fzsd:global fzsd.api.dimension{id:"minecraft:overworld"} run function fzsd:module/here/get_dimension_message/if_overworld \ No newline at end of file +execute if data entity @s {Dimension:"minecraft:overworld"} run function fzsd:module/here/get_dimension_message/if_overworld \ No newline at end of file diff --git a/data/fzsd/functions/module/here/get_dimension_message/the_nether.mcfunction b/data/fzsd/functions/module/here/get_dimension_message/the_nether.mcfunction index 44bae3a..474495e 100644 --- a/data/fzsd/functions/module/here/get_dimension_message/the_nether.mcfunction +++ b/data/fzsd/functions/module/here/get_dimension_message/the_nether.mcfunction @@ -1 +1 @@ -execute if data storage fzsd:global fzsd.api.dimension{id:"minecraft:the_nether"} run function fzsd:module/here/get_dimension_message/if_the_nether \ No newline at end of file +execute if data entity @s {Dimension:"minecraft:the_nether"} run function fzsd:module/here/get_dimension_message/if_the_nether \ No newline at end of file diff --git a/data/fzsd/functions/module/here/get_message.mcfunction b/data/fzsd/functions/module/here/get_message.mcfunction index 300836b..dad1942 100644 --- a/data/fzsd/functions/module/here/get_message.mcfunction +++ b/data/fzsd/functions/module/here/get_message.mcfunction @@ -1,8 +1,8 @@ -## fzsd.cache.pos已在install中初始化 + execute store result storage fzsd:here fzsd.x int 1 run data get entity @s Pos[0] execute store result storage fzsd:here fzsd.y int 1 run data get entity @s Pos[1] execute store result storage fzsd:here fzsd.z int 1 run data get entity @s Pos[2] data modify storage fzsd:here fzsd.message.append set value '' - +data modify storage fzsd:here fzsd.dimension.name set from storage fzsd:global fzsd.api.dimension.name ## 调试 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": "获取了位置信息"}] \ No newline at end of file diff --git a/data/fzsd/functions/module/here/global_message.mcfunction b/data/fzsd/functions/module/here/global_message.mcfunction index 2c23865..93c12c0 100644 --- a/data/fzsd/functions/module/here/global_message.mcfunction +++ b/data/fzsd/functions/module/here/global_message.mcfunction @@ -1 +1 @@ -tellraw @a [{"selector": "@s"}, [{"text": "说:我在", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]] \ No newline at end of file +tellraw @a [{"selector": "@s"}, [{"text": "说:我在", "color": "white"}, {"nbt": "fzsd.dimension.name", "interpret": true, "storage": "fzsd:here"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]] \ No newline at end of file diff --git a/data/fzsd/functions/module/here/private_message.mcfunction b/data/fzsd/functions/module/here/private_message.mcfunction index 39d2e35..9da0724 100644 --- a/data/fzsd/functions/module/here/private_message.mcfunction +++ b/data/fzsd/functions/module/here/private_message.mcfunction @@ -1 +1 @@ -tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}] \ No newline at end of file +tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.dimension.name", "interpret": true, "storage": "fzsd:here"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}] \ No newline at end of file diff --git a/data/fzsd/tags/functions/game_event/player/on_broke_block_with_tool/calculate_dig_score.json b/data/fzsd/tags/functions/game_event/player/on_broke_block_with_tool/calculate_dig_score.json new file mode 100644 index 0000000..a050418 --- /dev/null +++ b/data/fzsd/tags/functions/game_event/player/on_broke_block_with_tool/calculate_dig_score.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "fzsd:game_event/player/on_broke_block_with_tool/calculate_dig_score" + ] +} \ No newline at end of file diff --git a/data/fzsd/tags/functions/game_event/player/on_used_tool.json b/data/fzsd/tags/functions/game_event/player/on_used_tool.json index 2259bd7..ce9eb56 100644 --- a/data/fzsd/tags/functions/game_event/player/on_used_tool.json +++ b/data/fzsd/tags/functions/game_event/player/on_used_tool.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "fzsd:game_event/player/on_broke_block_with_tool/on_used_tool" + "#fzsd:game_event/player/on_broke_block_with_tool/calculate_dig_score", + "fzsd:game_event/player/on_broke_block_with_tool/try_trigger" ] } \ No newline at end of file