From bdd3759af65557a13ecb00015529ba2dfd4c2b5d Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 31 May 2015 02:14:19 -0400 Subject: [PATCH] Fix locking behavior again (this time thru controller) --- .../storagedrawers/api/storage/IFractionalDrawer.java | 2 +- .../minecraft/storagedrawers/inventory/StorageInventory.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java b/src/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java index 03316e3..efcf6df 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java +++ b/src/com/jaquadro/minecraft/storagedrawers/api/storage/IFractionalDrawer.java @@ -16,7 +16,7 @@ public interface IFractionalDrawer extends IDrawer /** * Gets the number of items left in the drawer if the maximum number of equivalent compressed items had been removed. - * The equivalency is determined by the conversion rate. + * The equivalency is determined by the next compression tier, and not necessarily the conversion rate. */ int getStoredItemRemainder (); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java b/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java index 8e08ad5..be4c0f2 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java +++ b/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java @@ -6,6 +6,8 @@ import com.jaquadro.minecraft.storagedrawers.api.inventory.SlotType; import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup; import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory; +import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.ILockable; +import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute; import com.jaquadro.minecraft.storagedrawers.storage.IUpgradeProvider; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -63,6 +65,9 @@ public class StorageInventory implements IDrawerInventory if (drawer == null) return false; + if (drawer.isEmpty() && drawer instanceof ILockable && ((ILockable) drawer).isLocked(LockAttribute.LOCK_EMPTY)) + return false; + return drawer.canItemBeStored(stack); }