@@ -212,7 +212,7 @@ class Hud extends LitElement {
212
212
debugMenu . bot = bot
213
213
214
214
chat . init ( bot . _client , renderer )
215
- playerList . init ( bot , host )
215
+ bot . on ( 'spawn' , ( ) => playerList . init ( bot , host ) )
216
216
217
217
bot . on ( 'entityHurt' , ( entity ) => {
218
218
if ( entity !== bot . entity ) return
@@ -251,15 +251,17 @@ class Hud extends LitElement {
251
251
// breathbar.updateOxygen(bot.oxygenLevel)
252
252
// })
253
253
254
- this . shadowRoot . querySelector ( '#xp-bar-bg' ) . style . display = bot . player . gamemode === 1 ? 'none' : 'block'
255
- this . shadowRoot . querySelector ( '#xp-bar-bg' ) . firstElementChild . style . width = `${ 182 * bot . experience . progress } px`
256
- xpLabel . innerHTML = bot . experience . level
257
- xpLabel . style . display = bot . experience . level > 0 ? 'block' : 'none'
258
- healthbar . gameModeChanged ( bot . player . gamemode , bot . game . hardcore )
259
- healthbar . updateHealth ( bot . health )
260
- foodbar . updateHunger ( bot . food )
261
- // breathbar.updateOxygen(bot.oxygenLevel ?? 20)
262
- hotbar . init ( )
254
+ bot . on ( 'spawn' , ( ) => {
255
+ this . shadowRoot . querySelector ( '#xp-bar-bg' ) . style . display = bot . player . gamemode === 1 ? 'none' : 'block'
256
+ this . shadowRoot . querySelector ( '#xp-bar-bg' ) . firstElementChild . style . width = `${ 182 * bot . experience . progress } px`
257
+ xpLabel . innerHTML = bot . experience . level
258
+ xpLabel . style . display = bot . experience . level > 0 ? 'block' : 'none'
259
+ healthbar . gameModeChanged ( bot . player . gamemode , bot . game . hardcore )
260
+ healthbar . updateHealth ( bot . health )
261
+ foodbar . updateHunger ( bot . food )
262
+ // breathbar.updateOxygen(bot.oxygenLevel ?? 20)
263
+ hotbar . init ( )
264
+ } )
263
265
264
266
if ( document . getElementById ( 'options-screen' ) . forceMobileControls || isMobile ( ) ) {
265
267
this . showMobileControls ( true )
0 commit comments