enchanted_apple.mcfunction 1.5 KB

1234567891011121314151617181920
  1. # 去除进度
  2. advancement revoke @s only item:special/consume_enchanted_apple
  3. # 计算生命值
  4. execute if score @s mini_heart matches 1.. run scoreboard players operation @s mini_heart += @s mini_heart
  5. execute if score @s mini_heart matches 1.. run function mini:main/player_max_health
  6. execute if score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 食用了附魔生命果, 生命加倍!"]
  7. # 无生命计数:恢复生命
  8. execute unless score @s mini_heart matches 1.. run effect give @s instant_health 1 10 true
  9. execute unless score @s mini_heart matches 1.. run tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"aqua"}," 食用了附魔生命果, 生命恢复到满血!"]
  10. # 归还苹果
  11. #execute unless score @s mini_heart matches 1.. run tellraw @s ["",{"text": ">> ","color":"aqua","bold": true},{"text":"你只能在存在生命计数的小游戏中食用生命果!","color":"aqua"}]
  12. #execute unless score @s mini_heart matches 1.. run give @s minecraft:enchanted_golden_apple{display:{Name:'{"text":"附魔生命果","italic":false}',Lore:['{"text":"恢复到满血或生命加倍","italic":false,"color":"gray"}']},bonus_new:0b,bonus_return:1b,is_bonus:1b,item_name:'{"text":"附魔生命果","color":"aqua"}'}
  13. # $remove_resistance 信息在小游戏初始化时提供
  14. # 去除buff
  15. execute run tag @s add consume_apple
  16. schedule function item:special/clear_effect 1t replace