SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2023-06-17 06:44:22 +10:00
parent 46dda8a1e6
commit b0576f313f
2 changed files with 21 additions and 0 deletions

View File

@@ -63,6 +63,15 @@
this.items.clear();
ContainerUtil.loadAllItems(nbttagcompound, this.items);
this.lastInteractedSlot = nbttagcompound.getInt("last_interacted_slot");
@@ -91,7 +134,7 @@
this.items.set(i, ItemStack.EMPTY);
if (!itemstack.isEmpty()) {
- this.updateState(i);
+ if (level != null) this.updateState(i); // CraftBukkit - SPIGOT-7381: check for null world
}
return itemstack;
@@ -106,7 +149,7 @@
public void setItem(int i, ItemStack itemstack) {
if (itemstack.is(TagsItem.BOOKSHELF_BOOKS)) {