add null checks in BlockCable, fixes #651

This commit is contained in:
way2muchnoise
2016-11-23 14:38:16 +01:00
parent 845c812827
commit 3714ee3abf

View File

@@ -134,7 +134,7 @@ public class BlockCable extends BlockCoverable {
.withProperty(DOWN, hasConnectionWith(world, pos, EnumFacing.DOWN));
TileNode tile = (TileNode) world.getTileEntity(pos);
if (tile != null) {
if (getPlacementType() != null) {
state = state.withProperty(DIRECTION, tile.getDirection());
}
@@ -142,6 +142,7 @@ public class BlockCable extends BlockCoverable {
if (hasConnectivityState()) {
state = state.withProperty(CONNECTED, tile.isConnected());
}
}
return state;
}
@@ -152,7 +153,8 @@ public class BlockCable extends BlockCoverable {
boolean isConnectable = API.instance().getConnectableConditions().stream().anyMatch(p -> p.test(facing));
if (isConnectable) {
// Do not render a cable extension where our cable "head" is (e.g. importer, exporter, external storage heads).
if (getPlacementType() != null && ((TileMultipartNode) world.getTileEntity(pos)).getFacingTile() == facing) {
TileMultipartNode multipartNode = ((TileMultipartNode) world.getTileEntity(pos));
if (getPlacementType() != null && multipartNode != null && multipartNode.getFacingTile() == facing) {
return false;
}