From 82a8e2d045e075fd4623260ff942f544bf4a22b5 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 24 May 2014 11:02:24 -0500 Subject: [PATCH] Fixed http://openeye.openmods.info/crashes/df3cca6850f2c037b6adb8d8d641b22f Improved Exception for http://openeye.openmods.info/crashes/d2df850ad1915a015a80f9f7cef56ac3 Improved Exception for http://openeye.openmods.info/crashes/c8a3f70288f017726c5acd09ea91a2b0 --- parts/CableBusContainer.java | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/parts/CableBusContainer.java b/parts/CableBusContainer.java index 83241f364..d7b2e43a7 100644 --- a/parts/CableBusContainer.java +++ b/parts/CableBusContainer.java @@ -170,25 +170,28 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer is.stackSize = 1; IPart bp = bi.createPartFromItemStack( is ); - if ( bp instanceof IPartCable ) + if ( bp != null ) { - boolean canPlace = true; - for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) - if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) ) - canPlace = false; + if ( bp instanceof IPartCable ) + { + boolean canPlace = true; + for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) + if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) ) + canPlace = false; - if ( !canPlace ) - return false; + if ( !canPlace ) + return false; - return getPart( ForgeDirection.UNKNOWN ) == null; - } - else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN ) - { - IPart cable = getPart( ForgeDirection.UNKNOWN ); - if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) ) - return false; + return getPart( ForgeDirection.UNKNOWN ) == null; + } + else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN ) + { + IPart cable = getPart( ForgeDirection.UNKNOWN ); + if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) ) + return false; - return getPart( side ) == null; + return getPart( side ) == null; + } } } return false; @@ -701,7 +704,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer p.readFromNBT( extra ); } else - throw new RuntimeException( "Invalid NBT For CableBus Container." ); + throw new RuntimeException( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part." ); } } else