Put a health bar over your own boss fight
A boss bar is the bar at the top of the screen that the Wither and the Ender Dragon use. With commands you can make your own for a custom boss, a raid on your server or a parkour timer.
- Type the text in Text on the bar and pick a Bar color and a Bar style. The preview shows the top of the screen as the game draws it.
- Set Max to the boss's full health and Value to how much it has now. A value of 150 out of 300 fills half the bar.
- Choose Who sees it, press Copy and run the commands in a Java world with cheats on.
The bar stays in the world until you delete it, even after a server restart. Settings that match the game's defaults, such as a white bar or a max of 100, are skipped so you have fewer lines to paste.
Update the bar during a fight or countdown
Under Change it later, four ready-made commands let you update the bar after it is created:
- Set the value moves the fill to a new number as a timer counts down or a round progresses.
- Rename it swaps the text on top, handy when a boss enters phase two.
- Hide it for now keeps the bar and its value saved while taking it off the screen, and Delete it removes it for good when the fight ends.
For a custom mob boss in a command block arena, you can also copy the mob's health straight into the bar with /execute store result bossbar minecraft:boss_fight value run data get entity @e[tag=boss,limit=1] Health in a repeating command block.
Show it only to players nearby
Pick Players close by and set how many blocks away. The distance counts from where the command runs, so place the command block in the boss arena. The list of players only updates when the command runs again, so use a repeating command block if players walk in and out. Bossbars are Java only. On Bedrock, a title or action bar is the closest way to show a message on screen.