PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

chest doesn't always work in non vanilla #571

Closed duralakun closed 4 years ago

duralakun commented 7 years ago

I was playing around with chest.js from the examples and experienced 2 different crashes. They only happen sometimes, both happend twice to me.

The first appeared twice when i typed "close" in chat:

assert.js:81 throw new assert.AssertionError({ ^ AssertionError: null != null at Chest.close (/node_modules/mineflayer/lib/plugins/inventory.js:268:14) at closeChest (/chest.js:134:11) at Bot.onChat (/chest.js:118:9) at emitMany (events.js:132:20) at Bot.emit (events.js:201:7) at parseJsonMessage7 (/node_modules/mineflayer/lib/plugins/chat.js:95:15) at parseJsonMessage (/node_modules/mineflayer/lib/plugins/chat.js:113:9) at Client.bot._client.on.e (/node_modules/mineflayer/lib/plugins/chat.js:134:5) at emitTwo (events.js:106:13) at Client.emit (events.js:191:7)

The second appeard twice when i tried to withdraw items:

assert.js:81 throw new assert.AssertionError({ ^ AssertionError: null == true at Chest.items (/node_modules/mineflayer/lib/chest.js:30:12) at withdrawItem (/chest.js:139:35) at Bot.onChat (/chest.js:123:9) at emitMany (events.js:132:20) at Bot.emit (events.js:201:7) at parseJsonMessage7 (/node_modules/mineflayer/lib/plugins/chat.js:95:15) at parseJsonMessage (/node_modules/mineflayer/lib/plugins/chat.js:113:9) at Client.bot._client.on.e (/node_modules/mineflayer/lib/plugins/chat.js:134:5) at emitTwo (events.js:106:13) at Client.emit (events.js:191:7)

I am using nodejs v6.11.1 on ubuntu running a local vanilla server in offline mode.

Are these known bugs? Am I doing something wrong?

plexigras commented 7 years ago

maybe update node.js?

roblabla commented 7 years ago

The first bug is the bot trying to close an already closed window. We're missing a removeListener here.

The second bug is https://github.com/PrismarineJS/mineflayer/blob/master/lib/chest.js#L30. Probably something similar.

I'm guessing that something is causing the window to be closed on your server ?

duralakun commented 7 years ago

Yes you are right roblabla, i dident pay attention to the chest animation. Both crashes appear when trying to do it on a closed chest. Thanks

rom1504 commented 4 years ago

I think this is fixed