Skip to content

Commit

Permalink
Fix for #301 (#306)
Browse files Browse the repository at this point in the history
Co-authored-by: Keir Finlow-Bates <[email protected]>
Co-authored-by: Romain Beaumont <[email protected]>
  • Loading branch information
3 people committed May 21, 2022
1 parent e1df6a1 commit 598d8dc
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/menus/hud.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Hud extends LitElement {
debugMenu.bot = bot

chat.init(bot._client, renderer)
playerList.init(bot, host)
bot.on('spawn', () => playerList.init(bot, host))

bot.on('entityHurt', (entity) => {
if (entity !== bot.entity) return
Expand Down Expand Up @@ -251,15 +251,17 @@ class Hud extends LitElement {
// breathbar.updateOxygen(bot.oxygenLevel)
// })

this.shadowRoot.querySelector('#xp-bar-bg').style.display = bot.player.gamemode === 1 ? 'none' : 'block'
this.shadowRoot.querySelector('#xp-bar-bg').firstElementChild.style.width = `${182 * bot.experience.progress}px`
xpLabel.innerHTML = bot.experience.level
xpLabel.style.display = bot.experience.level > 0 ? 'block' : 'none'
healthbar.gameModeChanged(bot.player.gamemode, bot.game.hardcore)
healthbar.updateHealth(bot.health)
foodbar.updateHunger(bot.food)
// breathbar.updateOxygen(bot.oxygenLevel ?? 20)
hotbar.init()
bot.on('spawn', () => {
this.shadowRoot.querySelector('#xp-bar-bg').style.display = bot.player.gamemode === 1 ? 'none' : 'block'
this.shadowRoot.querySelector('#xp-bar-bg').firstElementChild.style.width = `${182 * bot.experience.progress}px`
xpLabel.innerHTML = bot.experience.level
xpLabel.style.display = bot.experience.level > 0 ? 'block' : 'none'
healthbar.gameModeChanged(bot.player.gamemode, bot.game.hardcore)
healthbar.updateHealth(bot.health)
foodbar.updateHunger(bot.food)
// breathbar.updateOxygen(bot.oxygenLevel ?? 20)
hotbar.init()
})

if (document.getElementById('options-screen').forceMobileControls || isMobile()) {
this.showMobileControls(true)
Expand Down

0 comments on commit 598d8dc

Please sign in to comment.