Class CustomBossBars
java.lang.Object
net.ixdarklord.coolcatcanvas.api.bossbar.CustomBossBars
Boss bars drawn a mod's own way, from the server. A bar is given a style, an id the client draws it by
(
BossBarRenderers.register on the client); clients that know no renderer for it, or have no CoolCatLib,
draw the game's own bar, so a styled bar is always safe to show.
// A boss's own bar, kept by the boss:
private final ServerBossEvent bar = new ServerBossEvent(getUUID(), getDisplayName(), BossBarColor.RED, BossBarOverlay.PROGRESS);
CustomBossBars.style(bar, MyMod.id("warden"), this); // in its constructor
// Or let CoolCatLib keep one for any living entity, following its name and health:
EntityBossBar.of(entity).style(MyMod.id("warden")).range(48).show();
The style can be changed or taken off (null) at any time; players seeing the bar are told at once.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidstyle(net.minecraft.server.level.ServerBossEvent bar, @Nullable net.minecraft.resources.Identifier style) Draws a bar in a style; null puts it back to the game's own bar.static voidstyle(net.minecraft.server.level.ServerBossEvent bar, @Nullable net.minecraft.resources.Identifier style, @Nullable net.minecraft.world.entity.Entity entity) Draws a bar in a style, linked to an entity: the renderer can show it (a face, a model, its own state) while it is loaded on the client.static @Nullable net.minecraft.resources.IdentifierstyleOf(net.minecraft.server.level.ServerBossEvent bar) The style a bar is drawn in, or null for the game's own.
-
Method Details
-
style
public static void style(net.minecraft.server.level.ServerBossEvent bar, @Nullable @Nullable net.minecraft.resources.Identifier style) Draws a bar in a style; null puts it back to the game's own bar. -
style
public static void style(net.minecraft.server.level.ServerBossEvent bar, @Nullable @Nullable net.minecraft.resources.Identifier style, @Nullable @Nullable net.minecraft.world.entity.Entity entity) Draws a bar in a style, linked to an entity: the renderer can show it (a face, a model, its own state) while it is loaded on the client. -
styleOf
@Nullable public static @Nullable net.minecraft.resources.Identifier styleOf(net.minecraft.server.level.ServerBossEvent bar) The style a bar is drawn in, or null for the game's own.
-