PrismarineJS / mineflayer

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

Bot not able to connect to Hypixel/Mineplex #687

Closed The-Box1 closed 6 years ago

The-Box1 commented 6 years ago

I have looked around at people's issues and haven't actually found a fix for this.

So when I attempt to connect my bot to Mineplex or Hypixel I am getting these Partial Packet errors. For Mineplex it is: Chunk size is 20 but only 17 was read ; partial packet : {"name":"entity_teleport","params":{"entityId":8,"x":1380271945,"y":1398031698,"z":1114992231,"yaw":101,"pitch":101,"onGround":true}}; buffer :1808524547495354455242756e676565436f7264 Chunk size is 18 but only 10 was read ; partial packet : {"name":"block_change","params":{"location":{"x":2398000,"y":512,"z":0},"type":0}}; buffer :230925cc080000000000013c04666c617400 Chunk size is 78 but only 17 was read ; partial packet : {"name":"entity_teleport","params":{"entityId":8,"x":1296268354,"y":1918987876,"z":1128428910,"yaw":103,"pitch":101,"onGround":true}}; buffer :18084d437c4272616e644342756e676565436f726420286769743a42756e676565436f72642d426f6f7473747261703a312e31332d534e415053484f543a306139356166353a756e6b6e6f776e29 Chunk size is 22 but only 17 was read ; partial packet : {"name":"entity_teleport","params":{"entityId":8,"x":1380271945,"y":1398031698,"z":1296268361,"yaw":116,"pitch":101,"onGround":true}}; buffer :180852454749535445524d437c4974656d4e616d6500 Chunk size is 97 but only 17 was read ; partial packet : {"name":"entity_teleport","params":{"entityId":8,"x":1296268354,"y":1918987876,"z":1447196014,"yaw":103,"pitch":101,"onGround":true}}; buffer :18084d437c4272616e645642756e676565436f726420286769743a42756e676565436f72642d426f6f7473747261703a312e31332d534e415053484f543a306139356166353a756e6b6e6f776e29203c2d204d696e65706c657820537069676f74

And Hypixel is:

Chunk size is 20 but only 17 was read ; partial packet : {"name":"entity_teleport","params":{"entityId":8,"x":1380271945,"y":1398031698,"z":1114992231,"yaw":101,"pitch":101,"onGround":true}}; buffer :1808524547495354455242756e676565436f7264 Chunk size is 18 but only 10 was read ; partial packet : {"name":"block_change","params":{"location":{"x":25929,"y":1792,"z":0},"type":0}}; buffer :230019525c0000000000033c04666c617400 Chunk size is 266 but only 17 was read ; partial packet : {"name":"entity_teleport","params":{"entityId":8,"x":1296268354,"y":1918987876,"z":339899758,"yaw":103,"pitch":101,"onGround":true}}; buffer :18084d437c4272616e641442756e676565436f726420284879706978656c2900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 events.js:183 throw er; // Unhandled 'error' event ^

PartialReadError: Deserialization error for play.toClient.respawn.levelType : Read error for params.respawn.levelType : Missing characters in string, found size is 29 expected size was 109 at new ExtendableError (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\utils.js:75:11) at new PartialReadError (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\utils.js:81:5) at ProtoDef.readPString (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\datatypes\utils.js:109:36) at ProtoDef.read (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\protodef.js:39:25) at ProtoDef.read (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\protodef.js:127:29) at tryDoc (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\datatypes\structures.js:46:32) at tryCatch (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\utils.js:63:16) at tryDoc (C:\Users*\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\utils.js:67:10) at typeArgs.forEach (C:\Users*****\Documents\Atom Projects\Minecraft AI\node_modules\protodef\src\datatypes\structures.js:45:5) at Array.forEach ()

I noticed this when connecting with the bot I am working on. So I tested it with the bare minimum to connect to a server:

var mineflayer = require('mineflayer');

var options = { host: "hypixel.net", username: "AUsernameGoesHere", password: "YouNoGetMehPassword", };

var bot = mineflayer.createBot(options);

ArcticZeroo commented 6 years ago

Try using my extension module iron-golem ( https://github.com/ArcticZeroo/iron-golem ) as a workaround for this. I don't really have it fixed (since I didn't really have an interest in diving into protobuf for writing a staff bot for Mineplex), but the module swallows this deserialization error so you don't have to worry about it.

The-Box1 commented 6 years ago

Thanks! That works perfect. It connects to Mineplex just fine, but when I try adding the serverConfigs variable in the creating of the client function I get an error:

serverConfigs: [server = 'us.mineplex.com', version = 1.12, chatDelay = 1200],
^^^^^^^^^^^^^

SyntaxError: Unexpected identifier at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:612:3

I have the create client function as this:

const bot = new Client({ username: 'user', password: 'pass', server: 'us.mineplex.com', prefix: 'US', sessionCache: true serverConfigs: [server = 'us.mineplex.com', version = 1.12, chatDelay = 1200], });

ArcticZeroo commented 6 years ago

You're missing {}s around the config entry in the array, and :s instead of =s

The-Box1 commented 6 years ago

So like this?:

{serverConfigs: [server: 'us.mineplex.com', version: 1.12, chatDelay: 1200]},

ArcticZeroo commented 6 years ago

The other way around;

const bot = new Client({
username: 'user',
password: 'pass',
server: 'us.mineplex.com',
prefix: 'US',
sessionCache: true,
serverConfigs: [{server: 'us.mineplex.com', version: '1.12,' chatDelay: 1200}],
});

You had some other minor errors in there as well (missing comma before serverConfigs, missing quotes around 1.12).

The-Box1 commented 6 years ago

Ohhh, ok

The-Box1 commented 6 years ago

Also, how do I incorporate the navigate plugin into this? I have the navigate plugin and the mineflayer plugin brought in, but I get errors saying it doesn't know what bot.navigate.blocksToAvoid is.

The-Box1 commented 6 years ago

Sorry, ran the wrong file, lol. But now I getting an error with the chatDelay variable:

serverConfigs: [{server: 'us.mineplex.com', version: '1.12,' chatDelay: 1200}],
                                                             ^^^^^^^^^

SyntaxError: Unexpected identifier

rom1504 commented 6 years ago

I advise you learn Js first.

On Sun, Jul 22, 2018, 16:13 nagoL2015 notifications@github.com wrote:

Sorry, ran the wrong file, lol. But now I getting an error with the chatDelay variable:

serverConfigs: [{server: 'us.mineplex.com', version: '1.12,' chatDelay: 1200}], ^^^^^^^

SyntaxError: Unexpected identifier

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/687#issuecomment-406869767, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_gHojTM9zpSx1Kfq-wOMo7mf7bxSks5uJIiBgaJpZM4VYF0I .

The-Box1 commented 6 years ago

I know the basic stuff. But I have another question for Arctic. I am getting the error: Data buffer not correct size. This happens when the bot connects to my mps. It stays on for about 5 seconds then crashes. I think this is about RAM but idk.

ArcticZeroo commented 6 years ago

I'm not sure about that. I've never had the same issue with running the bot on Staff-1.

The-Box1 commented 6 years ago

Is there any work-around?

ArcticZeroo commented 6 years ago

Follow the error up the chain of files and see if you can debug the cause. I have never seen the issue and it's a non-vanilla server so no possible way of knowing what's going on.

rom1504 commented 6 years ago

You can use the debug mode to see what packets were received before (see node-minecraft-protocol readme)

The-Box1 commented 6 years ago

DEBUG="iron-golem" node index.js

Do you mean like this. Because this isn't working

rom1504 commented 6 years ago

No DEBUG="minecraft-protocol" node index.js (Under Linux, in windows it's different)

On Tue, Jul 24, 2018, 23:07 nagoL2015 notifications@github.com wrote:

DEBUG="iron-golem" node index.js

Do you mean like this. Because this isn't working

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/687#issuecomment-407552522, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_qRjMokGKOvP7c36gIoIW_3uz5QRks5uJ4ySgaJpZM4VYF0I .

rom1504 commented 6 years ago

https://github.com/PrismarineJS/mineflayer/blob/master/docs/issue_template.md

ghost commented 4 years ago

Try using my extension module iron-golem ( https://github.com/ArcticZeroo/iron-golem ) as a workaround for this. I don't really have it fixed (since I didn't really have an interest in diving into protobuf for writing a staff bot for Mineplex), but the module swallows this deserialization error so you don't have to worry about it.

Yo does this work with mineflayer plugins i need to use mineflayer-navigate

ArcticZeroo commented 4 years ago

You should really be asking this in iron-golem, not mineflayer. But since we're here anyways, I may as well answer. client.bot gives you access to the mineflayer bot, so you can do whatever you want with it, including load plugins.