完善scoreboard、初步实现config

This commit is contained in:
延皓
2022-06-23 21:10:09 +08:00
parent d9b5c29fff
commit cb8c0a1079
14 changed files with 71 additions and 1 deletions
@@ -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"
}
}
@@ -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
@@ -0,0 +1 @@
scoreboard objectives add fz.module.config.trigger
@@ -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
@@ -0,0 +1,7 @@
# 调用者:#fz:module/config/on_click
#####
##
function #fz:module/config/buttons
@@ -0,0 +1 @@
schedule clear fz:module/config/loop
@@ -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
@@ -0,0 +1,5 @@
{
"__comment": "调用者:fz:event/on_unsneaked,当玩家蹲起后触发此事件",
"replace": false,
"values": []
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/config/buttons"
]
}
@@ -0,0 +1,7 @@
{
"__comment": "调用者:fz:module/config/loop",
"replace": false,
"values": [
"fz:module/config/on_click"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"fz:module/config/timeout"
]
}
@@ -0,0 +1,7 @@
{
"__comment": "调用者:fz:event/config/on_triggered,当玩家抬头到最高角度并蹲起后,触发此事件",
"replace": false,
"values": [
"fz:module/config/trigger"
]
}
@@ -1,4 +1,5 @@
{
"__comment": "调用者:fz:module/scoreboard/load",
"__comment_replace": "编写扩展数据包时必须开启覆盖!",
"replace": true,
"__comment_values": "此处只能填入一个函数!",