Fixed a possible NPE in the cable rendering logic.
This commit is contained in:
@@ -63,8 +63,8 @@ public class CableRenderHelper
|
||||
if ( part != null )
|
||||
{
|
||||
cableBusContainer.setSide( s );
|
||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, BusRenderHelper.instance.ax, BusRenderHelper.instance.ay,
|
||||
BusRenderHelper.instance.az, null, true );
|
||||
BusRenderHelper brh = BusRenderHelper.instance;
|
||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, brh.getWorldX(), brh.getWorldY(), brh.getWorldZ(), null, true );
|
||||
part.getBoxes( bch );
|
||||
}
|
||||
}
|
||||
@@ -132,46 +132,49 @@ public class CableRenderHelper
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if ( part != null )
|
||||
{
|
||||
ForgeDirection ax, ay, az;
|
||||
|
||||
switch (s)
|
||||
{
|
||||
case DOWN:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.NORTH;
|
||||
BusRenderHelper.instance.az = ForgeDirection.DOWN;
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.SOUTH;
|
||||
BusRenderHelper.instance.az = ForgeDirection.UP;
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
break;
|
||||
case EAST:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.SOUTH;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.EAST;
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.NORTH;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.WEST;
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.WEST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.NORTH;
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
BusRenderHelper.instance.setOrientation( ax, ay, az );
|
||||
part.renderDynamic( x, y, z, BusRenderHelper.instance, BusRenderer.instance.renderer );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user