refresh_gold.mcfunction 916 B

1234567891011121314151617181920212223
  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. execute if score @s temp matches 1.. at @s run function item:shop/summon_block
  11. # 获取金锭数,存于 temp
  12. scoreboard players operation @s temp = @s gold
  13. scoreboard players operation @s temp %= #const_81 mem
  14. scoreboard players operation @s temp /= #const_9 mem
  15. # 给予金锭
  16. execute if score @s temp matches 1.. at @s run function item:shop/summon_gold
  17. # 获取金粒数,存于 temp
  18. scoreboard players operation @s temp = @s gold
  19. scoreboard players operation @s temp %= #const_9 mem
  20. # 给予金粒
  21. execute if score @s temp matches 1.. at @s run function item:shop/summon_nugget