From 0c08c6c6b276581a03283d44ef285fe4f88b754b Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 9 Jul 2015 15:55:26 +0200 Subject: [PATCH] ESD: Inputs can only be smaller than the connected Inventory's Size. @dqmhose wanted that. --- .../actuallyadditions/tile/TileEntityInputter.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index 4c4b04c2c..a2fc68b85 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -17,10 +17,15 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt @Override public void onNumberReceived(int text, int textID, EntityPlayer player){ if(text != -1){ - if(textID == 0) this.slotToPutStart = text; - if(textID == 1) this.slotToPutEnd = text; - if(textID == 2) this.slotToPullStart = text; - if(textID == 3) this.slotToPullEnd = text; + if(this.placeToPut instanceof IInventory){ + if(textID == 0) this.slotToPutStart = Math.max(Math.min(text, ((IInventory)this.placeToPut).getSizeInventory()-1), 0); + if(textID == 1) this.slotToPutEnd = Math.max(Math.min(text, ((IInventory)this.placeToPut).getSizeInventory()), 0); + } + + if(this.placeToPull instanceof IInventory){ + if(textID == 2) this.slotToPullStart = Math.max(Math.min(text, ((IInventory)this.placeToPull).getSizeInventory()-1), 0); + if(textID == 3) this.slotToPullEnd = Math.max(Math.min(text, ((IInventory)this.placeToPull).getSizeInventory()), 0); + } } this.markDirty(); }