LTCatt 6 лет назад
Родитель
Сommit
23e00e8694

+ 0 - 12
data/item/functions/bonus_item.mcfunction

@@ -1,12 +0,0 @@
-# 检查玩家拾取的奖励物品并进行处理
-
-setblock 8 12 2009 jukebox
-data modify block 8 12 2009 RecordItem set from entity @s Inventory[{"tag":{"bonus_new":1b}}]
-tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"yellow"},{"text":"获得了 "},{"nbt": "RecordItem.tag.bonus_name","block": "8 12 2009","interpret": true}]
-data modify block 8 12 2009 RecordItem.tag.bonus_new set value 0b
-clear @s #item:items{"bonus_new":1b}
-fill 8 12 2009 8 12 2009 air destroy
-tag @s add bonus_op
-execute as @e[tag=!bonus_old,type=minecraft:item,nbt={"Item":{"tag":{"bonus":1b}}},limit=1] run function item:bonus_item_give
-tag @s remove bonus_op
-# TODO : [010] 将坐标迁移到主大厅

+ 15 - 0
data/item/functions/bonus_item/call.mcfunction

@@ -0,0 +1,15 @@
+# 当玩家拾取到奖励物品时触发
+# as player
+
+# 将玩家拾取到的原物品替换到原点的唱片机里
+setblock 0 0 0 jukebox replace
+data modify block 0 0 0 RecordItem set from entity @s Inventory[{"tag":{"bonus_new":1b}}]
+clear @s #item:bonus{"bonus_new":1b}
+
+# 通知玩家物品被拾取
+tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"yellow"},{"text":"获得了 "},{"nbt": "RecordItem.tag.item_name","block": "0 0 0","interpret": true}]
+
+# 如果有 return 标签则退回物品
+execute if data block 0 0 0 RecordItem.tag{"bonus_return":1b} run function item:bonus_item/return_item
+
+# TODO : [010] 通过判断 RecordItem.tag 里的自定义标签来决定捡起道具之后的事情(如增加积分)

+ 5 - 0
data/item/functions/bonus_item/return_item.mcfunction

@@ -0,0 +1,5 @@
+data modify block 0 0 0 RecordItem.tag.bonus_new set value 0b
+fill 0 0 0 0 0 0 air destroy
+tag @s add item_op
+execute as @e[tag=!bonus_old,type=item,nbt={"Item":{"tag":{"is_bonus":1b}}},limit=1] run function item:bonus_item/tp
+tag @s remove item_op

+ 4 - 0
data/item/functions/bonus_item/tp.mcfunction

@@ -0,0 +1,4 @@
+#as item
+tp @s @a[tag=item_op,limit=1]
+tag @s add bonus_old
+data modify entity @s PickupDelay set value 0

+ 0 - 3
data/item/functions/bonus_item_give.mcfunction

@@ -1,3 +0,0 @@
-tp @s @a[tag=bonus_op,limit=1]
-tag @s add bonus_old
-data modify entity @s PickupDelay set value 0

+ 0 - 1
data/item/functions/check_item/call.mcfunction

@@ -1 +0,0 @@
-execute as @a if data entity @s Inventory[{"tag":{"item_new":1b}}] run function item:check_item/run_cmd

+ 0 - 5
data/item/functions/check_item/return_item.mcfunction

@@ -1,5 +0,0 @@
-data modify block 0 0 0 RecordItem.tag.item_new set value 0b
-fill 0 0 0 0 0 0 air destroy
-tag @s add item_op
-execute as @e[tag=!item_old,type=minecraft:item,nbt={"Item":{"tag":{"item":1b}}},limit=1] run function item:check_item/tp
-tag @s remove item_op

+ 0 - 16
data/item/functions/check_item/run_cmd.mcfunction

@@ -1,16 +0,0 @@
-#as player
-#with forceload 0 0
-setblock 0 0 0 jukebox replace
-data modify block 0 0 0 RecordItem set from entity @s Inventory[{"tag":{"item_new":1b}}]
-#清除原物品
-clear @s #item:items{"item_new":1b}
-
-#通知玩家物品被拾取
-tellraw @a [{"selector": "@s"},{"text":"获得了道具:"},{"nbt": "RecordItem.tag.item_name","block": "0 0 0","interpret": true}]
-
-# TODO 通过判断RecordItem.tag里的自定义标签来决定捡起道具之后的事情(如增加积分)
-
-
-
-#如果有return标签则退回物品
-execute if data block 0 0 0 RecordItem.tag{"item_return":1b} run function item:check_item/return_item

+ 0 - 4
data/item/functions/check_item/tp.mcfunction

@@ -1,4 +0,0 @@
-#as item
-tp @s @a[tag=item_op,limit=1]
-tag @s add item_old
-data modify entity @s PickupDelay set value 0

+ 1 - 1
data/item/functions/test/get_test_item.mcfunction

@@ -1 +1 @@
-summon item ~ ~ ~ {Item:{id:"fishing_rod",Count:1,tag:{"bonus":1b,"bonus_new":1b,"bonus_return":1b,"bonus_name":'{"text":"破损的钓鱼竿","color":"green"}'}},CustomName:'{"text":"破损的钓鱼竿","color":"green"}',Tags:["team_green"],Age:-32768,PickupDelay:0,NoGravity:1,Invulnerable:1,CustomNameVisible:1,Glowing:1}
+summon item ~ ~ ~ {Item:{id:"fishing_rod",Count:1,tag:{"is_bonus":1b,"bonus_new":1b,"bonus_return":1b,"item_name":'{"text":"破损的钓鱼竿","color":"green"}'}},CustomName:'{"text":"破损的钓鱼竿","color":"green"}',Tags:["team_green"],Age:-32768,PickupDelay:0,NoGravity:1,Invulnerable:1,CustomNameVisible:1,Glowing:1}

+ 0 - 0
data/item/functions/tick1.mcfunction


+ 1 - 1
data/item/functions/tick2.mcfunction

@@ -3,4 +3,4 @@
 execute as @e[type=item] if data entity @s Thrower run function item:disable_throw
 
 # 检查玩家拾取奖励物品
-execute as @a if data entity @s Inventory[{"tag":{"bonus_new":1b}}] run function item:bonus_item
+execute as @a if data entity @s Inventory[{"tag":{"bonus_new":1b}}] run function item:bonus_item/call

+ 0 - 0
data/item/tags/items/items.json → data/item/tags/items/bonus.json


+ 0 - 1
data/ltw/functions/clock/tick1.mcfunction

@@ -1,5 +1,4 @@
 # 每 1 Tick 执行一次
 
 # 调用其他模块
-function item:tick1
 execute if score $state mem matches 5 run function ltw:state/5/tick1