From d7f550fc4fbc7b3413dc5b0045f6bc941496d903 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 21 May 2024 11:20:55 +0200 Subject: [PATCH] Remove empty item tags Fixes #752 --- .../rewriter/BlockItemPacketRewriter1_20_5.java | 8 +++++++- .../rewriter/EntityPacketRewriter1_20_5.java | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java index fecb0f12..612d891c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java @@ -319,7 +319,13 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem if (item == null) return null; super.handleItemToClient(connection, item); - return vvProtocol.getItemRewriter().toOldItem(connection, item, DATA_CONVERTER); + + final Item oldItem = vvProtocol.getItemRewriter().toOldItem(connection, item, DATA_CONVERTER); + if (oldItem.tag() != null && oldItem.tag().isEmpty()) { + // Improve item equality checks by removing empty tags + oldItem.setTag(null); + } + return oldItem; } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java index 92eebee6..789bb8a4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java @@ -70,9 +70,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter