PrismarineJS / mineflayer

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

Bot disconnecting from server without any logs (kick or error) #2723

Open KatantDev opened 2 years ago

KatantDev commented 2 years ago

Versions

Detailed description of a problem

Im trying to connect to the server. The server has custom authorization and texture pack loading upon connection. After success login bot getting all packets like player_info, map_chunk and more else... But at the end, the bot shuts down for no reason and doesn't display any error.

What did you try yet?

I tried to test my code on another server with resourcePack and on another server with same server core (minestom) and everything was okay

Your current code

const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
    host: 'play.aevium.online',
    username: 'AeviumBot',
    version: '1.18.2',
})

bot.on("resourcePack", (url, hash) => {
    console.log(url, hash)
    bot.acceptResourcePack()
})

bot.on("message", (jsonMsg, position) => {
    console.log(jsonMsg, position)
})

bot.on('end', console.log)
bot.on('kicked', console.log)
bot.on('error', console.log)

Expected behavior

I was expecting the bot to receive packet "resourcePack" and not disconnect from the server

Additional context

Last packet before disconnect was play.map_chunk

ghost commented 2 years ago

Im pretty sure acceptResourcePack & denyResourcePack is a property not a method. Try using bot.acceptResourcePack;

KatantDev commented 2 years ago

Im pretty sure acceptResourcePack & denyResourcePack is a property not a method. Try using bot.acceptResourcePack;

image Thats all what I see in console. That means I didn't got "resourcePack" packet. Problem not in resourcePack, and I tested this code on another server with resource pack, all works good.

Northernside commented 1 year ago

Any updates? Because accepting resourcepacks still doesn't work for me..

extremeheat commented 1 year ago

What's the debug log output? See the README

Northernside commented 1 year ago

Oops, sorry for the late reply. It's the same output as here: https://github.com/PrismarineJS/mineflayer/issues/2723#issuecomment-1200773274

extremeheat commented 1 year ago

There is no output. You didn't enable it correctly, read the readme again, or put process.env.DEBUG = 'minecraft-protocol' at the top of your script.