1.18.2 Incompatibility with TFC on MP
pehala opened this issue ยท 3 comments
Summary
When running TFC (TerraFirmaCraft) with Alchemistry on multiplayer, I cannot join in with client due to
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: Unknown recipe serializer minecraft:
It does happen only on multiplayer, I was not able to reproduce it on singleplayer.
I am not sure if TFC or Alchemistry is causing the error, so I created two identical issues in both projects TerraFirmaCraft/TerraFirmaCraft#2198
What happens
The server showed that the client did successfully connect however it seemed it disconnected right after (after the first packet probably).
The client with debug mode shows a little bit more but not much:
debug (copy).log
Mods
- alchemistry-1.18.2-2.1.2.jar
- chemlib-1.18.2-2.0.11_340666_4035005.jar
- framework-0.2.4-1.18.2_549225_3926054.jar
- Patchouli-1.18.2-71.1_306770_3846086.jar
- TerraFirmaCraft-Forge-1.18.2-2.1.15-beta.jar
- Forge 40.1.80
I'll copy my analysis here, as this is a bug in Alchemistry's recipe serialization. TFC is just the unlucky mod that catches it and blows up.
- Alchemistry recipes have
ItemStack
s with values that are greater than 127 (Byte.MAX_VALUE
), for instance in this recipe- Alchemistry syncs these item stacks using
FriendlyByteBuf.writeItemStack()
andFriendlyByteBuf.readItem
- These methods write the item stack's count as a
byte
- When received on client, these item stacks now read a negative count (since writing
128
as a byte turns it into-128
)- The client receives this recipe as producing "-128 air"
This is a bug in alchemistry. Their recipes are being synced incorrectly, and appear to be empty on client.
Basically, if you have item stacks with a count > 127, you cannot use FriendlyByteBuf.writeItemStack / readItem
. They will write the count as a byte, you will end up with wrong values or empty stacks on client.
Thanks so much for this very detailed breakdown. This should make it super easy to fix.
Should be fixed in f378e1c. Now none of the itemstacks in the recipe are larger than 64.