PrismarineJS / mineflayer

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

Error connecting to server. #1372

Closed ghost closed 3 years ago

ghost commented 4 years ago

Versions

Clear question

The bot is not included in the server.

What did you try yet?

-

Your current code

Please put here any custom code you tried yet.

Here's what the debug output:

minecraft-protocol writing packet handshaking.set_protocol +0ms
  minecraft-protocol {
  minecraft-protocol   protocolVersion: 404,
  minecraft-protocol   serverHost: 'mc.prostocraft.ru',
  minecraft-protocol   serverPort: 25565,
  minecraft-protocol   nextState: 2
  minecraft-protocol } +3ms
  minecraft-protocol writing packet login.login_start +94ms
  minecraft-protocol { username: 'nickname' } +0ms
  minecraft-protocol read packet login.login_plugin_request +137ms
  minecraft-protocol {
  minecraft-protocol   "messageId": 931530927,
  minecraft-protocol   "channel": "mitigator:cookie",
  minecraft-protocol   "data": {
  minecraft-protocol     "type": "Buffer",
  minecraft-protocol     "data": []
  minecraft-protocol   }
  minecraft-protocol } +1ms

Additional context

TheDudeFromCI commented 4 years ago

What code did you use to log in with?

ghost commented 4 years ago
const options = {
  host: process.argv[2], 
  port: parseInt(process.argv[3]), 
  version: "1.13.2",
  username: process.argv[4]
};

var bot = mineflayer.createBot(options)

navigatePlugin(bot);
bot.navigate.blocksToAvoid[132] = true; 
bot.navigate.blocksToAvoid[59] = false;
bot.loadPlugin(tpsPlugin)

bot.settings.viewDistance = "tiny"

bot._client.on('map', ({ data,itemDamage })=> {
    let invL = bot.inventory.slots.filter(el=> el !== null)
    let slotM = invL.find(item => (item && item.displayName || ' ') == "Map")
    if (slotM !== undefined) {
        if(!data) return;

        const size = Math.sqrt(data.length);
        const image = PNGImage.createImage(size, size);

        for(let x = 0; x < size; x++) {
            for(let z = 0; z < size; z++) {

                const colorId = data[x + (z * size)];
                image.setAt(x, z, md.getColor(colorId));
            }
        }

        image.writeImage(`${__dirname}/captha.png`, function (err) {
            if (err) throw err;
        });

        easyvk({access_token: token}).then(_vk => {
            vk = _vk;
            return vk.uploader.getUploadURL(
                'photos.getMessagesUploadServer', {}, true
                )
        }).then(async ({url, vkr}) => {
            const field = 'photo'
            const server = vk.uploader
            const filePath = path.join(__dirname, 'captha.png')
            url = url.upload_url
            let fileData = await server.uploadFile(url, filePath, field, {})
            fileData = await vk.post('photos.saveMessagesPhoto', fileData)
            fileData = fileData[0]

            const attachments = [
            `photo${fileData.owner_id}_${fileData.id}_${fileData.access_key}`
            ]

            return vk.call('messages.send', {
                user_id: config.user_id,
                attachment: attachments,
                message: 'Карта из инвентаря',
                random_id: easyvk.randomId()
            });
        });
    }else{
        return
    }
});
bot.on('message', function (jsonMessage) {
  if (chat == true) {
        easyvk({access_token: token}).then(_vk => {
            vk = _vk;
            return vk.call("messages.send", {
                message: '[Чат]'+jsonMessage.toString(),
                user_id: config.user_id,
                random_id: easyvk.randomId()
            });
        });
    };
});
rom1504 commented 4 years ago

What's the error ?

rom1504 commented 4 years ago

You need to answer to plugin request packet

ghost commented 4 years ago

You need to answer to plugin request packet

what?

ghost commented 4 years ago

@rom1504 what exactly?

TheDudeFromCI commented 4 years ago

Your server is asking you to send the login.login_plugin_request packet. You are not sending it. Your server is not a vanilla server, so you need to add additional support for whatever mods your server has installed.

ghost commented 4 years ago

Your server is asking you to send the login.login_plugin_request packet. You are not sending it. Your server is not a vanilla server, so you need to add additional support for whatever mods your server has installed.

How about? how can you do it? Spigot server, no mods

TheDudeFromCI commented 4 years ago

Your server is asking you to send the login.login_plugin_request packet. You are not sending it. Your server is not a vanilla server, so you need to add additional support for whatever mods your server has installed.

How about? how can you do it? Spigot server, no mods

No idea.

ghost commented 4 years ago

Your server is asking you to send the login.login_plugin_request packet. You are not sending it. Your server is not a vanilla server, so you need to add additional support for whatever mods your server has installed.

How about? how can you do it? Spigot server, no mods

No idea.

Can I somehow display sent and received packages in the official minecraft launcher ?

TheDudeFromCI commented 4 years ago

@goncharovchik Yes, you want to take a look at the mc-protocol proxy example. https://github.com/PrismarineJS/node-minecraft-protocol/tree/master/examples/proxy

ghost commented 4 years ago

@TheDudeFromCI But it doesn't output authorization packets.

TheDudeFromCI commented 4 years ago

The proxy outputs all packets that are sent between the client and the server.

ghost commented 4 years ago

The proxy outputs all packets that are sent between the client and the server.

strange but there were no packages login

TheDudeFromCI commented 4 years ago

This only shows packets between the client and the server. Authentication with Mojang is a seperate process and is unrelated to your issue above.

ghost commented 4 years ago

Это показывает только пакеты между клиентом и сервером. Аутентификация с помощью Mojang - это отдельный процесс, не связанный с указанной выше проблемой.

well, I meant the packages that I showed before At the moment such packets are not displayed by the proxy

TheDudeFromCI commented 4 years ago

You use the vanilla Minecraft client with the proxy, make note of all packets that are being sent, and compare it to your bot. What packets is Minecraft sending that your bot is not sending?