From 33d1de7d16277fdc8035e0664e95efeceaf4ce5a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 8 Dec 2016 21:15:59 +0100 Subject: [PATCH] Fixed the Item Distributor being totally broken :^) --- .../mod/tile/TileEntityDistributorItem.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java index 0ac52e44b..885dc3ef3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDistributorItem.java @@ -42,7 +42,7 @@ public class TileEntityDistributorItem extends TileEntityInventoryBase{ for(int i = 0; i < handlerUp.getSlots(); i++){ ItemStack pullable = handlerUp.extractItem(i, 1, true); - if(StackUtil.isValid(pullable) && (!StackUtil.isValid(this.slots[0]) || ItemUtil.canBeStacked(this.slots[0], pullable))){ + if(StackUtil.isValid(pullable) && (!StackUtil.isValid(this.slots[0]) || (ItemUtil.canBeStacked(this.slots[0], pullable) && StackUtil.getStackSize(this.slots[0]) < this.slots[0].getMaxStackSize()))){ ItemStack pulled = handlerUp.extractItem(i, 1, false); if(StackUtil.isValid(pulled)){ if(!StackUtil.isValid(this.slots[0])){ @@ -86,24 +86,14 @@ public class TileEntityDistributorItem extends TileEntityInventoryBase{ toInsert = StackUtil.setStackSize(toInsert, amount); for(int i = 0; i < handler.getSlots(); i++){ - ItemStack notInserted = handler.insertItem(i, toInsert.copy(), false); - if(!StackUtil.isValid(notInserted)){ - this.slots[0] = StackUtil.addStackSize(this.slots[0], -amount); + toInsert = handler.insertItem(i, toInsert.copy(), false); + if(!StackUtil.isValid(toInsert)){ + this.slots[0] = StackUtil.addStackSize(this.slots[0], -amount); shouldMarkDirty = true; + break; } - else if(StackUtil.getStackSize(notInserted) != StackUtil.getStackSize(this.slots[0])){ - this.slots[0] = StackUtil.addStackSize(this.slots[0], -StackUtil.getStackSize(notInserted)); - toInsert = notInserted; - - shouldMarkDirty = true; - } - } - - if(!StackUtil.isValid(this.slots[0])){ - this.slots[0] = StackUtil.getNull(); - shouldMarkDirty = true; } } }