3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 00:22:51 +01:00

Handle empty items in item lists

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-29 23:11:10 +02:00
Ursprung 5f90bcbbaf
Commit 8aa6769193
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -755,18 +755,23 @@ public final class StructuredDataConverter {
final ListTag<CompoundTag> itemsTag = new ListTag<>(CompoundTag.class);
for (final Item item : items) {
final CompoundTag savedItem = new CompoundTag();
final String name = toMappedItemName(item.identifier());
savedItem.putString("id", name);
if (backupInconvertibleData && name.isEmpty()) {
savedItem.putInt(ITEM_BACKUP_TAG_KEY, item.identifier());
}
savedItem.putByte("Count", (byte) item.amount());
if (item != null) {
final String name = toMappedItemName(item.identifier());
savedItem.putString("id", name);
if (backupInconvertibleData && name.isEmpty()) {
savedItem.putInt(ITEM_BACKUP_TAG_KEY, item.identifier());
}
savedItem.putByte("Count", (byte) item.amount());
final CompoundTag itemTag = new CompoundTag();
for (final StructuredData<?> data : item.structuredData().data().values()) {
writeToTag(data, itemTag);
final CompoundTag itemTag = new CompoundTag();
for (final StructuredData<?> data : item.structuredData().data().values()) {
writeToTag(data, itemTag);
}
savedItem.put("tag", itemTag);
} else {
savedItem.putString("id", "air");
}
savedItem.put("tag", itemTag);
itemsTag.add(savedItem);
}
tag.put(key, itemsTag);