or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

audience-system.mdbooks-and-inventory.mdboss-bars.mdevents-and-interactivity.mdindex.mdnbt-data-components.mdresource-packs.mdsound-system.mdtext-components.mdtext-formatting.mdtitles-and-subtitles.mdtranslation-system.md

boss-bars.mddocs/

0

# Boss Bars

1

2

Boss bar display system with customizable appearance, progress tracking, and viewer management. Boss bars provide prominent visual feedback for ongoing events or status information.

3

4

## Capabilities

5

6

### Boss Bar Interface

7

8

Core interface for creating and managing boss bars with configurable properties.

9

10

```java { .api }

11

/**

12

* Represents a boss bar with title, progress, color, and flags

13

*/

14

interface BossBar extends Examinable {

15

/**

16

* Gets the boss bar title

17

* @return the title component

18

*/

19

Component name();

20

21

/**

22

* Gets the progress value (0.0-1.0)

23

* @return the progress

24

*/

25

float progress();

26

27

/**

28

* Gets the boss bar color

29

* @return the color

30

*/

31

Color color();

32

33

/**

34

* Gets the boss bar overlay style

35

* @return the overlay

36

*/

37

Overlay overlay();

38

39

/**

40

* Gets the boss bar flags

41

* @return set of flags

42

*/

43

Set<Flag> flags();

44

45

/**

46

* Sets the boss bar title

47

* @param name the new title

48

* @return boss bar with new title

49

*/

50

BossBar name(ComponentLike name);

51

52

/**

53

* Sets the progress value

54

* @param progress the progress (0.0-1.0)

55

* @return boss bar with new progress

56

*/

57

BossBar progress(float progress);

58

59

/**

60

* Sets the boss bar color

61

* @param color the color

62

* @return boss bar with new color

63

*/

64

BossBar color(Color color);

65

66

/**

67

* Sets the boss bar overlay

68

* @param overlay the overlay

69

* @return boss bar with new overlay

70

*/

71

BossBar overlay(Overlay overlay);

72

73

/**

74

* Sets the boss bar flags

75

* @param flags the flags

76

* @return boss bar with new flags

77

*/

78

BossBar flags(Set<Flag> flags);

79

80

/**

81

* Adds flags to the boss bar

82

* @param flags the flags to add

83

* @return boss bar with added flags

84

*/

85

BossBar addFlags(Flag... flags);

86

87

/**

88

* Removes flags from the boss bar

89

* @param flags the flags to remove

90

* @return boss bar with removed flags

91

*/

92

BossBar removeFlags(Flag... flags);

93

94

/**

95

* Checks if the boss bar has a flag

96

* @param flag the flag to check

97

* @return true if flag is present

98

*/

99

boolean hasFlag(Flag flag);

100

101

/**

102

* Creates a boss bar

103

* @param name the title

104

* @param progress the progress (0.0-1.0)

105

* @param color the color

106

* @param overlay the overlay

107

* @return new boss bar

108

*/

109

static BossBar bossBar(ComponentLike name, float progress, Color color, Overlay overlay);

110

111

/**

112

* Creates a boss bar with flags

113

* @param name the title

114

* @param progress the progress

115

* @param color the color

116

* @param overlay the overlay

117

* @param flags the flags

118

* @return new boss bar

119

*/

120

static BossBar bossBar(ComponentLike name, float progress, Color color, Overlay overlay, Set<Flag> flags);

121

122

/**

123

* Boss bar colors

124

*/

125

enum Color {

126

PINK("pink"),

127

BLUE("blue"),

128

RED("red"),

129

GREEN("green"),

130

YELLOW("yellow"),

131

PURPLE("purple"),

132

WHITE("white");

133

}

134

135

/**

136

* Boss bar overlay styles (segment divisions)

137

*/

138

enum Overlay {

139

PROGRESS("progress"), // Solid bar

140

NOTCHED_6("notched_6"), // 6 segments

141

NOTCHED_10("notched_10"), // 10 segments

142

NOTCHED_12("notched_12"), // 12 segments

143

NOTCHED_20("notched_20"); // 20 segments

144

}

145

146

/**

147

* Boss bar behavior flags

148

*/

149

enum Flag {

150

DARKEN_SCREEN("darken_screen"), // Darkens the sky

151

PLAY_BOSS_MUSIC("play_boss_music"), // Plays boss music

152

CREATE_WORLD_FOG("create_world_fog"); // Creates fog effect

153

}

154

}

155

```

156

157

**Usage Examples:**

158

159

```java

160

import net.kyori.adventure.bossbar.BossBar;

161

import net.kyori.adventure.text.Component;

162

import net.kyori.adventure.text.format.NamedTextColor;

163

164

// Simple boss bar

165

BossBar healthBar = BossBar.bossBar(

166

Component.text("Boss Health"),

167

0.75f, // 75% health

168

BossBar.Color.RED,

169

BossBar.Overlay.PROGRESS

170

);

171

172

// Show to audience

173

audience.showBossBar(healthBar);

174

175

// Update progress over time

176

healthBar = healthBar.progress(0.5f); // 50% health

177

178

// Complex boss bar with effects

179

BossBar dramaticBossBar = BossBar.bossBar(

180

Component.text("The Ender Dragon", NamedTextColor.DARK_PURPLE),

181

1.0f,

182

BossBar.Color.PURPLE,

183

BossBar.Overlay.NOTCHED_20,

184

Set.of(BossBar.Flag.DARKEN_SCREEN, BossBar.Flag.PLAY_BOSS_MUSIC)

185

);

186

187

// Hide boss bar

188

audience.hideBossBar(healthBar);

189

```