Skip to content

Commit

Permalink
Prevent comp drawer from accepting inventory into invalid slots
Browse files Browse the repository at this point in the history
  • Loading branch information
jaquadro committed Jan 30, 2015
1 parent 0444809 commit 166f5ef
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit 166f5ef

Please sign in to comment.