Add more info to help with debug of recipe sync weirdness.
This commit is contained in:
parent
db499e60b2
commit
5407295bed
1 changed files with 7 additions and 0 deletions
|
@ -31,6 +31,7 @@ import net.minecraft.recipe.RecipeType;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.JsonHelper;
|
import net.minecraft.util.JsonHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import reborncore.RebornCore;
|
||||||
import reborncore.common.crafting.serde.RecipeSerde;
|
import reborncore.common.crafting.serde.RecipeSerde;
|
||||||
import reborncore.common.crafting.serde.RecipeSerdeException;
|
import reborncore.common.crafting.serde.RecipeSerdeException;
|
||||||
import reborncore.common.util.serialization.SerializationUtil;
|
import reborncore.common.util.serialization.SerializationUtil;
|
||||||
|
@ -77,6 +78,12 @@ public record RebornRecipeType<R extends RebornRecipe>(
|
||||||
@Override
|
@Override
|
||||||
public void write(PacketByteBuf buffer, R recipe) {
|
public void write(PacketByteBuf buffer, R recipe) {
|
||||||
String output = SerializationUtil.GSON_FLAT.toJson(toJson(recipe, true));
|
String output = SerializationUtil.GSON_FLAT.toJson(toJson(recipe, true));
|
||||||
|
// Add more info to debug weird mods
|
||||||
|
if (output.length() > PacketByteBuf.DEFAULT_MAX_STRING_LENGTH) {
|
||||||
|
RebornCore.LOGGER.error("Recipe output string is too big. This breaks recipe books!");
|
||||||
|
RebornCore.LOGGER.error("Recipe is:" + recipe.getId().toString());
|
||||||
|
RebornCore.LOGGER.error("Output is:" + output);
|
||||||
|
}
|
||||||
buffer.writeInt(output.length());
|
buffer.writeInt(output.length());
|
||||||
buffer.writeString(output);
|
buffer.writeString(output);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue