Class EntityBossBar
java.lang.Object
net.ixdarklord.coolcatcanvas.api.bossbar.EntityBossBar
A boss bar that belongs to a living entity and keeps itself: its name is the entity's, its progress the entity's
health, and it shows to the players near it while it is to be shown. Make one from the server,
show() it,
and it runs by itself every tick until the entity is removed, or hide() is called.
EntityBossBar bar = EntityBossBar.of(this)
.style(MyMod.id("warden")) // drawn by a renderer of that id on the client
.color(BossBarColor.RED).overlay(BossBarOverlay.NOTCHED_10)
.range(48).darkenScreen(true)
.showWhen(boss -> !((MyBoss) boss).isAsleep())
.show();
For a bar an entity drives itself (its own progress, phases, names), give it a ServerBossEvent of its own
and style it with CustomBossBars.style(ServerBossEvent, Identifier).-
Method Summary
Modifier and TypeMethodDescriptioncolor(net.minecraft.world.BossEvent.BossBarColor color) createWorldFog(boolean fog) darkenScreen(boolean darken) net.minecraft.world.entity.LivingEntityentity()net.minecraft.server.level.ServerBossEventevent()The bar itself, for anything not covered here.voidhide()Stops it, and takes it off every screen.static EntityBossBarof(net.minecraft.world.entity.LivingEntity entity) overlay(net.minecraft.world.BossEvent.BossBarOverlay overlay) playBossMusic(boolean music) range(double blocks) How near, in blocks, a player must be to see it.show()Starts it: from now on it keeps itself every tick, until the entity is gone orhide().When it shows at all, asked every tick: a boss asleep, or not yet woken, need not show its bar.@Nullable net.minecraft.resources.Identifierstyle()style(@Nullable net.minecraft.resources.Identifier style) The style it is drawn in on the client (BossBarRenderers); null for the game's own bar.booleantick()One server tick of it; false once it is done.
-
Method Details
-
of
-
style
The style it is drawn in on the client (BossBarRenderers); null for the game's own bar. -
color
-
overlay
-
darkenScreen
-
playBossMusic
-
createWorldFog
-
range
How near, in blocks, a player must be to see it. 48 by default. -
showWhen
When it shows at all, asked every tick: a boss asleep, or not yet woken, need not show its bar. -
show
Starts it: from now on it keeps itself every tick, until the entity is gone orhide(). -
hide
public void hide()Stops it, and takes it off every screen. -
entity
public net.minecraft.world.entity.LivingEntity entity() -
event
public net.minecraft.server.level.ServerBossEvent event()The bar itself, for anything not covered here. -
style
@Nullable public @Nullable net.minecraft.resources.Identifier style() -
tick
public boolean tick()One server tick of it; false once it is done. Called by CoolCatLib.
-