refresh_gold.mcfunction 1.1 KB

1234567891011121314151617181920212223242526
  1. # 刷新单个玩家背包中的金粒
  2. execute unless entity @s[scores={gold=0..}] run scoreboard players set @s gold 0
  3. clear @s gold_block
  4. clear @s gold_ingot
  5. clear @s gold_nugget
  6. # 获取金块数,存于 temp
  7. scoreboard players operation @s temp = @s gold
  8. scoreboard players operation @s temp /= #const_81 mem
  9. # 给予金块
  10. tellraw @s [{"score": {"name":"@s","objective": "temp"}}]
  11. execute if score @s temp matches 1.. at @s run function item:shop/summon_block
  12. # 获取金锭数,存于 temp
  13. scoreboard players operation @s temp = @s gold
  14. scoreboard players operation @s temp %= #const_81 mem
  15. scoreboard players operation @s temp /= #const_9 mem
  16. # 给予金锭
  17. tellraw @s [{"score": {"name":"@s","objective": "temp"}}]
  18. execute if score @s temp matches 1.. at @s run function item:shop/summon_gold
  19. # 获取金粒数,存于 temp
  20. scoreboard players operation @s temp = @s gold
  21. scoreboard players operation @s temp %= #const_9 mem
  22. tellraw @s [{"score": {"name":"@s","objective": "temp"}}]
  23. # 给予金粒
  24. execute if score @s temp matches 1.. at @s run function item:shop/summon_nugget