From 55ea81f9c719ed294e2f113d8f6f14d7299ef2bf Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 7 Aug 2024 17:37:24 +0200 Subject: [PATCH] Hotfix item ids in 1.21 item hover events --- .../rewriter/ComponentRewriter1_21.java | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/ComponentRewriter1_21.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/ComponentRewriter1_21.java index 98fad6a9..e08c1338 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/ComponentRewriter1_21.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_21to1_20_5/rewriter/ComponentRewriter1_21.java @@ -52,28 +52,13 @@ public final class ComponentRewriter1_21 extends TranslatableRewriter container = TagUtil.getNamespacedCompoundTagList(tag, "container"); - if (container == null) { - return; - } - for (final CompoundTag entryTag : container) { - final CompoundTag itemTag = entryTag.getCompoundTag("item"); - - final CompoundTag componentsTag = itemTag.getCompoundTag("components"); - if (componentsTag != null) { - convertAttributeModifiersComponent(componentsTag); - handleContainerComponent(componentsTag); - } - } - } - @Override - protected void handleShowItem(final UserConnection connection, final CompoundTag componentsTag) { - convertAttributeModifiersComponent(componentsTag); - handleContainerComponent(componentsTag); - - TagUtil.removeNamespaced(componentsTag, "jukebox_playable"); + protected void handleShowItem(final UserConnection connection, final CompoundTag itemTag, final CompoundTag componentsTag) { + super.handleShowItem(connection, itemTag, componentsTag); + if (componentsTag != null) { + TagUtil.removeNamespaced(componentsTag, "jukebox_playable"); + convertAttributeModifiersComponent(componentsTag); + } } @Override