Skip to content

Commit

Permalink
更新datapack的kdx.kits模块
Browse files Browse the repository at this point in the history
  • Loading branch information
kdxhub committed Jan 11, 2025
1 parent d940038 commit 8f88771
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 12 deletions.
6 changes: 4 additions & 2 deletions datapack/data/kdx.kits/advancement/trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
"italic": false
},
"frame": "task",
"hidden": false
"hidden": false,
"announce_to_chat": false,
"show_toast": false
},
"parent": "kdx:_hidden",
"criteria": {
"requirement": {
"trigger": "minecraft:location",
"conditions": {
"condition": {
"player": [
{"flags": {
"is_on_ground": true,
Expand Down
10 changes: 9 additions & 1 deletion datapack/data/kdx.kits/function/_get.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
scoreboard players add @s kdx.kits.record 200
execute at @s run playsound block.amethyst_block.chime master @s ~ ~ ~ 1.0 1.0 0
execute at @s run playsound minecraft:block.anvil.use master @s ~ ~ ~ 1.0 1.0
effect give @s minecraft:slowness 1 126 true
setblock ~ ~1 ~ minecraft:chest replace
data modify block ~ ~1 ~ Items set from storage kdx.kits:chest items
fill ~-1 ~ ~-1 ~1 ~2 ~1 minecraft:barrier keep
tag @s add kdx.kits.process
effect give @s minecraft:resistance 1 4 true
summon minecraft:tnt ~ ~1 ~ {Silent:true,fuse:0,NoGravity:true}
schedule function kdx.kits:afterward 2t append
tellraw @s [{"text":"✓ 你收到了一个礼包!","color":"gold"}]
6 changes: 3 additions & 3 deletions datapack/data/kdx.kits/function/_help.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tellraw @s [\
"action":"suggest_command",\
"value":"/function kdx.kits:_set"}\
},{\
"text":"zreset_WARNING 重置所有玩家的领取记录\n",\
"text":"zreset_warning 重置所有玩家的领取记录\n",\
"color":"white",\
"clickEvent":{\
"action":"suggest_command",\
Expand All @@ -33,7 +33,7 @@ tellraw @s [\
"action":"suggest_command",\
"value":"/function kdx.kits:_reset"}\
},{\
"text":"\n礼包的添加方法是把东西拿在手上并执行_set函数",\
"color":"white"
"text":"\n礼包的添加方法是把东西放在脚下的箱子里并执行_set函数",\
"color":"white"\
}\
]
3 changes: 3 additions & 0 deletions datapack/data/kdx.kits/function/_set.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data modify storage kdx.kits:chest items set from block ~ ~ ~ Items
execute if block ~ ~ ~ minecraft:chest run tellraw @s [{"text":"已设置礼包","color":"green"}]
execute unless block ~ ~ ~ minecraft:chest run tellraw @s [{"text":"无法设置礼包:您必须站在一个箱子上","color":"red"}]
3 changes: 3 additions & 0 deletions datapack/data/kdx.kits/function/afterward.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
execute at @a[tag=kdx.kits.process] run kill @e[type=item,nbt={Item:{id:"minecraft:chest"}},limit=1,sort=nearest,nbt=!{Item:{components:{}}}]
execute at @a[tag=kdx.kits.process] run fill ~-2 ~ ~-2 ~2 ~2 ~2 minecraft:air replace minecraft:barrier
execute as @a[tag=kdx.kits.process] run tag @s remove kdx.kits.process
2 changes: 1 addition & 1 deletion datapack/data/kdx.kits/function/on_load.mcfunction
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scoreboard objectives add kdx.kits.record dummy "礼包领取记录"
scoreboard objectives add kdx.kits.record dummy "礼包领取记录"
1 change: 1 addition & 0 deletions datapack/data/kdx.kits/function/on_tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
advancement revoke @a only kdx.kits:trigger requirement
31 changes: 30 additions & 1 deletion datapack/data/kdx.kits/function/trigger.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# 此trigger由同名进度控制
# 触发条件:玩家不着火、没有位移、着陆,每秒触发一次
execute unless score @s kdx.kits.record >= 200 run function kdx.kits:_get
execute at @s \
if block ~-1 ~ ~-1 air \
if block ~-1 ~ ~ air \
if block ~-1 ~ ~1 air \
if block ~ ~ ~-1 air \
if block ~ ~ ~ air \
if block ~ ~ ~1 air \
if block ~1 ~ ~-1 air \
if block ~1 ~ ~ air \
if block ~1 ~ ~1 air \
if block ~-1 ~1 ~1 air \
if block ~-1 ~1 ~ air \
if block ~-1 ~1 ~1 air \
if block ~ ~1 ~ air \
if block ~ ~1 ~ air \
if block ~ ~1 ~ air \
if block ~1 ~1 ~-1 air \
if block ~1 ~1 ~ air \
if block ~1 ~1 ~1 air \
if block ~-1 ~2 ~-1 air \
if block ~-1 ~2 ~ air \
if block ~-1 ~2 ~1 air \
if block ~ ~2 ~-1 air \
if block ~ ~2 ~ air \
if block ~ ~2 ~1 air \
if block ~1 ~2 ~-1 air \
if block ~1 ~2 ~ air \
if block ~1 ~2 ~1 air \
unless score @s kdx.kits.record >= "kdx.state.ok" kdx \
run function kdx.kits:_get
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
scoreboard objectives remove kdx.kits.record
scoreboard objectives add kdx.kits.record dummy "礼包领取记录"
tellraw @s [{"text":"已重置礼包领取记录","color":"green"}]
tellraw @s {"text":"已重置礼包领取记录","color":"green"}
1 change: 1 addition & 0 deletions datapack/data/kdx/function/on_tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function kdx.kits:on_tick
3 changes: 2 additions & 1 deletion datapack/data/kdx/function/system/initialize.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function kdx:system/carpet_auto_setting

scoreboard objectives add kdx dummy "KDX.BASENUM"
scoreboard players set "kdx.state.ok" kdx 200
data modify storage kdx:initialized status set value 1b
tellraw @a [{"text":"kdxSMP Service Datapack ","color":"aqua"},{"text":" 已完成初始化 ✓\n","color":"green"}]
4 changes: 2 additions & 2 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: "致力于解决您所想知道的一切"
---
<small id="old_menu"><a href="/kdxSMP/">首页</a> | <a href="/kdxSMP/doc/">文档</a></small><br><small><a href="/kdxSMP/doc/">←返回</a></small><br>

## 连接到服务器 {connect}
## 连接到服务器 ${connect}
* [如何连接到服务器](./connect/how)
* [无法连接到服务器的一般解决方案](./connect/solution)

## 账户安全 {safe}
## 账户安全 ${safe}
* [使用EasyAuth保护您的离线账户](./safe/ea)
* [将Bedrock账户绑定至Java版账户](./safe/linkaccount)

Expand Down

0 comments on commit 8f88771

Please sign in to comment.