From 01f28a052c2c4ae7a804acfbb2d7f64667d53493 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 29 Jan 2024 10:17:00 +0100 Subject: [PATCH] Ignore errors in book conversion --- .../viaversion/protocol/ProtocolPipelineImpl.java | 7 ++++--- .../rewriter/BlockItemPacketRewriter1_20_3.java | 11 +++++++++-- .../viaversion/rewriter/EntityRewriter.java | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPipelineImpl.java b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPipelineImpl.java index d4df795e4..b45a288fa 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPipelineImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPipelineImpl.java @@ -107,7 +107,8 @@ public class ProtocolPipelineImpl extends AbstractSimpleProtocol implements Prot int originalID = packetWrapper.getId(); DebugHandler debugHandler = Via.getManager().debugHandler(); - if (debugHandler.enabled() && !debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) { + boolean debug = debugHandler.enabled(); + if (debug && !debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) { logPacket(direction, state, packetWrapper, originalID); } @@ -115,13 +116,13 @@ public class ProtocolPipelineImpl extends AbstractSimpleProtocol implements Prot packetWrapper.apply(direction, state, 0, protocolListFor(direction)); super.transform(direction, state, packetWrapper); - if (debugHandler.enabled() && debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) { + if (debug && debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) { logPacket(direction, state, packetWrapper, originalID); } } private List protocolListFor(final Direction direction) { - return Collections.unmodifiableList(direction == Direction.SERVERBOUND ? protocolList : reversedProtocolList); + return direction == Direction.SERVERBOUND ? protocolList : reversedProtocolList; } private void logPacket(Direction direction, State state, PacketWrapper packetWrapper, int originalID) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/rewriter/BlockItemPacketRewriter1_20_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/rewriter/BlockItemPacketRewriter1_20_3.java index ffa276cc2..92d345a7b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/rewriter/BlockItemPacketRewriter1_20_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/rewriter/BlockItemPacketRewriter1_20_3.java @@ -22,6 +22,7 @@ import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.google.gson.JsonElement; +import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.item.Item; @@ -160,8 +161,14 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter - * Calling {@link MetaFilter.Builder#register()} will automatically register the filter on this rewriter. + * Calling {@link com.viaversion.viaversion.rewriter.meta.MetaFilter.Builder#register()} will automatically register the filter on this rewriter. * * @return meta filter builder */ @@ -92,7 +92,7 @@ public abstract class EntityRewriter