PrismarineJS / mineflayer

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

No ground up support for 1.12 #915

Closed WhySoBad closed 4 years ago

WhySoBad commented 4 years ago

Versions

Detailed description of a problem

I am testing at a bot on a 1.12.2 server. The bot joins the server and executes a command to get to his home. After arriving at the home point it crashes with the error below. I saw there was an almost similar error at the version 1.8 which is now fixed.

Current code

function join() {
  bot = mineflayer.createBot({
    username: config.USERNAME,
    password: config.PASSWORD,
    host: config.HOST,
    version: config.VERSION,
  });
  console.log(`Connected to ${config.HOST}`);
  setTimeout(() => {
    bot.chat('/home afk');
    console.log('Arrived at home');
    setTimeout(() => {
      start();
    }, 5000);
  }, 5000);
}
RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 65535. Received -1
    at checkInt (internal/buffer.js:35:11)
    at writeU_Int16LE (internal/buffer.js:539:3)
    at Buffer.writeUInt16LE (internal/buffer.js:547:10)
    at Chunk.eatPackedBlockLongs (C:\Users\abc\Documents\Coding\JavaScript\projects\bot\node_modules\prismarine-chunk\src\pc\1.9\chunk.js:431:23)
    at Chunk.unpackChunkData (C:\Users\abc\Documents\Coding\JavaScript\projects\bot\node_modules\prismarine-chunk\src\pc\1.9\chunk.js:360:31)
    at Chunk.load (C:\Users\abc\Documents\Coding\JavaScript\projects\bot\node_modules\prismarine-chunk\src\pc\1.9\chunk.js:332:31)
    at addColumn (C:\Users\abc\Documents\Coding\JavaScript\projects\bot\node_modules\mineflayer\lib\plugins\blocks.js:91:14)
    at Client.bot._client.on (C:\Users\abc\Documents\Coding\JavaScript\projects\bot\node_modules\mineflayer\lib\plugins\blocks.js:225:5)
    at Client.emit (events.js:189:13)
    at FullPacketParser.deserializer.on (C:\Users\abc\Documents\Coding\JavaScript\projects\bot\node_modules\minecraft-protocol\src\client.js:87:12)

Expected behavior

The error is caused by prismarine-chunk so I suppose it's caused by a incorrectly loaded chunk.

firejoust commented 4 years ago

I get this bug too, but only on a small selection of servers on 1.12.2. Fixed by changing the version to 1.8.

rom1504 commented 4 years ago

done, just update