I’ve been trying to make a Minecraft server proxy for Hypixel, a minigames server. The code is as following:
const { InstantConnectProxy } = require('prismarine-proxy')
const proxy = new InstantConnectProxy({
loginHandler: (client) => { // client object has a username object, so you can store usernames with their respective logins
return { username: "D3P_", auth: "microsoft", } // the login the proxy will connect to the server with
},
serverOptions: { // options for the local server shown to the vanilla client
version: '1.8.9',
port: 25565,
},
clientOptions: { // options for the client that will connect to the proxied server
version: '1.8.9',
host: 'mc.hypixel.net' // server the proxy will connect to
}
})
proxy.on('incoming', (data, meta, toClient, toServer) => { // packets incoming from the server to the client
if (meta.name === 'world_particles') return // for 1.8.9, world_particles is the packet that contains particles, so by returning here, the client connected to the proxy won't get any particles
toClient.write(meta.name, data) // otherwise send the packet to the client
})
proxy.on('outgoing', (data, meta, toClient, toServer) => { // packets outgoing from the client to the server
if (meta.name === 'chat') console.log(data.message) // for 1.8.9, chat is the packet that the client sends to send a chat message to the server, so by using console.log, we can sniff the message before it hits the server, and even return early so it wouldn't hit the server
toServer.write(meta.name, data) // otherwise send the packet to the client
})
I get these errors while connecting, and it never goes through
Disconnected
java.net.ConnectionException: Connection refused: no further information
Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: Bad packet id 1280
Sometimes, I get random errors about out of bounds
stuff. I don’t know why it doesn’t work. If this is unfixable, it would be appreciated if you could tell me an alternative that works 🙂
Also, I use Lunar Client 1.8.9.
Yes, my code is copied from the documentation. So, I expect it to work. The only changes I’ve made is using Microsoft for authentication, which should work, since it’s an option.
solarity is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.