show.mcfunction 1.3 KB

1234567891011121314151617181920212223
  1. # 计算最大值
  2. scoreboard players operation #temp mem = $countdown_max mem
  3. execute if score $bossbar_type mem matches 2 run scoreboard players operation #temp mem *= #const_10 mem
  4. # 设置最大值
  5. execute store result bossbar mini:red max run scoreboard players get #temp mem
  6. execute store result bossbar mini:yellow max run scoreboard players get #temp mem
  7. execute store result bossbar mini:green max run scoreboard players get #temp mem
  8. execute store result bossbar mini:blue max run scoreboard players get #temp mem
  9. # 设置颜色
  10. execute if score $bossbar_color mem matches 0 run bossbar set mini:red players @a[scores={bossbar_color=1}]
  11. execute if score $bossbar_color mem matches 0 run bossbar set mini:yellow players @a[scores={bossbar_color=2}]
  12. execute if score $bossbar_color mem matches 0 run bossbar set mini:green players @a[scores={bossbar_color=3}]
  13. execute if score $bossbar_color mem matches 0 run bossbar set mini:blue players @a[scores={bossbar_color=4}]
  14. execute if score $bossbar_color mem matches 1 run bossbar set mini:red players @a
  15. execute if score $bossbar_color mem matches 2 run bossbar set mini:yellow players @a
  16. execute if score $bossbar_color mem matches 3 run bossbar set mini:green players @a
  17. execute if score $bossbar_color mem matches 4 run bossbar set mini:blue players @a
  18. # 立即刷新
  19. function lib:bossbar/tick2