Skip to content

Instantly share code, notes, and snippets.

@OroArmor
Last active April 24, 2024 15:15
Show Gist options
  • Save OroArmor/66632962acdd4bbbacc71d858befab29 to your computer and use it in GitHub Desktop.
Save OroArmor/66632962acdd4bbbacc71d858befab29 to your computer and use it in GitHub Desktop.
Trying to help fix broken vanilla contract in Essential.

Essential Support Bot#4488 (1012730938054160404) at Wed, 03 Apr 2024 06:22:21 GMT

oroarmor's ticket - 33991 Created at - <t:1712125340:F> Opened at - <t:1712125420:F> Members - <@365708770262777856> <@196683878935560192> <@108132758131376128> Issue type - Something's not working Which version of Minecraft are you playing? - Original Minecraft Please select the type of issue you're having - Issue with the Essential mod / Minecraft itself What kind of issue are you facing with Essential / Minecraft? - Something is not working Which area of Essential are you seeing an issue with? - Other Please describe your issue - Hi, I am on the staff for Quilt, and essential has a bug that affects it on both quilt and fabric, but causes a disconnect on fabric. I would be willing to talk about it in this thread @Support

oroarmor (365708770262777856) at Wed, 03 Apr 2024 06:26:06 GMT

The specific chunks of code are here: Screenshot 2024-04-02 232550

You create a new packet that you then send to the "server" that looks like minecraft:register

the problem is that on the local client, no serialization takes place, so the custom payload you create is sent as is

on quilt, we expect this custom payload to extend a certain class

oroarmor (365708770262777856) at Wed, 03 Apr 2024 06:28:15 GMT

this causes a class cast exception and causes the client to disconnect from the local server

on fabric, they expect the payload to just implement an interface

Screenshot 2024-04-02 232840 in both of these cases, your register packet isnt handled correctly

I also did my best to search around the decompiled code to see if i could find where this channel you register was being used, but i had no such luck

I dont know much about your development system, but even just calling the fabric api register method would solve this issue

systemless (196683878935560192) at Wed, 03 Apr 2024 07:51:37 GMT

Hey @OroArmor! This isn't anything we've gotten reported from fabric users before.

but causes a disconnect on fabric

Is this a typo? Did you mean quilt here?

We don't depend on the fabric-api and therefore do not use the fabric-api methods for that.

oroarmor (365708770262777856) at Wed, 03 Apr 2024 07:52:28 GMT

Oops I typoed that. That should say quilt, not fabric

oroarmor (365708770262777856) at Wed, 03 Apr 2024 08:02:10 GMT

I just realized a way to do it that doesn't use fabric api, but I'm about to go to sleep. I'll post it here in the morning

systemless (196683878935560192) at Wed, 03 Apr 2024 08:38:59 GMT

One thing that is important to take note of is that Quilt isn't a supported modloader.

But it seems to be a bug in Quilt if it breaks in the presence of vanilla packets. We're not expecting our packet to be handled by the modloader. This is a feature that allows servers to check if Essential is installed (f.ex. for the cubecraft partnership we did a while back)

Essential Support Bot#4488 (1012730938054160404) at Wed, 03 Apr 2024 09:39:20 GMT

Hey @OroArmor, we're waiting for a response here! If you're happy with the answer you can close the ticket with the button in the first message. Reminder 1/2 - the next one will be sent Thu, 04 Apr 2024 08:39:17 GMT (relative time).

oroarmor (365708770262777856) at Wed, 03 Apr 2024 16:40:12 GMT

then the packet should only be sent if the connection is not local, but thats harder to detect.

PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeIdentifier(new Identifier("register"));
buf.writeBytes("essential:".getBytes(StandardCharsets.UTF_8));
this.send(new CustomPayloadC2SPacket(buf));

replacing the body of this method with this code should would and allow the packet to be processed correctly by both fabric and quilt. You are free to use this code and i dont claim any right to it, just to make sure there are no copyright issues. Screenshot 2024-04-03 093709

crpxl (108132758131376128) at Wed, 03 Apr 2024 18:01:56 GMT

we're not going to add any special handling for a broken mod loader. This is on Quilt to fix.

oroarmor (365708770262777856) at Wed, 03 Apr 2024 18:02:11 GMT

it doesnt work on fabric either

crpxl (108132758131376128) at Wed, 03 Apr 2024 18:03:25 GMT

We don't expect this packet to be handled by Fabric. It is only meant for consumption by the receiving server, not by the local client.

oroarmor (365708770262777856) at Wed, 03 Apr 2024 18:03:35 GMT

then dont send it to the local server

you break a contract that vanilla creates, how is that on quilt

crpxl (108132758131376128) at Wed, 03 Apr 2024 18:05:30 GMT

no, we're specifically breaking a contract that Quilt creates, which is the expectation that this custom payload extends a certain class. If this was a vanilla contract, it would also break in Vanilla. There's not going to be a fix for this, and we're not going to go out of our way to fix crashes with Quilt. If you want compatibility, fix it on your end.

24 messages, closed by crpxl at Wed, 03 Apr 2024 18:06:03 GMT with reason: Both sides have made their standpoint clear, and we've decided not to take action

@OroArmor
Copy link
Author

OroArmor commented Apr 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment