confusinguser / minecraft-packet-proxy

Proxy server for developers that will display packets sent between the server and client
GNU General Public License v3.0
6 stars 0 forks source link

Unable to join Servers with Fabric API installed #1

Open amnotbananaama opened 3 years ago

amnotbananaama commented 3 years ago

Summary

Players are unable to connect to the proxy if the server has Fabric API installed. Fabric API is a library mod for the Fabric modloader, and provides many essential events and hooks for Fabric mod developers. Connecting to a server with Fabric API without minecraft-packet-proxy works. Likewise, connecting to minecraft-packet-proxy works if the server doesn't have Fabric API installed.

Reproduction Steps

  1. Set up a Fabric server
    Bash one-liner install command
wget -O fabric-installer-0.6.1.51.jar https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.6.1.51/fabric-installer-0.6.1.51.jar && java -jar fabric-installer-0.6.1.51.jar server -downloadMinecraft

  1. Place the Fabric API mod in the <server root>/mods directory.
    Fabric API download

https://www.curseforge.com/minecraft/mc-mods/fabric-api/download/3147523/file (Latest version at the time of this writing)

  1. Launch the Fabric server. (java -jar fabric-server-launch.jar --nogui).

  2. Launch minecraft-packet-proxy and "Connect" to the server.

    You get this packet from the server
(Server) login_plugin_request: {"messageId":0,"channel":"fabric-networking-api-v1:early_registration","data":{"type":"Buffer","data":[0]}}

  1. Attempt to connect to the proxy. -> :x: You get this error on the client: -> :x: An empty server packet shows up for minecraft-packet-proxy:

    (Server) login: {}
  2. Disable the proxy, and connect to the server directly. -> ✔️ Clients can connect without issue

  3. Rename Fabric API to .jar.foo to prevent the mod from being loaded, and re-launch the server and the proxy. -> ✔️ Clients can connect to the proxy without issue

  4. Load a Fabric mod which does not use or require Fabric API, such as Lithium and re-launch the server and the proxy. -> ✔️ Clients can connect to the proxy without issue

Additional Info

My guess is that the networking module of Fabric API is doing something that the proxy doesn't understand or like. Unfortunately, I don't know how to get a full printout of the invalid JSON in step 6, it is not saved to the log file. I hope this is helpful, and thank you for creating this tool!

confusinguser commented 3 years ago

First of all I just wanna say that I love your report, really detailed and nice to look at! :D

Now to how this issue can be fixed. We need to know is what is kicking the player, is it the proxy, or the server?

If it's the server then making the proxy connect at the same time as the client might fix it. Since the proxy might have different behavior that the fabric api doesn't like.

But if it's the proxy that's kicking, then it might be because fabric is sending a custom packet and the minecraft node library has a list of "allowed" packets. The fabric packet then makes the proxy freak out because the packet name isn't on that list. The proxy then kicks the player and disconnects. To fix this you would have to edit the node library code and put a custom version which I would do if there isn't another solution.

Does the fabric server log say anything about the player? Does it show the player connecting?