Creating and Using Boss Bars [Minecraft Command Tutorial]

Опубликовано: 20 Август 2026
на канале: 포마인
39,505
372

I haven't tried it myself, but creating a health bar and a timer at the same time probably won't work.

If you want to create them simultaneously, please create a new boss bar with a different ID.

[Create Boss Bar]
/bossbar add boss "Boss"

[Make Boss Bar Visible]
/bossbar set minecraft:boss players @a

[Summon Entity (Husk)]
/summon minecraft:husk ~ ~ ~ {Tags:["boss"]}

[Set Boss Bar Value to Health]
/execute store result bossbar minecraft:boss max run data get entity @e[tag=boss,limit=1] Health

[Display Health in Boss Bar]
(Repeated)
execute store result bossbar minecraft:boss value run data get entity @e[tag=boss,limit=1] Health

[Hide Boss Bar when Entity Dies]
(Repeated)
bossbar set minecraft:boss visible false

(Chained)
execute store result bossbar minecraft:boss value run data get entity @e[tag=boss,limit=1] Health

(Conditional Chain)
bossbar set minecraft:boss visible true

[Create a Timer Scoreboard]
/scoreboard objectives add bosstime dummy

[Create a Timer Armor Stand]
/summon minecraft:armor_stand ~ ~ ~ {Tags:["boss"]}

[Set a Timer Value]
(Reactive)
scoreboard players set @e[tag=boss] bosstime number

(Chain)
execute store result bossbar minecraft:boss max run scoreboard players get @e[tag=boss,limit=1] bosstime

[Trigger a Timer]
(Repeated)
scoreboard players remove @e[tag=boss,scores={bosstime=1..}] bosstime 1

(Chain)
execute store result bossbar minecraft:boss value run scoreboard players get @e[tag=boss,limit=1] bosstime

※Bonus※
[Change the boss bar number and display the timer expiration message (attach it after the command directly above)]
(Chain)
bossbar set minecraft:boss name [{"text":"Time remaining: "},{"score":{"name":"@e[tag=boss,limit=1]","objective":"bosstime"}}]

(Chain)
execute as @e[tag=boss,scores={bosstime=0}] run bossbar set minecraft:boss name "Timer expiration"