From 9aac386ec992f5009cfbb6670dc62e409c3e934d Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Mon, 6 Jul 2020 22:54:10 +0100 Subject: [PATCH] Last few tweaks to make bookshelf loot generation work properly --- .../electroblob/wizardry/tileentity/TileEntityBookshelf.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/electroblob/wizardry/tileentity/TileEntityBookshelf.java b/src/main/java/electroblob/wizardry/tileentity/TileEntityBookshelf.java index 65def831..e764e6aa 100644 --- a/src/main/java/electroblob/wizardry/tileentity/TileEntityBookshelf.java +++ b/src/main/java/electroblob/wizardry/tileentity/TileEntityBookshelf.java @@ -93,16 +93,17 @@ public class TileEntityBookshelf extends TileEntityLockableLoot implements ITick @Override public void setInventorySlotContents(int slot, ItemStack stack){ + this.fillWithLoot(null); boolean wasEmpty = inventory.get(slot).isEmpty(); super.setInventorySlotContents(slot, stack); // This must be done in the tile entity because containers only exist for player interaction, not hoppers etc. if(wasEmpty != stack.isEmpty()) this.sync(); - + this.markDirty(); } @Override public void fillWithLoot(@Nullable EntityPlayer player){ - if(world.getLootTableManager() != null) super.fillWithLoot(player); // IntelliJ is wrong, it can be null + if(world != null && world.getLootTableManager() != null) super.fillWithLoot(player); // IntelliJ is wrong, it can be null } @Override