Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to flying squid server with prismarine-web-client #301

Open
kf106 opened this issue May 12, 2022 · 2 comments
Open

Can't connect to flying squid server with prismarine-web-client #301

kf106 opened this issue May 12, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@kf106
Copy link
Contributor

kf106 commented May 12, 2022

Please see PrismarineJS/flying-squid#591

There seems to be an issue with the playerlist_overlay.js file in prismarine-web-client when connecting to a flying squid server, in that https://github.com/PrismarineJS/prismarine-web-client/blob/master/lib/menus/components/playerlist_overlay.js#L106 is called too early.

connecting to 127.0.0.1 20565 with kf106
index.js:220 bot spawned - starting viewer
index.js:226 6
viewer.js:34 Using version: 1.16.1
index.js:393 Done!
playerlist_overlay.js:106 Uncaught TypeError: Cannot read properties of undefined (reading 'uuid')
    at PlayerListOverlay.init (playerlist_overlay.js:106:1)
    at Hud.init (hud.js:215:1)
    at EventEmitter.<anonymous> (index.js:395:1)
    at Object.onceWrapper (events.js:242:1)
    at EventEmitter.emit (events.js:158:1)
    at Client.<anonymous> (health.js:13:1)
    at Object.onceWrapper (events.js:243:1)
    at Client.emit (events.js:158:1)
    at FullPacketParser.<anonymous> (client.js:91:1)
    at FullPacketParser.emit (events.js:153:1)
@kf106
Copy link
Contributor Author

kf106 commented May 12, 2022

I have managed to get it working by wrapping a couple of things in hud.js in a bot.on('spawn' ...) but as I've only looked at the code for about an hour, I'm guessing I shouldn't be the one to make the change.

Here are the changes:

line 215 of ./lib/menus/hud.js:
bot.on('spawn', () => playerList.init(bot, host))

lines 254-263 of ./lib/menus/hud.js:

    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()
    })

rom1504 added a commit that referenced this issue May 21, 2022
Co-authored-by: Keir Finlow-Bates <keirfb@gmail.com>
Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
extremeheat referenced this issue in extremeheat/prismarine-web-client Apr 13, 2023
Co-authored-by: Keir Finlow-Bates <keirfb@gmail.com>
Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
Moondarker referenced this issue in Moondarker/prismarine-web-client Apr 13, 2023
Co-authored-by: Keir Finlow-Bates <keirfb@gmail.com>
Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
Moondarker referenced this issue in Moondarker/prismarine-web-client Apr 13, 2023
Co-authored-by: Keir Finlow-Bates <keirfb@gmail.com>
Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
@ironon
Copy link

ironon commented Jul 13, 2023

Having the same issue.

@rom1504 rom1504 added the bug Something isn't working label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants