From 1b03e24160684b7e6bf22e6a8d35726b2d273c76 Mon Sep 17 00:00:00 2001 From: EnZaXD Date: Wed, 14 Aug 2024 09:31:27 +0200 Subject: [PATCH] Move VV specific item handling out of component<->nbt conversion in 1.20.3->1.20.5 (#4094) The current code backups the tag in CUSTOM_DATA inside the toStructuredItem function which in VB is used for to server packets which causes bad data, this PR moves the backup logic out to the VV specific handler and also prevents toOldItem logic for using the backup to ever get executed in VB. The counterpart PR will add proper handling for CUSTOM_DATA. Fixes https://github.com/ViaVersion/ViaVersion/issues/4092 --- .../rewriter/BlockItemPacketRewriter1_20_5.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java index 3dbab46c6..0cfcfc8e4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java @@ -376,13 +376,15 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter customData = data.getNonEmpty(StructuredDataKey.CUSTOM_DATA); final CompoundTag tag = customData != null ? customData.value() : new CompoundTag(); final DataItem dataItem = new DataItem(item.identifier(), (byte) item.amount(), tag); - if (customData != null && tag.remove(nbtTagName()) != null) { + if (!dataConverter.backupInconvertibleData() && customData != null && tag.remove(nbtTagName()) != null) { + // Skip for VB since it's used for incoming item data return dataItem; } @@ -605,8 +608,6 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter