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

TypeError: Cannot mix BigInt and other types, use explicit conversions #270

Open
vladbogun1 opened this issue Jan 13, 2025 · 2 comments
Open

Comments

@vladbogun1
Copy link

vladbogun1 commented Jan 13, 2025

when my mineflayer bot spawns into Limbo, it crashes with error

/bot/node_modules/prismarine-chunk/src/pc/1.18/ChunkColumn.js:20
this.numSections = this.worldHeight >> 4
^
TypeError: Cannot mix BigInt and other types, use explicit conversions
at new ChunkColumn (/bot/node_modules/prismarine-chunk/src/pc/1.18/ChunkColumn.js:20:43)
at addColumn (/bot/node_modules/mineflayer/lib/plugins/blocks.js:53:16)
at Client. (/bot/node_modules/mineflayer/lib/plugins/blocks.js:296:5)
at Client.emit (node:events:517:28)
at emitPacket (/bot/node_modules/minecraft-protocol/src/client.js:84:12)
at FullPacketParser. (/bot/node_modules/minecraft-protocol/src/client.js:113:9)
at FullPacketParser.emit (node:events:517:28)
at addChunk (/bot/node_modules/readable-stream/lib/internal/streams/readable.js:323:12)
at readableAddChunk (/bot/node_modules/readable-stream/lib/internal/streams/readable.js:300:9)
at Readable.push (/bot/node_modules/readable-stream/lib/internal/streams/readable.js:246:10)

My Bot Code:

 const mineflayer = require('mineflayer');
 
 const config = {
     host: '*****',
     port: 25565,
     username: '****@gmail.com',
     password: '*****',
     auth: 'microsoft',
     version: '1.21.3',
     loadInternalPlugins: true,
     viewDistance: 1,
 };
 
 let bot;
 
 function createBot() {
     bot = mineflayer.createBot(config);
 
     bot.on('spawn', () => {
         console.log('[BOT] Bot spawned and AFK now.');
         stayAFK();
     });
 
     bot.on('chat', (username, message) => {
         const logMessage = `[CHAT] ${username}: ${message}`;
         console.log(logMessage);
     });
 
     bot.on('error', (err) => {
         const errorMessage = `[BOT] Error encountered: ${err}`;
         console.error(errorMessage);
         setTimeout(createBot, 180000);
     });
 
     bot.on('end', () => {
         const disconnectMessage = '[BOT] Bot disconnected. Relogging...';
         console.log(disconnectMessage);
         setTimeout(createBot, 60000);
     });
 }
 
 function stayAFK() {
     setInterval(() => {
         const afkMessage = '[BOT] Bot AFK: OK.';
         console.log(afkMessage);
     }, 60000);
 }
 
 createBot();

@vladbogun1
Copy link
Author

Someone should fix that with at least wrapping options?.minY and options?.worldHeight in Number()

as now i am getting thise values as SignedBigInt

Image

      this.minY = Number(options?.minY) ?? CAVES_UPDATE_MIN_Y
      this.worldHeight = Number(options?.worldHeight) ?? CAVES_UPDATE_WORLD_HEIGHT

@extremeheat
Copy link
Member

Yeah, it could either be handled here or in mineflayer. Technically the prismarine-chunk API doesn't say it allows BigInts here so I think it makes sense to fix in mineflayer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants