0

I am Recieving this errror when i run this simple code snippet

import mineflayer from 'mineflayer';

const bot = mineflayer.createBot({
  host: 'localhost',
  port: 25595,
  username: 'Maaz_Bot', // minecraft username
  password:''
})

I was expecting it to join the localhost server which is hosted at port 25595 by using lan world and mineflayer library

  • 1
    How are you running the server? Perhaps it's only bound to `127.0.0.1:25595` (IPv4) – Phil Mar 23 '23 at 02:37

1 Answers1

-2

Try importing mineflayer like below and also you can handle the events using, on login and on error

const mineflayer = require('mineflayer');

const bot = mineflayer.createBot({
  host: 'localhost',
  port: 25595,
  username: 'Maaz_Bot', // minecraft username
  password: '',
});

bot.on('login', () => {
  console.log('Bot has logged in');
});

bot.on('error', (err) => {
  console.error('Error:', err);
});

For more info please go through documentation

https://www.npmjs.com/package/mineflayer

pppery
  • 3,731
  • 22
  • 33
  • 46