From 88999cd53b5dcbb2799cbf60bad79141709beb4f Mon Sep 17 00:00:00 2001 From: Parker Hawke Date: Mon, 12 Jun 2023 08:04:28 +1000 Subject: [PATCH] SPIGOT-7381: Fix NullPointerException when setting item in ChiseledBookshelfInventory snapshot --- .../block/entity/ChiseledBookShelfBlockEntity.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nms-patches/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.patch b/nms-patches/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.patch index f647d65fc..d96970439 100644 --- a/nms-patches/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.patch +++ b/nms-patches/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.patch @@ -55,6 +55,15 @@ public ChiseledBookShelfBlockEntity(BlockPosition blockposition, IBlockData iblockdata) { super(TileEntityTypes.CHISELED_BOOKSHELF, blockposition, iblockdata); +@@ -106,7 +148,7 @@ + public void setItem(int i, ItemStack itemstack) { + if (itemstack.is(TagsItem.BOOKSHELF_BOOKS)) { + this.items.set(i, itemstack); +- this.updateState(i); ++ if (level != null) this.updateState(i); // CraftBukkit - SPIGOT-7381: check for null world + } + + } @@ -120,7 +162,7 @@ @Override