- 37,463 views, 8 today
- 0 downloads, 0 today
89
Hi gang!
Editorial
The latest snapshot (18w05a) got released today and I'm really excited about this one because we finally get vanilla access to bossbars. You know: those things you get to see when you're fighting (mini) bosses such as the Ender dragon or the wither. Until now your best shot was to either summon a (renamed) boss somewhere underground (while making sure it was invulnerable so it wouldn't die) and then somehow continue to update/change its health in order to get a somewhat usable bossbar.
Another option is of course to use plugins, but we're not going to address those here.
But with the release of 1.13 we have a much better option for this: the /bossbar command!
Step 1 - Creating a bossbar
In order to use a bossbar you first need to create it. You'll need to define an id and a name. The id is basically the same as any other in Minecraft; consisting of a namespace and an actual name. The name of the bossbar should be a string ("JSON object") which contains the name as it will be displayed on screen.
So to make the two bossbars as shown in the blog profile picture I used:
Here I used /data get entity ShelLuser and I marked the section which is interesting for us: my health. By default /data will display everything but you can limit the output to a single property. So: /data get entity ShelLuser Health.
However, this also creates a bit of a problem. The maximum health value of a player is 20. But a bossbar has a maximum value of 100 by default. But fortunately we can change this, so the next step is to make the bossbar actually usable for displaying a players health:
Next I wanted to make the bossbars easier to recognize, so I'm using different colors for both Aya and myself. I used blue, Aya insisted on using pink. Easily done:
So how to build an arena... Ok, that's bad pun :)
Back to the bossbars! A bossbar isn't automatically visible to all players, you need to set that up yourself. This allows you to customize it in any way you want. For example I could set it up so that Aya only gets to see her own health and I get to see both hers and my own (no, I'm not trying to cheat, whatever gave you that idea? :)).
This can be extremely useful if you're setting up a boss fight of your own. You could set it up so that only players within a certain range of the boss get to see its bossbar while everyone outside that area sees nothing. In our example above I simply set it up so that both Aya and myself could both see the bossbars. Easily done:
Now we pretty much have everything in place. But there's one last thing missing. How do we get the players health value into the bossbar?
Fortunately Mojang also thought about that. We can use the /execute command to run a command and then store its output value somewhere else. Somewhere like a bossbar for example. We already discovered how to get a players health, so all we have to do now is actually store it:
To make this easier on us I set up these command blocks which do everything for setting up the fight. First it switches both Aya and myself from Creative into Adventure mode (to prevent us from accidentally destroying the arena). Next it clears out our inventories and gives us one diamond sword and it also sets the bossbars to visible. And finally, the repeating block on the left (and the chain command block behind it) continues to /execute the store commands I mentioned above, but only if it gets a redstone signal.
When turned off the opposite happens: the repeating command block will stop updating the bossbars, the bossbars are set invisible and both Aya and myself are switched back to Creative mode.
Now, using bossbars for players is fun and all but as some of you reminded me: it's called a bossbar for a reason. So let's set up a bossfight with the one and only Herobrine! And all you need is 4 command blocks.
But let's take this one step at a time. Here I have summoned a zombie which has a lot of special properties:
execute unless entity @e[tag=miniboss] run summon minecraft:zombie ~ ~1 ~ {CustomName:"{\"text\":\"Herobrine\",\"color\":\"white\",\"bold\":\"true\",\"italic\":\"true\"}",CustomNameVisible:1,CanBreakDoors:1,CanPickUpLoot:1,PersistenceRequired:1,Tags:["miniboss"],DeathLootTable:"entities/zombie_pigman",Attributes:[{Name:"generic.maxHealth",Base:80b},{Name:"generic.attackDamage",Base:8d},{Name:"generic.movementSpeed",Base:1.50d},{Base:50.0d,Modifiers:{UUIDMost:-1572945825646885237L,UUIDLeast:-5038956045173896349L,Operation:1}],Name: "generic.followRange"}],Health:80f,ArmorItems:[{},{},{},{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:"Herobrine"}}]}
This is also a demonstration of the 1.13 command improvements: the command to summon Herobrine is only executed as long as there isn't already one around. But as said: I won't be explaining this command in too much detail, you do the math :)
#1: Repeating unconditional command block
execute if entity @e[tag=miniboss] store result bossbar herobrine value run data get entity @e[tag=miniboss,limit=1] Health
This command block will only run if the system actually detects an entity with the tag miniboss. This helps us to reduce the load on the system a bit because the system will only need to check if the entity exists. It doesn't have to try and get any properties nor does it have to continue updating the bossbar all the time.
#2: Chain conditional command block
execute as @e[tag=miniboss] at @s run bossbar set herobrine players @a[distance=..50]
This command makes sure that if we come within a 50 blocks range of Herobrine then we'll immediately get to see the bossbar. But there's more: because this command gets repeated all the time it will also ensure that if you move out of range then the bossbar will disappear.
#3: Chain unconditional command block
execute unless entity @e[tag=miniboss] run bossbar set herobrine players
This will run the bossbar command under the condition that there is no entity around which has the miniboss tag. The effect is that the bossbar will disappear for all players as soon as the boss has been defeated.
Getting your own Herobrine
In case you're interested in fighting with Herobrine but you don't want to bother with all these difficult commands then you don't have to: you can download my Herobrine datapack and use that instead :)
And there you have it!
How to set up the bossbars in Minecraft 1.13 (well, basically snapshot 18w05a at the time of writing) and how to actually use them for a real bossfight.
Hope you enjoyed this, thanks for reading!
Editorial
The latest snapshot (18w05a) got released today and I'm really excited about this one because we finally get vanilla access to bossbars. You know: those things you get to see when you're fighting (mini) bosses such as the Ender dragon or the wither. Until now your best shot was to either summon a (renamed) boss somewhere underground (while making sure it was invulnerable so it wouldn't die) and then somehow continue to update/change its health in order to get a somewhat usable bossbar.
Another option is of course to use plugins, but we're not going to address those here.
But with the release of 1.13 we have a much better option for this: the /bossbar command!
Step 1 - Creating a bossbar
In order to use a bossbar you first need to create it. You'll need to define an id and a name. The id is basically the same as any other in Minecraft; consisting of a namespace and an actual name. The name of the bossbar should be a string ("JSON object") which contains the name as it will be displayed on screen.So to make the two bossbars as shown in the blog profile picture I used:
- /bossbar create catslair:aya "AyaWarrior"
- /bossbar create catslair:shell "ShellShocker"
Step 2 - Setting up the bossbar properties
Now that we have a bossbar we'll need to set it up to make it actually usable. In my example we're going to use the bossbar to display the health of the players. So the first step is to check a players health value. How to do that? Using the new /data command:Here I used /data get entity ShelLuser and I marked the section which is interesting for us: my health. By default /data will display everything but you can limit the output to a single property. So: /data get entity ShelLuser Health.
However, this also creates a bit of a problem. The maximum health value of a player is 20. But a bossbar has a maximum value of 100 by default. But fortunately we can change this, so the next step is to make the bossbar actually usable for displaying a players health:
- /bossbar set catslair:aya max 20
- /bossbar set catslair:shell max 20
Next I wanted to make the bossbars easier to recognize, so I'm using different colors for both Aya and myself. I used blue, Aya insisted on using pink. Easily done:
- /bossbar set catslair:aya color pink
- /bossbar set catslair:shell color blue
Step 3 - Actually using the bossbar(s)
You'll need an arena in order to PVP, right? ;)
So how to build an arena... Ok, that's bad pun :)
Back to the bossbars! A bossbar isn't automatically visible to all players, you need to set that up yourself. This allows you to customize it in any way you want. For example I could set it up so that Aya only gets to see her own health and I get to see both hers and my own (no, I'm not trying to cheat, whatever gave you that idea? :)).
This can be extremely useful if you're setting up a boss fight of your own. You could set it up so that only players within a certain range of the boss get to see its bossbar while everyone outside that area sees nothing. In our example above I simply set it up so that both Aya and myself could both see the bossbars. Easily done:
- /bossbar set catslair:aya players @a[distance=..20]
- /bossbar set catslair:shell players @a[distance=..20]
Now we pretty much have everything in place. But there's one last thing missing. How do we get the players health value into the bossbar?
Fortunately Mojang also thought about that. We can use the /execute command to run a command and then store its output value somewhere else. Somewhere like a bossbar for example. We already discovered how to get a players health, so all we have to do now is actually store it:
- /execute store result bossbar catslair:aya value run data get entity AyanamiKun Health
- /execute store result bossbar catslair:shell value run data get entity ShelLuser Heath
Everything gets setup with these command blocks, the repeating on the left updates our bossbars
To make this easier on us I set up these command blocks which do everything for setting up the fight. First it switches both Aya and myself from Creative into Adventure mode (to prevent us from accidentally destroying the arena). Next it clears out our inventories and gives us one diamond sword and it also sets the bossbars to visible. And finally, the repeating block on the left (and the chain command block behind it) continues to /execute the store commands I mentioned above, but only if it gets a redstone signal.
When turned off the opposite happens: the repeating command block will stop updating the bossbars, the bossbars are set invisible and both Aya and myself are switched back to Creative mode.
Bonus: Setting up a real bossfight!
Who said Herobrine wasn't real? ;)
Now, using bossbars for players is fun and all but as some of you reminded me: it's called a bossbar for a reason. So let's set up a bossfight with the one and only Herobrine! And all you need is 4 command blocks.
Step one - Setting up the boss
Now, I'm not going to pay too much attention to this section (this blog is about bossbars afterall) but I do want to stress out that if you want to learn more about mobs and their properties then /data will become an invaluable command to you. It's only thanks to /data (and not the Minecraft wiki for a change) that I managed to set up the increased follow range for example.But let's take this one step at a time. Here I have summoned a zombie which has a lot of special properties:
- It can break through doors no matter what.
- It picks up loot and uses it.
- It doesn't despawn.
- It wears a player head ("Herobrine") which also prevents it from catching fire.
- It runs about 8 times faster than a normal zombie (1.5 vs. the normal 0.23).
- It follows players up to a range of 50 blocks (this is normally 35).
- It has an increased attack damage (8 vs. 3, so it does 1.5 times more damage).
- It has four times the amount of health as a normal zombie (80 vs. the normal value of 20).
- And finally: it drops the same items as a zombie pigman (so you may win a gold nugget, lucky you! (of course Herobrine is trolling you!)).
execute unless entity @e[tag=miniboss] run summon minecraft:zombie ~ ~1 ~ {CustomName:"{\"text\":\"Herobrine\",\"color\":\"white\",\"bold\":\"true\",\"italic\":\"true\"}",CustomNameVisible:1,CanBreakDoors:1,CanPickUpLoot:1,PersistenceRequired:1,Tags:["miniboss"],DeathLootTable:"entities/zombie_pigman",Attributes:[{Name:"generic.maxHealth",Base:80b},{Name:"generic.attackDamage",Base:8d},{Name:"generic.movementSpeed",Base:1.50d},{Base:50.0d,Modifiers:{UUIDMost:-1572945825646885237L,UUIDLeast:-5038956045173896349L,Operation:1}],Name: "generic.followRange"}],Health:80f,ArmorItems:[{},{},{},{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:"Herobrine"}}]}
This is also a demonstration of the 1.13 command improvements: the command to summon Herobrine is only executed as long as there isn't already one around. But as said: I won't be explaining this command in too much detail, you do the math :)
Step two - Setting up the bossbar
Basically the same as above, only this time I'm going to make it easier on myself and use the default namespace. So:- /bossbar create herobrine {"text":"Herobrine","color":"dark_red"}
- /bossbar set herobrine color green
- /bossbar set herobrine max 80
Step three - Setting up the automated updates
You're going to need three command blocks (as shown in the screenshot above).#1: Repeating unconditional command block
execute if entity @e[tag=miniboss] store result bossbar herobrine value run data get entity @e[tag=miniboss,limit=1] Health
This command block will only run if the system actually detects an entity with the tag miniboss. This helps us to reduce the load on the system a bit because the system will only need to check if the entity exists. It doesn't have to try and get any properties nor does it have to continue updating the bossbar all the time.
#2: Chain conditional command block
execute as @e[tag=miniboss] at @s run bossbar set herobrine players @a[distance=..50]
This command makes sure that if we come within a 50 blocks range of Herobrine then we'll immediately get to see the bossbar. But there's more: because this command gets repeated all the time it will also ensure that if you move out of range then the bossbar will disappear.
When you move 50 blocks away then the bossbar will become invisible to you.
#3: Chain unconditional command block
execute unless entity @e[tag=miniboss] run bossbar set herobrine players
This will run the bossbar command under the condition that there is no entity around which has the miniboss tag. The effect is that the bossbar will disappear for all players as soon as the boss has been defeated.
Getting your own Herobrine
In case you're interested in fighting with Herobrine but you don't want to bother with all these difficult commands then you don't have to: you can download my Herobrine datapack and use that instead :)
And there you have it!
How to set up the bossbars in Minecraft 1.13 (well, basically snapshot 18w05a at the time of writing) and how to actually use them for a real bossfight.
Hope you enjoyed this, thanks for reading!
Credit | AyanamiKun (helped with the arena & demonstration), Herobrine (I used his head). |
Compatibility | Minecraft 1.13 |
Tags |
2 Update Logs
Update #2 : by ShelLuser 10/16/2018 8:14:12 amOct 16th, 2018
The blog is now fully "1.13 compliant".
- Removed the warning about the blog describing a snapshot feature; 1.13 has been released a long time ago.
- Added a reference to my Herobrine datapack; you don't have to mess with commands to fight Herobrine.
- Fixed a few minor typoes.
LOAD MORE LOGS
tools/tracking
4081380
119
setting-up-a-bossbar-in-minecraft-1-13
Create an account or sign in to comment.
There Should Be Bedrock Armor And Herobrine First To Summon
Is there a way to create an effect once the boss dies? I know this isn't entirely related to the bossbar command but it might be....? Like is there a way to detect when the bossbar hits 0 to create an effect or anything?
What I would do is set up a repeating command block (perhaps triggered by a redstone torch, so that you can turn it off somehow?) and make it check for the disappearance of the boss.
See my #3 above: "execute unless....", then do your stuff behind it. Make sure that you add checks (either use a tag or as mentioned maybe a redstone torch) so that this whole thing runs only once.
Hope this can give you some ideas...
I think u need to edit this thing again!
I'm a basic commander...basic!!