Create tag if needed

This commit is contained in:
Nassim Jahnke 2024-10-17 19:44:37 +02:00
parent fd85b67a92
commit 1b9d53af2a
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -381,10 +381,11 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem
if (customData != null) {
// We later don't know which tags are custom data and which are not because the VV conversion
// keeps converted data, so we backup the original custom data and restore it later
oldItem.tag().put(nbtTagName(), customData.copy());
if (oldItem.tag() == null) {
oldItem.setTag(new CompoundTag());
}
if (oldItem.tag() != null && oldItem.tag().isEmpty()) {
oldItem.tag().put(nbtTagName(), customData.copy());
} else if (oldItem.tag() != null && oldItem.tag().isEmpty()) {
// Improve item equality checks by removing empty tags
oldItem.setTag(null);
}