完善scoreboard、初步实现config
This commit is contained in:
parent
d9b5c29fff
commit
cb8c0a1079
@ -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"
|
||||
}
|
||||
}
|
9
data/fz/functions/event/on_unsneak.mcfunction
Normal file
9
data/fz/functions/event/on_unsneak.mcfunction
Normal file
@ -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
|
6
data/fz/functions/module/config/loop.mcfunction
Normal file
6
data/fz/functions/module/config/loop.mcfunction
Normal file
@ -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
|
1
data/fz/functions/module/config/timeout.mcfunction
Normal file
1
data/fz/functions/module/config/timeout.mcfunction
Normal file
@ -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
|
5
data/fz/tags/functions/event/on_unsneak.json
Normal file
5
data/fz/tags/functions/event/on_unsneak.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"__comment": "调用者:fz:event/on_unsneaked,当玩家蹲起后触发此事件",
|
||||
"replace": false,
|
||||
"values": []
|
||||
}
|
6
data/fz/tags/functions/module/config/buttons.json
Normal file
6
data/fz/tags/functions/module/config/buttons.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fz:module/config/buttons"
|
||||
]
|
||||
}
|
7
data/fz/tags/functions/module/config/on_click.json
Normal file
7
data/fz/tags/functions/module/config/on_click.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"__comment": "调用者:fz:module/config/loop",
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fz:module/config/on_click"
|
||||
]
|
||||
}
|
6
data/fz/tags/functions/module/config/timeout.json
Normal file
6
data/fz/tags/functions/module/config/timeout.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"fz:module/config/timeout"
|
||||
]
|
||||
}
|
7
data/fz/tags/functions/module/config/trigger.json
Normal file
7
data/fz/tags/functions/module/config/trigger.json
Normal file
@ -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": "此处只能填入一个函数!",
|
||||
|
Loading…
Reference in New Issue
Block a user