From 166f5efb865b7b80f9d5a68e6573dd901bf69201 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Thu, 29 Jan 2015 23:40:04 -0500 Subject: [PATCH] Prevent comp drawer from accepting inventory into invalid slots --- .../storagedrawers/inventory/StorageInventory.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java b/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java index ec1d4496e..fe6404f3b 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java +++ b/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java @@ -63,7 +63,11 @@ public boolean canInsertItem (int slot, ItemStack item, int side) { if (slot < lowerThresh || slot >= upperThresh) return false; - IDrawer drawer = group.getDrawer(getDrawerSlot(slot)); + int baseSlot = getDrawerSlot(slot); + if (!group.isDrawerEnabled(baseSlot)) + return false; + + IDrawer drawer = group.getDrawer(baseSlot); if (drawer == null) return false; @@ -80,7 +84,11 @@ public boolean canExtractItem (int slot, ItemStack item, int side) { if (slot < lowerThresh || slot >= upperThresh) return false; - IDrawer drawer = group.getDrawer(getDrawerSlot(slot)); + int baseSlot = getDrawerSlot(slot); + if (!group.isDrawerEnabled(baseSlot)) + return false; + + IDrawer drawer = group.getDrawer(baseSlot); if (drawer == null) return false;