mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-21 12:42:24 +00:00
fixed items not dropping on drawer break (drawer somehow has a dupe)
This commit is contained in:
1 parent
07d59e9cc6
commit
f6fc653dd7
2 files changed
+20
-3
No files matched your search
@@ -583,7 +583,7 @@ public class BlockDrawers extends BlockContainer implements INetworked, IExtende
|
||||
if (!drawer.isDrawerEnabled(drawerIndex)) return;
|
||||
IDrawer subDrawer = drawer.getDrawer(drawerIndex);
|
||||
while (subDrawer.getStoredItemCount() > 0) {
|
||||
ItemStack stack = drawer.takeItemsFromSlot(drawerIndex, subDrawer.getStoredItemStackSize());
|
||||
ItemStack stack = drawer.takeItemsFromSlotWithDestroy(drawerIndex, subDrawer.getStoredItemStackSize());
|
||||
if (stack == null || stack.stackSize == 0) break;
|
||||
action.accept(stack);
|
||||
}
|
||||
|
||||
+19
-2
@@ -73,7 +73,7 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe
|
||||
|
||||
private int ticksClickedInARow = 9;
|
||||
private int itemsOutputInARow = 0;
|
||||
public boolean clickedOnPreviousTick = false;
|
||||
private boolean clickedOnPreviousTick = false;
|
||||
|
||||
private UUID owner;
|
||||
private String securityKey;
|
||||
@@ -596,7 +596,7 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe
|
||||
|
||||
int ticksConsecutiveClickRequirement = 50 / (itemsOutputInARow + 5);
|
||||
|
||||
if (ticksClickedInARow < ticksConsecutiveClickRequirement) return null;
|
||||
if (ticksClickedInARow < ticksConsecutiveClickRequirement) return stack;
|
||||
|
||||
ticksClickedInARow = 0;
|
||||
itemsOutputInARow++;
|
||||
@@ -614,6 +614,23 @@ public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawe
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemStack takeItemsFromSlotWithDestroy(int slot, int count) {
|
||||
if (slot < 0 || slot >= getDrawerCount()) return null;
|
||||
|
||||
ItemStack stack = getItemsFromSlot(slot, count);
|
||||
if (stack == null) return null;
|
||||
|
||||
IDrawer drawer = drawers[slot];
|
||||
drawer.setStoredItemCount(drawer.getStoredItemCount() - stack.stackSize);
|
||||
|
||||
if (isRedstone() && worldObj != null) {
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, getBlockType());
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ItemStack that will have a maximum size of {@link ItemStack#getMaxStackSize()}
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user