refresh_gold.mcfunction 835 B

12345678910111213141516171819202122
  1. # 刷新单个玩家背包中的金粒
  2. clear @s gold_block
  3. clear @s gold_ingot
  4. clear @s gold_nugget
  5. # 获取金块数,存于 temp
  6. scoreboard players operation @s temp = @s gold
  7. scoreboard players operation @s temp /= #const_81 mem
  8. # 给予金锭
  9. execute if score @s temp matches 1.. at @s run function item:shop/summon_block
  10. # 获取金锭数,存于 temp
  11. scoreboard players operation @s temp = @s gold
  12. scoreboard players operation @s temp %= #const_81 mem
  13. scoreboard players operation @s temp /= #const_9 mem
  14. # 给予金锭
  15. execute if score @s temp matches 1.. at @s run function item:shop/summon_gold
  16. # 获取金粒数,存于 temp
  17. scoreboard players operation @s temp = @s gold
  18. scoreboard players operation @s temp %= #const_9 mem
  19. # 给予金粒
  20. execute if score @s temp matches 1.. at @s run function item:shop/summon_nugget