bossbar

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PinkColor   = Color(packet.PinkColor)
	BlueColor   = Color(packet.BlueColor)
	RedColor    = Color(packet.RedColor)
	GreenColor  = Color(packet.GreenColor)
	YellowColor = Color(packet.YellowColor)
	PurpleColor = Color(packet.PurpleColor)
	WhiteColor  = Color(packet.WhiteColor)
)

Available boss bar colors.

View Source
const (
	// MinProgress is the minimum value the progress can be.
	MinProgress float32 = 0.0
	// MaxProgress is the maximum value the progress can be.
	MaxProgress float32 = 1.0
)
View Source
const (
	ProgressOverlay  = Overlay(packet.ProgressOverlay)
	Notched6Overlay  = Overlay(packet.Notched6Overlay)
	Notched10Overlay = Overlay(packet.Notched10Overlay)
	Notched12Overlay = Overlay(packet.Notched12Overlay)
	Notched20Overlay = Overlay(packet.Notched20Overlay)
)

Available boss bar overlays.

View Source
const (
	DarkenScreenFlag   = Flag(packet.DarkenScreenFlag)
	PlayBossMusicFlag  = Flag(packet.PlayBossMusicFlag)
	CreateWorldFogFlag = Flag(packet.CreateWorldFogFlag)
)

Available boss bar flags.

Variables

Colors is a list of available boss bar colors.

Functions

func RemoveAllViewers

func RemoveAllViewers(b BossBar)

RemoveAllViewers removes all viewers from the boss bar.

Types

type BossBar

type BossBar interface {
	// Viewers returns the viewers of this boss bar.
	Viewers() []Viewer
	// AddViewer adds the specified viewer to the boss bar's viewers
	AddViewer(Viewer) error
	// RemoveViewer removes the specified viewer from the boss bar's viewers
	RemoveViewer(Viewer) error

	// ID returns the boss bar's ID.
	ID() uuid.UUID
	// Name returns the name of this boss bar.
	Name() component.Component
	// SetName sets the name of this boss bar.
	SetName(component.Component)

	// Color returns the color of this boss bar.
	Color() Color
	// SetColor sets the color of this boss bar.
	SetColor(Color)

	// Percent returns the percent of this boss bar.
	Percent() float32
	// SetPercent sets the percent of this boss bar.
	SetPercent(float32)

	// Flags returns the flags of this boss bar.
	Flags() []Flag
	// SetFlags sets the flags of this boss bar.
	SetFlags([]Flag)

	// Overlay returns the overlay of this boss bar.
	Overlay() Overlay
	// SetOverlay sets the overlay of this boss bar.
	SetOverlay(Overlay)
}

BossBar is a boss bar.

func New

func New(
	name component.Component,
	percent float32,
	color Color,
	overlay Overlay,
	flags ...Flag,
) BossBar

New creates a new boss bar. It is safe for concurrent use.

Don't forget to register/unregister the boss bar with the proxy boss bar manager if necessary.

type Color

type Color = packet.Color

Color is the color of the percent bar.

type Flag

type Flag = packet.Flag

Flag is a boss bar flag.

type Overlay

type Overlay = packet.Overlay

Overlay is a boss bar overlay.

type Viewer

type Viewer interface {
	ID() uuid.UUID
	proto.PacketWriter
}

Viewer is the interface for a boss bar viewer (likely a player).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL