Open nwmorten opened 1 year ago
You should be able to ignore that error. Does the bot get kicked from the server?
It seems I get kicked from the server. I'm unsure why though, because a manual login with the same account is possible...
Is the server public? If so, please provide the IP so I can test
server is private. How does this effect login and what steps could i take to make it work? (My account is white-listed for given server)
I believe it to be a server issue. Try running Vanilla client with logs open and see if you get a similar error
Do you have an example how i can do that? Do i set > client: 'vanilla' < inside the createbot function?
Run the Vanilla Minecraft client
The log has the following message: "Received passengers for unknown entity"
What exactly does "run the Vanilla Minecraft client" mean? Do i just open the minecraft launcher and start the game (in vanilla mode), or do i need to execute some other kind of code?
What exactly does "run the Vanilla Minecraft client" mean? Do i just open the minecraft launcher and start the game (in vanilla mode), or do i need to execute some other kind of code?
It just means open the launcher and start the game.
well that works fine :D
What exactly does "run the Vanilla Minecraft client" mean? Do i just open the minecraft launcher and start the game (in vanilla mode), or do i need to execute some other kind of code?
It just means open the launcher and start the game.
what next?
There is nothing in the logs of the Vanilla client?
Can you confirm the server is completely Vanilla?
This the log when connecting to server via Minecraft vanilla client:
19:04:34.155
Using default game log configuration client-1.12.xml (outputs XML)
19:04:37.192
Building optimized datafixer
19:04:39.102
Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
19:04:39.725
Setting user: schnigenburger
19:04:39.850
Backend library: LWJGL version 3.3.1 build 7
19:04:41.963
Narrator library for x64 successfully loaded
19:04:41.988
Reloading ResourceManager: vanilla
19:04:44.719
Missing sound for event: minecraft:item.goat_horn.play
19:04:44.720
Missing sound for event: minecraft:entity.goat.screaming.horn_break
19:04:44.975
OpenAL initialized on device OpenAL Soft on Lautsprecher (Sound Blaster Audigy Fx)
19:04:44.977
Sound engine started
19:04:45.025
Created: 1024x1024x4 minecraft:textures/atlas/blocks.png-atlas
19:04:45.037
Created: 512x256x4 minecraft:textures/atlas/signs.png-atlas
19:04:45.038
Created: 1024x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
19:04:45.078
Created: 1024x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
19:04:45.082
Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
19:04:45.090
Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
That log shows no connection to the server
When on Server, after pressing F3, top left shows: "vanilla" server
Wierd, it cut off the bottom, here it is
19:04:34.155
Using default game log configuration client-1.12.xml (outputs XML)
19:04:37.192
Building optimized datafixer
19:04:39.102
Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
19:04:39.725
Setting user: schnigenburger
19:04:39.850
Backend library: LWJGL version 3.3.1 build 7
19:04:41.963
Narrator library for x64 successfully loaded
19:04:41.988
Reloading ResourceManager: vanilla
19:04:44.719
Missing sound for event: minecraft:item.goat_horn.play
19:04:44.720
Missing sound for event: minecraft:entity.goat.screaming.horn_break
19:04:44.975
OpenAL initialized on device OpenAL Soft on Lautsprecher (Sound Blaster Audigy Fx)
19:04:44.977
Sound engine started
19:04:45.025
Created: 1024x1024x4 minecraft:textures/atlas/blocks.png-atlas
19:04:45.037
Created: 512x256x4 minecraft:textures/atlas/signs.png-atlas
19:04:45.038
Created: 1024x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
19:04:45.078
Created: 1024x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
19:04:45.082
Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
19:04:45.090
Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
19:04:45.372
Shader rendertype_entity_translucent_emissive could not find sampler named Sampler2 in the specified shader program.
19:04:45.553
Created: 512x256x0 minecraft:textures/atlas/particles.png-atlas
19:04:45.554
Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
19:04:45.555
Created: 256x128x0 minecraft:textures/atlas/mob_effects.png-atlas
19:04:49.326
Connecting to 85.190.143.103, 59000
19:04:56.497
Loaded 845 advancements
19:05:06.770
4445 Datafixer optimizations took 29569 milliseconds
Do you have access to the server console? Or do you know someone who does? I'd like confirmation that this is happening on a Vanilla server. spawn_entity is a very basic packet, so there is nothing to indicate we are parsing it incorrectly.
Packet also provides enormous position values, so it's definitely malformed in some way.
This is the server.properties file:
#Minecraft server properties
#Sun Feb 12 17:07:07 UTC 2023
enable-jmx-monitoring=false
verify-names=true
max-connections=3
level-seed=
rcon.port=59005
enable-command-block=false
gamemode=survival
enable-query=true
generator-settings={}
enforce-secure-profile=false
level-name=world
motd=nitrado.net gameserver
query.port=59001
hellworld=false
monsters=false
pvp=true
generate-structures=true
max-chained-neighbor-updates=1000000
difficulty=easy
network-compression-threshold=256
port=59000
max-tick-time=-1
require-resource-pack=false
max-players=4
use-native-transport=true
online-mode=true
enable-status=true
allow-flight=false
initial-disabled-packs=
broadcast-rcon-to-ops=true
view-distance=8
grow-trees=true
resource-pack-prompt=
server-ip=85.190.143.103
allow-nether=true
server-port=59000
enable-rcon=false
sync-chunk-writes=true
no-animals=false
server-name=nitrado.net gameserver
op-permission-level=4
public=true
prevent-proxy-connections=false
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=100
simulation-distance=10
rcon.password=
player-idle-timeout=0
force-gamemode=false
rate-limit=0
hardcore=false
white-list=true
broadcast-console-to-ops=true
spawn-npcs=true
previews-chat=false
spawn-animals=true
function-permission-level=2
initial-enabled-packs=vanilla
level-type=default
text-filtering-config=
spawn-monsters=true
enforce-whitelist=false
resource-pack-sha1=
spawn-protection=16
max-world-size=29999984
admin-slot=false
I found the following error in the server console, after i tried to log in with the bot:
[18:36:06] [Server thread/INFO]: schnigenburger lost connection: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: Index 32 out of bounds for length 3
Going off this, i think i've narrowed down the source of the error:
The server.properties has set online-mode=true
, which means it doesn't accept unknown clients. Beacuse i'm running the mineflayer bot with vscode, i believe the server refuses to allow me to connect beacuse of this client issue.
Is there any way to fix this without setting online-mode
to false
? (doing so didn't work and it also makes the server vulnerable)
2 things:
That makes sense. What steps do you recommend i try next for trouble shooting?
Enable debug for node-minecraft-protocol and see what packets the client sends before getting disconnected
using the code below (from node-minecraft-protocol client_auto.js), i recieve the following terminal output:
connected
disconnected: {"translate":"disconnect.genericReason","with":["Internal Exception: io.netty.handler.codec.DecoderException: The received string length is longer than maximum allowed (22 > 16)"]}
Code:
const mc = require('minecraft-protocol')
if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node echo.js <host> <port> [<name>] [<password>]')
process.exit(1)
}
const client = mc.createClient({
version: false,
host: process.argv[2],
port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : 'echo',
password: process.argv[5]
})
client.on('connect', function () {
console.info('connected')
})
client.on('disconnect', function (packet) {
console.log('disconnected: ' + packet.reason)
})
client.on('chat', function (packet) {
const jsonMsg = JSON.parse(packet.message)
if (jsonMsg.translate === 'chat.type.announcement' || jsonMsg.translate === 'chat.type.text') {
const username = jsonMsg.with[0].text
const msg = jsonMsg.with[1]
if (username === client.username) return
client.write('chat', { message: msg })
}
})
using the code below (from node-minecraft-protocol client_auto.js), i recieve the following terminal output:
connected disconnected: {"translate":"disconnect.genericReason","with":["Internal Exception: io.netty.handler.codec.DecoderException: The received string length is longer than maximum allowed (22 > 16)"]}
Code:
const mc = require('minecraft-protocol') if (process.argv.length < 4 || process.argv.length > 6) { console.log('Usage : node echo.js <host> <port> [<name>] [<password>]') process.exit(1) } const client = mc.createClient({ version: false, host: process.argv[2], port: parseInt(process.argv[3]), username: process.argv[4] ? process.argv[4] : 'echo', password: process.argv[5] }) client.on('connect', function () { console.info('connected') }) client.on('disconnect', function (packet) { console.log('disconnected: ' + packet.reason) }) client.on('chat', function (packet) { const jsonMsg = JSON.parse(packet.message) if (jsonMsg.translate === 'chat.type.announcement' || jsonMsg.translate === 'chat.type.text') { const username = jsonMsg.with[0].text const msg = jsonMsg.with[1] if (username === client.username) return client.write('chat', { message: msg }) } })
Your username is probably too long
ah, my mistake. i now added auth: 'microsoft'
to the createClient
function.
terminal output is the good old familiar:
connected
Chunk size is 188 but only 54 was read ; partial packet : {"name":"spawn_entity","params":{"entityId":185,"objectUUID":"7b227472-616e-736c-6174-65223a226469","type":115,"x":9.489665354112813e+170,"y":1.1935881242136542e+190,"z":2.262901882749459e+180,"pitch":119,"yaw":105,"headPitch":116,"objectData":104,"velocityX":8762,"velocityY":23330,"velocityZ":18798}}; buffer :00b9017b227472616e736c617465223a22646973636f6e6e6563742e67656e65726963526561736f6e222c2277697468223a5b22496e7465726e616c20457863657074696f6e3a20696f2e6e657474792e68616e646c65722e636f6465632e4465636f646572457863657074696f6e3a206a6176612e6c616e672e496e6465784f75744f66426f756e6473457863657074696f6e3a20496e646578203332206f7574206f6620626f756e647320666f72206c656e6774682033225d7d
Server log shows:
[20:32:55] [Server thread/INFO]: schnigenburger lost connection: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: Index 32 out of bounds for length 3
I have made the following observations about where the discrepancy lies:
The error message given by the terminal includes: "objectUUID":"7b227472-616e-736c-6174-65223a226469"
, however, checking this against the UUID stored in the servers white-list, this is the wrong UUID!
Why does this happen?
The server log gives the following when logging in with mineflayer. The first line includes the correct UUID. How can the error message in vscode terminal return a different UUID ?!
[21:11:02] [User Authenticator #2/INFO]: UUID of player schnigenburger is <My actual UUID>
[21:11:02] [Server thread/INFO]: schnigenburger[/<My IP Adress>] logged in with entity id 1700 at (215.69263011526573, 68.0, -159.4451747158684)
[21:11:02] [Server thread/INFO]: schnigenburger joined the game
[21:11:02] [Server thread/INFO]: schnigenburger lost connection: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: Index 32 out of bounds for length 3
[21:11:02] [Server thread/INFO]: schnigenburger left the game
Enable debug for node-minecraft-protocol and see what packets the client sends before getting disconnected
did the following:
set DEBUG=minecraft-protocol
node <filename>.js
no additional information was printed in the terminal
Versions
Problem description
Tried logging onto nitrado server with createbot() (see code below). no other fancy stuff. Works fine to log onto a localhost server. However, if i try to access a remote server, the following error is given in the terminal:
What did you try yet?
I tried on localhost first and the code worked. Bot appeared on local server. Logging into nitrado server failed with above error message. I also logged onto nitrado server manually and then executed code. Was thrown from server because of duplicate login. I assume therefore that the login was successful, however the bot still gives the error above.
Your current code
Expected behavior
That login throws no errors