mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
Handle empty items in item lists
This commit is contained in:
parent
5f90bcbbaf
commit
8aa6769193
@ -755,18 +755,23 @@ public final class StructuredDataConverter {
|
|||||||
final ListTag<CompoundTag> itemsTag = new ListTag<>(CompoundTag.class);
|
final ListTag<CompoundTag> itemsTag = new ListTag<>(CompoundTag.class);
|
||||||
for (final Item item : items) {
|
for (final Item item : items) {
|
||||||
final CompoundTag savedItem = new CompoundTag();
|
final CompoundTag savedItem = new CompoundTag();
|
||||||
final String name = toMappedItemName(item.identifier());
|
if (item != null) {
|
||||||
savedItem.putString("id", name);
|
final String name = toMappedItemName(item.identifier());
|
||||||
if (backupInconvertibleData && name.isEmpty()) {
|
savedItem.putString("id", name);
|
||||||
savedItem.putInt(ITEM_BACKUP_TAG_KEY, item.identifier());
|
if (backupInconvertibleData && name.isEmpty()) {
|
||||||
}
|
savedItem.putInt(ITEM_BACKUP_TAG_KEY, item.identifier());
|
||||||
savedItem.putByte("Count", (byte) item.amount());
|
}
|
||||||
|
savedItem.putByte("Count", (byte) item.amount());
|
||||||
|
|
||||||
final CompoundTag itemTag = new CompoundTag();
|
final CompoundTag itemTag = new CompoundTag();
|
||||||
for (final StructuredData<?> data : item.structuredData().data().values()) {
|
for (final StructuredData<?> data : item.structuredData().data().values()) {
|
||||||
writeToTag(data, itemTag);
|
writeToTag(data, itemTag);
|
||||||
|
}
|
||||||
|
savedItem.put("tag", itemTag);
|
||||||
|
} else {
|
||||||
|
savedItem.putString("id", "air");
|
||||||
}
|
}
|
||||||
savedItem.put("tag", itemTag);
|
|
||||||
itemsTag.add(savedItem);
|
itemsTag.add(savedItem);
|
||||||
}
|
}
|
||||||
tag.put(key, itemsTag);
|
tag.put(key, itemsTag);
|
||||||
|
Loading…
Reference in New Issue
Block a user