From 8f88771441be789b9c4b290c191f6943aef5c17f Mon Sep 17 00:00:00 2001 From: kdxiaoyi Date: Sat, 11 Jan 2025 19:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0datapack=E7=9A=84kdx.kits?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/kdx.kits/advancement/trigger.json | 6 ++-- .../data/kdx.kits/function/_get.mcfunction | 10 +++++- .../data/kdx.kits/function/_help.mcfunction | 6 ++-- .../data/kdx.kits/function/_set.mcfunction | 3 ++ .../kdx.kits/function/afterward.mcfunction | 3 ++ .../data/kdx.kits/function/on_load.mcfunction | 2 +- .../data/kdx.kits/function/on_tick.mcfunction | 1 + .../data/kdx.kits/function/trigger.mcfunction | 31 ++++++++++++++++++- ...on => zreset_warning_confirmed.mcfunction} | 2 +- datapack/data/kdx/function/on_tick.mcfunction | 1 + .../kdx/function/system/initialize.mcfunction | 3 +- doc/index.md | 4 +-- 12 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 datapack/data/kdx.kits/function/afterward.mcfunction create mode 100644 datapack/data/kdx.kits/function/on_tick.mcfunction rename datapack/data/kdx.kits/function/{zreset_WARNING.mcfunction => zreset_warning_confirmed.mcfunction} (62%) diff --git a/datapack/data/kdx.kits/advancement/trigger.json b/datapack/data/kdx.kits/advancement/trigger.json index 90b2d63..4d1ac4a 100644 --- a/datapack/data/kdx.kits/advancement/trigger.json +++ b/datapack/data/kdx.kits/advancement/trigger.json @@ -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, diff --git a/datapack/data/kdx.kits/function/_get.mcfunction b/datapack/data/kdx.kits/function/_get.mcfunction index a31ae55..2fbb159 100644 --- a/datapack/data/kdx.kits/function/_get.mcfunction +++ b/datapack/data/kdx.kits/function/_get.mcfunction @@ -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"}] \ No newline at end of file diff --git a/datapack/data/kdx.kits/function/_help.mcfunction b/datapack/data/kdx.kits/function/_help.mcfunction index b3db88b..93b16c9 100644 --- a/datapack/data/kdx.kits/function/_help.mcfunction +++ b/datapack/data/kdx.kits/function/_help.mcfunction @@ -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",\ @@ -33,7 +33,7 @@ tellraw @s [\ "action":"suggest_command",\ "value":"/function kdx.kits:_reset"}\ },{\ - "text":"\n礼包的添加方法是把东西拿在手上并执行_set函数",\ - "color":"white" + "text":"\n礼包的添加方法是把东西放在脚下的箱子里并执行_set函数",\ + "color":"white"\ }\ ] \ No newline at end of file diff --git a/datapack/data/kdx.kits/function/_set.mcfunction b/datapack/data/kdx.kits/function/_set.mcfunction index e69de29..2c8d227 100644 --- a/datapack/data/kdx.kits/function/_set.mcfunction +++ b/datapack/data/kdx.kits/function/_set.mcfunction @@ -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"}] \ No newline at end of file diff --git a/datapack/data/kdx.kits/function/afterward.mcfunction b/datapack/data/kdx.kits/function/afterward.mcfunction new file mode 100644 index 0000000..9eaba44 --- /dev/null +++ b/datapack/data/kdx.kits/function/afterward.mcfunction @@ -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 \ No newline at end of file diff --git a/datapack/data/kdx.kits/function/on_load.mcfunction b/datapack/data/kdx.kits/function/on_load.mcfunction index 740301f..05406d3 100644 --- a/datapack/data/kdx.kits/function/on_load.mcfunction +++ b/datapack/data/kdx.kits/function/on_load.mcfunction @@ -1 +1 @@ -scoreboard objectives add kdx.kits.record dummy "礼包领取记录" \ No newline at end of file +scoreboard objectives add kdx.kits.record dummy "礼包领取记录" diff --git a/datapack/data/kdx.kits/function/on_tick.mcfunction b/datapack/data/kdx.kits/function/on_tick.mcfunction new file mode 100644 index 0000000..314f146 --- /dev/null +++ b/datapack/data/kdx.kits/function/on_tick.mcfunction @@ -0,0 +1 @@ +advancement revoke @a only kdx.kits:trigger requirement \ No newline at end of file diff --git a/datapack/data/kdx.kits/function/trigger.mcfunction b/datapack/data/kdx.kits/function/trigger.mcfunction index a1eb1ce..5b5bb81 100644 --- a/datapack/data/kdx.kits/function/trigger.mcfunction +++ b/datapack/data/kdx.kits/function/trigger.mcfunction @@ -1,3 +1,32 @@ # 此trigger由同名进度控制 # 触发条件:玩家不着火、没有位移、着陆,每秒触发一次 -execute unless score @s kdx.kits.record >= 200 run function kdx.kits:_get \ No newline at end of file +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 \ No newline at end of file diff --git a/datapack/data/kdx.kits/function/zreset_WARNING.mcfunction b/datapack/data/kdx.kits/function/zreset_warning_confirmed.mcfunction similarity index 62% rename from datapack/data/kdx.kits/function/zreset_WARNING.mcfunction rename to datapack/data/kdx.kits/function/zreset_warning_confirmed.mcfunction index 1a55915..8bfa79e 100644 --- a/datapack/data/kdx.kits/function/zreset_WARNING.mcfunction +++ b/datapack/data/kdx.kits/function/zreset_warning_confirmed.mcfunction @@ -1,3 +1,3 @@ scoreboard objectives remove kdx.kits.record scoreboard objectives add kdx.kits.record dummy "礼包领取记录" -tellraw @s [{"text":"已重置礼包领取记录","color":"green"}] \ No newline at end of file +tellraw @s {"text":"已重置礼包领取记录","color":"green"} \ No newline at end of file diff --git a/datapack/data/kdx/function/on_tick.mcfunction b/datapack/data/kdx/function/on_tick.mcfunction index e69de29..8f59ec5 100644 --- a/datapack/data/kdx/function/on_tick.mcfunction +++ b/datapack/data/kdx/function/on_tick.mcfunction @@ -0,0 +1 @@ +function kdx.kits:on_tick \ No newline at end of file diff --git a/datapack/data/kdx/function/system/initialize.mcfunction b/datapack/data/kdx/function/system/initialize.mcfunction index d93bd2a..3e31e89 100644 --- a/datapack/data/kdx/function/system/initialize.mcfunction +++ b/datapack/data/kdx/function/system/initialize.mcfunction @@ -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"}] \ No newline at end of file diff --git a/doc/index.md b/doc/index.md index d32a7f8..8dd673d 100644 --- a/doc/index.md +++ b/doc/index.md @@ -4,11 +4,11 @@ description: "致力于解决您所想知道的一切" --- 首页 | 文档
←返回
-## 连接到服务器 {connect} +## 连接到服务器 ${connect} * [如何连接到服务器](./connect/how) * [无法连接到服务器的一般解决方案](./connect/solution) -## 账户安全 {safe} +## 账户安全 ${safe} * [使用EasyAuth保护您的离线账户](./safe/ea) * [将Bedrock账户绑定至Java版账户](./safe/linkaccount)