diff --git a/data/fz/advancements/config/sneak.json b/data/fz/advancements/sneak.json similarity index 100% rename from data/fz/advancements/config/sneak.json rename to data/fz/advancements/sneak.json diff --git a/data/fz/advancements/config/unsneak.json b/data/fz/advancements/unsneak.json similarity index 79% rename from data/fz/advancements/config/unsneak.json rename to data/fz/advancements/unsneak.json index 35b526c..7ae31b0 100644 --- a/data/fz/advancements/config/unsneak.json +++ b/data/fz/advancements/unsneak.json @@ -7,7 +7,7 @@ "type_specific": { "type": "player", "advancements": { - "adventure" + "fz:config/sneak": true } }, "flags": { @@ -16,5 +16,8 @@ } } } + }, + "rewards": { + "function": "fz:event/on_unsneak" } } \ No newline at end of file diff --git a/data/fz/functions/event/on_unsneak.mcfunction b/data/fz/functions/event/on_unsneak.mcfunction new file mode 100644 index 0000000..2d6d16b --- /dev/null +++ b/data/fz/functions/event/on_unsneak.mcfunction @@ -0,0 +1,9 @@ +# 调用者:advancement/fz:unskeak +##### 当玩家蹲起后触发此事件 + +function #fz:event/on_unsneak +execute if entity @s[y_rotation = 90] run function #fz:module/config/trigger + +## 复位进度触发器 +advancement revoke @s only fz:sneak +advancement revoke @s only fz:unsneak \ No newline at end of file diff --git a/data/fz/functions/module/config/install.mcfunction b/data/fz/functions/module/config/install.mcfunction index e69de29..5caef59 100644 --- a/data/fz/functions/module/config/install.mcfunction +++ b/data/fz/functions/module/config/install.mcfunction @@ -0,0 +1 @@ +scoreboard objectives add fz.module.config.trigger \ No newline at end of file diff --git a/data/fz/functions/module/config/loop.mcfunction b/data/fz/functions/module/config/loop.mcfunction new file mode 100644 index 0000000..d6fdaf0 --- /dev/null +++ b/data/fz/functions/module/config/loop.mcfunction @@ -0,0 +1,6 @@ +# 调用者:fz:module/config/trigger + +## 如果分数大于0说明玩家点击了按钮 +execute as @a if score @s fz.module.config.trigger matches 1.. run function #fz:module/config/on_click + +schedule function fz:module/config/loop 1t replace \ No newline at end of file diff --git a/data/fz/functions/module/config/on_click.mcfunction b/data/fz/functions/module/config/on_click.mcfunction index e69de29..121e964 100644 --- a/data/fz/functions/module/config/on_click.mcfunction +++ b/data/fz/functions/module/config/on_click.mcfunction @@ -0,0 +1,7 @@ +# 调用者:#fz:module/config/on_click +##### 处理玩家点击事件,并进行下一步操作 + + + +## 重新显示一次按钮 +function #fz:module/config/buttons \ No newline at end of file diff --git a/data/fz/functions/module/config/timeout.mcfunction b/data/fz/functions/module/config/timeout.mcfunction new file mode 100644 index 0000000..6782a61 --- /dev/null +++ b/data/fz/functions/module/config/timeout.mcfunction @@ -0,0 +1 @@ +schedule clear fz:module/config/loop \ No newline at end of file diff --git a/data/fz/functions/module/config/trigger.mcfunction b/data/fz/functions/module/config/trigger.mcfunction index e69de29..7bff35e 100644 --- a/data/fz/functions/module/config/trigger.mcfunction +++ b/data/fz/functions/module/config/trigger.mcfunction @@ -0,0 +1,11 @@ +# 调用者:#fz:module/config/on_trigger +##### 玩家抬头到最高角度并蹲起后,触发此函数 + +## 监听计分板分数的循环,schedule是为了避免1tick内执行两次,但可有可无 +schedule function fz:module/config/loop 0t replace + +## 显示按钮 +function #fz:module/config/buttons + +## 设置或重制超时时间 +schedule function #fz:module/config/timeout 300s replace \ No newline at end of file diff --git a/data/fz/tags/functions/event/on_unsneak.json b/data/fz/tags/functions/event/on_unsneak.json new file mode 100644 index 0000000..4614599 --- /dev/null +++ b/data/fz/tags/functions/event/on_unsneak.json @@ -0,0 +1,5 @@ +{ + "__comment": "调用者:fz:event/on_unsneaked,当玩家蹲起后触发此事件", + "replace": false, + "values": [] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/config/buttons.json b/data/fz/tags/functions/module/config/buttons.json new file mode 100644 index 0000000..bb69f12 --- /dev/null +++ b/data/fz/tags/functions/module/config/buttons.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "fz:module/config/buttons" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/config/on_click.json b/data/fz/tags/functions/module/config/on_click.json new file mode 100644 index 0000000..cb79e53 --- /dev/null +++ b/data/fz/tags/functions/module/config/on_click.json @@ -0,0 +1,7 @@ +{ + "__comment": "调用者:fz:module/config/loop", + "replace": false, + "values": [ + "fz:module/config/on_click" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/config/timeout.json b/data/fz/tags/functions/module/config/timeout.json new file mode 100644 index 0000000..c663051 --- /dev/null +++ b/data/fz/tags/functions/module/config/timeout.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "fz:module/config/timeout" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/config/trigger.json b/data/fz/tags/functions/module/config/trigger.json new file mode 100644 index 0000000..b18ac4e --- /dev/null +++ b/data/fz/tags/functions/module/config/trigger.json @@ -0,0 +1,7 @@ +{ + "__comment": "调用者:fz:event/config/on_triggered,当玩家抬头到最高角度并蹲起后,触发此事件", + "replace": false, + "values": [ + "fz:module/config/trigger" + ] +} \ No newline at end of file diff --git a/data/fz/tags/functions/module/scoreboard/display/carousel_controller/loop.json b/data/fz/tags/functions/module/scoreboard/display/carousel_controller/loop.json index a0cfe9a..04f67e8 100644 --- a/data/fz/tags/functions/module/scoreboard/display/carousel_controller/loop.json +++ b/data/fz/tags/functions/module/scoreboard/display/carousel_controller/loop.json @@ -1,4 +1,5 @@ { + "__comment": "调用者:fz:module/scoreboard/load", "__comment_replace": "编写扩展数据包时必须开启覆盖!", "replace": true, "__comment_values": "此处只能填入一个函数!",