Multibar - Skizzium/Project-Lib GitHub Wiki
Multibar is a new type of Boss Bar introduced in 1.0.0 Beta #5.
It was added mainly to be utilized by the Friendly Skizzik and by other Multi-Part entities.
Multibar is a Boss Bar with additional small bars below it called Minibars. It's useful when you have an entity with multiple parts that you want to get damaged separately.
The Minibars all have independent values from the main bar and each other. They can be differently colored with different progress.
The main Boss Bar can also be set to display both the entity's health and the Minibar healths combined. This is done via the combinedHealth
property.
Usage
To turn a Boss Bar into a Multibar you can simply use the addMinibar
boss event property or the addMinibar method in PL_ServerBossEvent and pass a new instance of ServerMinibar.
The Minibar on it's own takes in an entity and Minibar.MinibarProperties
. The available properties are:
- Color (HEX)
- Color (
PL_BossEvent_PL_BossEventBarColor
) - Auto-Update
Same rendering rules as normal BossEvent
s apply.
Here's an example:
private final PL_ServerBossEvent bossBar = new PL_ServerBossEvent(this, this.getDisplayName(), new PL_BossEvent.BossEventProperties().customColor(0xFFC0CB).addMinibars(new ServerMinibar(this, new Minibar.MinibarProperties().color(PL_BossEvent.PL_BossBarColor.PINK)), new ServerMinibar(this, new Minibar.MinibarProperties().color(PL_BossEvent.PL_BossBarColor.PINK)), new ServerMinibar(this, new Minibar.MinibarProperties().color(PL_BossEvent.PL_BossBarColor.PINK)), new new ServerMinibar(this, new Minibar.MinibarProperties().color(PL_BossEvent.PL_BossBarColor.PINK)), new new ServerMinibar(this, new Minibar.MinibarProperties().color(PL_BossEvent.PL_BossBarColor.PINK)));
The example above makes a new pink-ish boss bar with 5 pre-set pink Minibars. You can also save these to an array or something for cleaner code.
You can also set the updateProgressAutomatically
property to false if you want to update the Minibar with said property yourself.
Credits
I want to give PlatinPython a giant thank you for helping me out on these bars. He made the rendering math to make them work no matter of how many there are. I annoyed him for 3 days straight and he still put up with me and my stupidity and helped me make these work. Love you PlotinPaiton <3