PrismarineJS / mineflayer

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

Unable to connect bot to server due to proxy settings hindering the connection process (Bug) #3437

Open OmegaM1 opened 3 months ago

OmegaM1 commented 3 months ago


Would be appreciated for your solution
BallisticOK commented 3 months ago

im having same problem where it cant join but im getting this error /home/container/node_modules/mineflayer/lib/plugins/game.js:46 const { minY, height } = bot.registry.dimensionsByName[bot.game.dimension] ^ TypeError: Cannot read properties of undefined (reading 'overworld') at handleRespawnPacketData (/home/container/node_modules/mineflayer/lib/plugins/game.js:46:63) at Client.<anonymous> (/home/container/node_modules/mineflayer/lib/plugins/game.js:80:5) at Client.emit (node:events:531:35) at Client.emit (node:domain:488:12) at emitPacket (/home/container/node_modules/minecraft-protocol/src/client.js:83:12) at FullPacketParser.<anonymous> (/home/container/node_modules/minecraft-protocol/src/client.js:112:9) at FullPacketParser.emit (node:events:519:28) at FullPacketParser.emit (node:domain:488:12) at addChunk (/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12) at readableAddChunk(/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:262:11)`

OmegaM1 commented 3 months ago

im having same problem where it cant join but im getting this error /home/container/node_modules/mineflayer/lib/plugins/game.js:46 const { minY, height } = bot.registry.dimensionsByName[bot.game.dimension] ^ TypeError: Cannot read properties of undefined (reading 'overworld') at handleRespawnPacketData (/home/container/node_modules/mineflayer/lib/plugins/game.js:46:63) at Client.<anonymous> (/home/container/node_modules/mineflayer/lib/plugins/game.js:80:5) at Client.emit (node:events:531:35) at Client.emit (node:domain:488:12) at emitPacket (/home/container/node_modules/minecraft-protocol/src/client.js:83:12) at FullPacketParser.<anonymous> (/home/container/node_modules/minecraft-protocol/src/client.js:112:9) at FullPacketParser.emit (node:events:519:28) at FullPacketParser.emit (node:domain:488:12) at addChunk (/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12) at readableAddChunk(/home/container/node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:262:11)`

that must be a client-side bug I'm not sure about this, but if I was you I would just delete my mineflayer package and re-install it again may it fixes.

My bots file is running on an online hosting service so error I get is probably related to NATing and networks ig so idk how to fix that

BallisticOK commented 3 months ago

i got it working just cant use mc over 1.18 if i go over that i get the error so for now im just using via on my server and making it use 1.18 to join

extremeheat commented 3 months ago

Please verify that you can connect to the server with a vanilla client first

OmegaM1 commented 3 months ago

Please verify that you can connect to the server with a vanilla client first

I can always connect to the server with my mc client without any problems but idk why the bots can't I think there's a firewall from the server side that may blocking the bots connection

TinyTank800 commented 3 months ago

Same issue as this one here. ive done testing on this and it happens when server is running 1.19 or higher and bot tries to join with anything above 1.18. Clients can join just fine but not bots. Bots on 1.18 can join the server since the server has via version on it and work fine just cant go below the world limit of 1.18.

https://github.com/PrismarineJS/mineflayer/issues/3435

OmegaM1 commented 3 months ago

I've tried every version still getting the same error

Chunk size is 5 but only 1 was read ; partial packet : {"name":0}; buffer :0005000001
serializer.js:76
Chunk size is 259 but only 1 was read ; partial packet : {"name":123}; buffer :7b2274657874223a22c2a737c2a76d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d5c6ec2a763496e76616c696420686f73746e616d652e5c6ec2a763506c6561736520726566657220746f206f757220646f63756d656e746174696f6e20617420646f63732e746370736869656c642e636f6d5c6e5c6ec2a76644446f532070726f74656374696f6e20627920c2a762c2a76e544350536869656c642e636f6d5c6ec2a737c2a76d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d227d
Error: connect ETIMEDOUT 142.54.229.243:4145
    at TCPConnectWrap.afterConnect [as oncomplete] (c:\net.js:1595:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {errno: -4039, code: 'ETIMEDOUT', syscall: 'connect', address: '142.54.229.243', port: 4145, …}
Alexandersys commented 3 months ago

Same issue and same error here, When I use socks proxies for my mineflayer bot I keep getting the error above but it works fine when I don't configure proxies for my bot.

extremeheat commented 3 months ago

If the connection is refused this is an issue with the server or your network connection. Try on a different server and see if you can reproduce. There are other comments on this issue that are not related to OP problem.

extremeheat commented 3 months ago

If it's a proxy issue then we can't fix it, we can only fix problems directly caused by the code

OmegaM1 commented 3 months ago

Yeah I just realized it works without setting proxy but the issue is there's a minecraft server that doesn't let you join your bots with your same IP so somehow you gotta bypass it using proxies.

Maximapple commented 3 months ago

Yeah I just realized it works without setting proxy but the issue is there's a minecraft server that doesn't let you join your bots with your same IP so somehow you gotta bypass it using proxies.

Are you setting the proxy right within the mineflayer script or are you using something like proxychains4?

OmegaM1 commented 3 months ago

It was working fine for me a few weeks or months ago, but since I updated my version of mineflayer to the latest version, it keeps sending me this error, and I've been ensured several times that there isn't any problem with proxies.

OmegaM1 commented 3 months ago

Are you setting the proxy right within the mineflayer script or are you using something like proxychains4?

I'm currently using socks5-client

OmegaM1 commented 3 months ago

This is the code example of how I configure the proxies

const mineflayer = require('mineflayer')
const Socks = require("socks5-client");

const bot = mineflayer.createBot({
stream: Socks.createConnection({
  host: "192.168.1.1",
  port: "25565",
  socksHost: "1.0.0.1",
  socksPort: 4145
}),
  username: 'IamBot',
  password: '',
  version: 1.20,
})