player_death.mcfunction 921 B

123456789101112131415161718192021
  1. # 执行重生方法
  2. function mini:diamond/game/respawn1
  3. # 复活特效
  4. execute as @a at @s run function lib:sounds/error
  5. effect give @s blindness 3 5 true
  6. # 处理玩家掉落物品
  7. execute at @s as @e[type=item,distance=..100] store result score @s temp run data get entity @s Age
  8. execute at @s store result score #total_drop temp run tag @e[type=item,scores={temp=..3}] add death_drop
  9. scoreboard players reset @e[type=item] temp
  10. # 单独处理钻石还没写
  11. function mini:diamond/game/drop_diamond
  12. # 掉落数量向上取整
  13. scoreboard players add #total_drop temp 1
  14. scoreboard players operation #total_drop temp /= #const_2 mem
  15. execute if score #total_drop temp matches 1.. run function mini:diamond/game/item_drop
  16. # 其余物品丢回背包
  17. tag @s add dead_player
  18. execute as @e[type=item,tag=death_drop] run data modify entity @s Thrower set from entity @a[tag=dead_player,limit=1] UUID
  19. tag @s remove dead_player