Fixed a crash with the ESD when placing it next to a non-IInventory

This commit is contained in:
Ellpeck 2016-07-23 17:34:37 +02:00
parent 43229f2d20
commit 541641595f

View file

@ -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();
}
}
}
}
}
}