server.player.bossbar
fn new #
fn new(text string) BossBar
new returns a BossBar showing the text passed. The bar starts out full and purple; use with_health_percentage and with_colour to change that.
fn Colour.from #
fn Colour.from[W](input W) !Colour
enum Colour #
enum Colour as u8 {
pink = 0
blue = 1
red = 2
green = 3
yellow = 4
purple = 5
rebecca_purple = 6
white = 7
}
Colour is the colour of the bar drawn behind a BossBar's text.
fn (Colour) u8 #
fn (c Colour) u8() u8
u8 returns the protocol value of the Colour.
struct BossBar #
struct BossBar {
text string
health f32 = 1.0
colour Colour = .purple
}
BossBar is a bar shown at the top of a player's screen, with text above it and a health bar below that text. It is a value type: the with_* methods return a modified copy instead of mutating the receiver, so a bar may be built once and reused for several players.
fn (BossBar) text #
fn (bar BossBar) text() string
text returns the text drawn above the bar.
fn (BossBar) health_percentage #
fn (bar BossBar) health_percentage() f32
health_percentage returns how full the bar is drawn, between 0.0 and 1.0.
fn (BossBar) colour #
fn (bar BossBar) colour() Colour
colour returns the colour of the bar.
fn (BossBar) with_health_percentage #
fn (bar BossBar) with_health_percentage(v f32) BossBar
with_health_percentage returns a copy of the BossBar filled up to v, which is clamped to the 0.0 to 1.0 range the client accepts.
fn (BossBar) with_colour #
fn (bar BossBar) with_colour(c Colour) BossBar
with_colour returns a copy of the BossBar drawn in the Colour passed.