From 541641595ff5bb909a8286ed66732d51a3857d29 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 23 Jul 2016 17:34:37 +0200 Subject: [PATCH] Fixed a crash with the ESD when placing it next to a non-IInventory --- .../mod/tile/TileEntityInputter.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index cf7524d76..9868a6c4b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -119,7 +119,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt * Pulls Items from the specified Slots on the specified Side */ private void pull(){ - if(this.newPulling()){ + if(this.newPulling() || !(this.placeToPull instanceof IInventory)){ return; } @@ -222,7 +222,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt * (Check pull() for Description, similar to this) */ private void put(){ - if(this.newPutting()){ + if(this.newPutting() || !(this.placeToPut instanceof IInventory)){ return; } @@ -331,6 +331,14 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if(this.placeToPull instanceof IInventory){ this.slotToPullEnd = ((IInventory)this.placeToPull).getSizeInventory(); } + else{ + if(this.placeToPull.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)){ + IItemHandler cap = this.placeToPull.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + if(cap != null){ + this.slotToPullEnd = cap.getSlots(); + } + } + } } } @@ -342,6 +350,14 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if(this.placeToPut instanceof IInventory){ this.slotToPutEnd = ((IInventory)this.placeToPut).getSizeInventory(); } + else{ + if(this.placeToPut.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)){ + IItemHandler cap = this.placeToPut.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); + if(cap != null){ + this.slotToPutEnd = cap.getSlots(); + } + } + } } } }