Hotfix item ids in 1.21 item hover events

This commit is contained in:
Nassim Jahnke 2024-08-07 17:37:24 +02:00
parent 9c2021b947
commit 55ea81f9c7
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -52,28 +52,13 @@ public final class ComponentRewriter1_21 extends TranslatableRewriter<Clientboun
} }
} }
private void handleContainerComponent(final CompoundTag tag) {
final ListTag<CompoundTag> 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 @Override
protected void handleShowItem(final UserConnection connection, final CompoundTag componentsTag) { protected void handleShowItem(final UserConnection connection, final CompoundTag itemTag, final CompoundTag componentsTag) {
convertAttributeModifiersComponent(componentsTag); super.handleShowItem(connection, itemTag, componentsTag);
handleContainerComponent(componentsTag); if (componentsTag != null) {
TagUtil.removeNamespaced(componentsTag, "jukebox_playable");
TagUtil.removeNamespaced(componentsTag, "jukebox_playable"); convertAttributeModifiersComponent(componentsTag);
}
} }
@Override @Override