Fixed a possible NPE in the cable rendering logic.
This commit is contained in:
parent
1d687f3084
commit
a0c15025b7
5 changed files with 65 additions and 55 deletions
|
@ -34,9 +34,9 @@ public class BusRenderHelper implements IPartRenderHelper
|
|||
AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
|
||||
BaseBlockRender bbr = new BaseBlockRender();
|
||||
|
||||
public ForgeDirection ax;
|
||||
public ForgeDirection ay;
|
||||
public ForgeDirection az;
|
||||
private ForgeDirection ax = ForgeDirection.EAST;
|
||||
private ForgeDirection ay = ForgeDirection.UP;
|
||||
private ForgeDirection az = ForgeDirection.SOUTH;
|
||||
|
||||
int color = 0xffffff;
|
||||
|
||||
|
@ -457,4 +457,11 @@ public class BusRenderHelper implements IPartRenderHelper
|
|||
return az;
|
||||
}
|
||||
|
||||
public void setOrientation(ForgeDirection dx, ForgeDirection dy, ForgeDirection dz)
|
||||
{
|
||||
ax = dx == null ? ForgeDirection.EAST : dx;
|
||||
ay = dy == null ? ForgeDirection.UP : dy;
|
||||
az = dz == null ? ForgeDirection.SOUTH : dz;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -112,9 +112,7 @@ public class BusRenderer implements IItemRenderer
|
|||
BusRenderHelper.instance.setInvColor( 0xffffff );
|
||||
renderer.blockAccess = ClientHelper.proxy.getWorld();
|
||||
|
||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
||||
BusRenderHelper.instance.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
renderer.useInventoryTint = false;
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,9 +61,8 @@ public class RenderBlockCrafting extends BaseBlockRender
|
|||
BusRenderHelper i = BusRenderHelper.instance;
|
||||
renderer.blockAccess = w;
|
||||
i.setPass( 0 );
|
||||
i.ax = ForgeDirection.EAST;
|
||||
i.ay = ForgeDirection.UP;
|
||||
i.az = ForgeDirection.SOUTH;
|
||||
|
||||
i.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -528,46 +528,49 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
|
||||
public void setSide(ForgeDirection s)
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
Loading…
Reference in a new issue