SPIGOT-7174: Avoid adding air to CraftMetaBundle

This commit is contained in:
Doc 2022-10-28 19:57:22 +11:00 committed by md_5
parent aaf484f6fd
commit 982364797f
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -47,7 +47,10 @@ public class CraftMetaBundle extends CraftMetaItem implements BundleMeta {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
NBTTagCompound nbttagcompound1 = list.getCompound(i); NBTTagCompound nbttagcompound1 = list.getCompound(i);
addItem(CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of(nbttagcompound1))); ItemStack itemStack = CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of(nbttagcompound1));
if (!itemStack.getType().isAir()) { // SPIGOT-7174 - Avoid adding air
addItem(itemStack);
}
} }
} }
} }
@ -59,8 +62,8 @@ public class CraftMetaBundle extends CraftMetaItem implements BundleMeta {
Iterable<?> items = SerializableMeta.getObject(Iterable.class, map, ITEMS.BUKKIT, true); Iterable<?> items = SerializableMeta.getObject(Iterable.class, map, ITEMS.BUKKIT, true);
if (items != null) { if (items != null) {
for (Object stack : items) { for (Object stack : items) {
if (stack instanceof ItemStack) { if (stack instanceof ItemStack itemStack && !itemStack.getType().isAir()) { // SPIGOT-7174 - Avoid adding air
addItem((ItemStack) stack); addItem(itemStack);
} }
} }
} }