If datapacks add too many recipes to the game, no client can connect to it and they disconnect immediately. The reason is due to the RecipeBook packet being too big. It errors giving a DecoderException: Badly compressed packet - size of X is larger than protocol maximum of 2097152.
I got a size of 8.3M by copy pasting the vanilla recipes into different namespaces. I had in total 1792 times the amount of recipes vanilla has. So the effective limit would be around ~450x the size of all vanilla recipes.
Even if this is indeed a weird case, it is not impossible to attain this max in heavily modded or data-driven servers. Wanted to provide what I used to test, but it is too big, so I uploaded it to my drive, https://drive.google.com/file/d/1P9BJJSK5xmjCA2GQPXBCR6iNwjHdq0TW/view?usp=sharing. I calculate about 5 of these datapacks are needed to reproduce the bug (I had 16 when testing)
Also, since this is due to the recipe book, this probably does not effect only 1.15.
Attachments
Comments 8
A solution would be to split the packet sending in parts or just increse the max allowed packet size
There is a mod, that lets you increase the maximum packet size. https://www.curseforge.com/minecraft/mc-mods/randomtweaks
@Give me a new username if you are talking about mods, forge itself fixed this issue in 1.16.5-36.0.46 and I can confirm they fixed it completely
This bug has nothing to do with amount of recipes.
32994 recipes is a non-realistic value.
Although you can trigger this issue by creating recipes which use items with a lot of NBT data (lore, displayname etc).
Even 500 recipes can trigger this issue if the items satisfy my previous statement.
Cannot repeat on 1.18.2
Looks like the max packet size has increased to 8mb
Code analysis
Yarn 1.18.2 mappings
if (i > 8388608) {
throw new DecoderException("Badly compressed packet - size of " + i + " is larger than protocol maximum of 8388608");
}
Found in PacketInflater#decode
We had this pressing issue too, and here is some additional data that might help reproducing it:
[media]Datapack with 32 994 recipes:
[media],
[media]and
Datapack with 20 392 tags:
[media],
Each of the datapacks, if being used alone on a client-server Minecraft setup reveals the bug in the protocol.
The datapacks might seem large and unrealistic, but they are just test data generated by a script to illustrate the issue. In the real life scenario, as the OP says, we are not the first who is facing this problem. There were also a lot of mentions of this problem on Hypixel forums, Reddit and other resources.