Skip to content

Problem with vehicle.passengers.push(passengerEntity) #3614

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

Closed
1 task done
Krzychu4u opened this issue Mar 23, 2025 · 1 comment
Closed
1 task done

Problem with vehicle.passengers.push(passengerEntity) #3614

Krzychu4u opened this issue Mar 23, 2025 · 1 comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@Krzychu4u
Copy link

Krzychu4u commented Mar 23, 2025

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.26.0
  • server: paper 1.21.4?
  • node: 22.13.1

Detailed description of a problem

  • What are you building?
    I'm trying to make a bot that will just teleport to spawn and them to home

  • What problem are you trying to solve?
    vehicle.passengers.push(passengerEntity)

Your current code

/*
const mineflayer = require('mineflayer');

const bot = mineflayer.createBot({
    host: 'server.com',
    port: 25565,
    username: 'nick',
    version: '1.19.4'
});



bot.once('spawn', () => {
    console.log("Bot zalogowany na serwerze!");
    bot.chat('/l passwd'); 

    
    bot.activateItem();  
    
    bot.on('windowOpen', (window) => {
        console.log('window open');
        bot.clickWindow(15, 0, 0);
    });
});

bot.on('spawn', () => {
    console.log("Spawn!");
    console.log("Tp spawn!");
    bot.chat('/spawn')
    console.log("Tp home!");
    bot.chat('/home')
});

bot.on('message', (message) => {
    const messageText = message.toString();
    const regex = /\[([^\]]+)\s*->\s*Ja\]\s*end/;
    const match = messageText.match(regex);

    if (match) {
        const messageContent = match[2]; 
        console.log(`Wiadomość od ${match[1]}: ${messageContent}`);
        console.log("Wychodze!");
        bot.end();
    }
});


bot.on('end', () => {
    console.log('con end!');
});

bot.on('error', (err) => {
    console.log(`Błąd: ${err}`);
});
*/

Expected behavior

Don't crash and stay on server

Additional context

C:\MineFlayer\Bot-setup\node_modules\mineflayer\lib\plugins\entities.js:841
        vehicle.passengers.push(passengerEntity)
                ^

TypeError: Cannot read properties of undefined (reading 'passengers')
TypeError: Cannot read properties of undefined (reading 'passengers')
    at Client.<anonymous> (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\mineflayer\lib\plugins\entities.js:841:17)
    at Client.emit (node:events:524:28)
    at Client.<anonymous> (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\mineflayer\lib\plugins\entities.js:841:17)
    at Client.emit (node:events:524:28)
    at Client.emit (node:events:524:28)
    at emitPacket (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\minecraft-protocol\src\client.js:84:12)
    at emitPacket (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\minecraft-protocol\src\client.js:84:12)
    at Array.forEach (<anonymous>)
    at FullPacketParser.<anonymous> (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\minecraft-protocol\src\client.js:99:26)
    at FullPacketParser.emit (node:events:524:28)
    at addChunk (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\readable-stream\lib\internal\streams\readable.js:323:12)
    at readableAddChunk (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\readable-stream\lib\internal\streams\readable.js:300:9)
    at Readable.push (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\readable-stream\lib\internal\streams\readable.js:246:10)
    at FullPacketParser._transform (C:\Users\krzyc\Documents\MineFlayer\Bot-setup\node_modules\protodef\src\serializer.js:89:10)
@Krzychu4u Krzychu4u added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Mar 23, 2025
@rom1504
Copy link
Member

rom1504 commented Mar 23, 2025

Fixed

@rom1504 rom1504 closed this as completed Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

2 participants