Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not functioning as of 1.19.3 #36

Open
MyUsernamee opened this issue Feb 20, 2023 · 1 comment
Open

Not functioning as of 1.19.3 #36

MyUsernamee opened this issue Feb 20, 2023 · 1 comment

Comments

@MyUsernamee
Copy link

MyUsernamee commented Feb 20, 2023

When I attempt to use the following code

import { InstantConnectProxy } from 'prismarine-proxy'
const proxy = new InstantConnectProxy({
  loginHandler: (client) => {
    console.log(client.username)
    return {
      username: 'ice',
    };
  },
  clientOptions: {
    host: 'localhost',
    version: '1.19.3'
  },
  serverOptions: {
    version: '1.19.3',
    port: 25566
  }
})

proxy.on('incoming', (data, meta, toClient, toServer) => {
  toClient.write(meta.name, data)
})

proxy.on('outgoing', (data, meta, toClient, toServer) => {
  toServer.write(meta.name, data)
})

I fails with the error

Disconnecting client because error TypeError [ERR_INVALID_ARG_TYPE]: Serialization error for play.toClient : SizeOf error for undefined : The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at Function.byteLength (node:buffer:740:11)
    at Object.string (eval at compile (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:259:12), <anonymous>:45:25)
    at Object.packet_respawn (eval at compile (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:259:12), <anonymous>:2269:27)       
    at eval (eval at compile (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:259:12), <anonymous>:3083:54)
    at packet (eval at compile (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:259:12), <anonymous>:3131:9)
    at CompiledProtodef.sizeOf (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:89:14)
    at e.message (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:96:40)
    at tryCatch (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\utils.js:50:16)
    at CompiledProtodef.createPacketBuffer (C:\Users\dihydromonoxide\Desktop\Node Projects\minecraft-bot\minecraft-bot\node_modules\protodef\src\compiler.js:96:20) {
  code: 'ERR_INVALID_ARG_TYPE',
  field: 'play.toClient'
}

I am using a lan world with the port 25565, this was also tested with a server

@MyUsernamee
Copy link
Author

It appears as though this has to do with the respawn packets and commenting out the following lines in instant_connection_proxy.js seems to have fixed it

//toClient.write('respawn', { ...data, dimension })
//toClient.write('respawn', data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant