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();
|
AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
|
||||||
BaseBlockRender bbr = new BaseBlockRender();
|
BaseBlockRender bbr = new BaseBlockRender();
|
||||||
|
|
||||||
public ForgeDirection ax;
|
private ForgeDirection ax = ForgeDirection.EAST;
|
||||||
public ForgeDirection ay;
|
private ForgeDirection ay = ForgeDirection.UP;
|
||||||
public ForgeDirection az;
|
private ForgeDirection az = ForgeDirection.SOUTH;
|
||||||
|
|
||||||
int color = 0xffffff;
|
int color = 0xffffff;
|
||||||
|
|
||||||
|
@ -457,4 +457,11 @@ public class BusRenderHelper implements IPartRenderHelper
|
||||||
return az;
|
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 );
|
BusRenderHelper.instance.setInvColor( 0xffffff );
|
||||||
renderer.blockAccess = ClientHelper.proxy.getWorld();
|
renderer.blockAccess = ClientHelper.proxy.getWorld();
|
||||||
|
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
BusRenderHelper.instance.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
|
||||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
|
||||||
|
|
||||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||||
renderer.useInventoryTint = false;
|
renderer.useInventoryTint = false;
|
||||||
|
|
|
@ -63,8 +63,8 @@ public class CableRenderHelper
|
||||||
if ( part != null )
|
if ( part != null )
|
||||||
{
|
{
|
||||||
cableBusContainer.setSide( s );
|
cableBusContainer.setSide( s );
|
||||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, BusRenderHelper.instance.ax, BusRenderHelper.instance.ay,
|
BusRenderHelper brh = BusRenderHelper.instance;
|
||||||
BusRenderHelper.instance.az, null, true );
|
BusCollisionHelper bch = new BusCollisionHelper( boxes, brh.getWorldX(), brh.getWorldY(), brh.getWorldZ(), null, true );
|
||||||
part.getBoxes( bch );
|
part.getBoxes( bch );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,46 +132,49 @@ public class CableRenderHelper
|
||||||
IPart part = cableBusContainer.getPart( s );
|
IPart part = cableBusContainer.getPart( s );
|
||||||
if ( part != null )
|
if ( part != null )
|
||||||
{
|
{
|
||||||
|
ForgeDirection ax, ay, az;
|
||||||
|
|
||||||
switch (s)
|
switch (s)
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.NORTH;
|
ay = ForgeDirection.NORTH;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.DOWN;
|
az = ForgeDirection.DOWN;
|
||||||
break;
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.SOUTH;
|
ay = ForgeDirection.SOUTH;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.UP;
|
az = ForgeDirection.UP;
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.SOUTH;
|
ax = ForgeDirection.SOUTH;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.EAST;
|
az = ForgeDirection.EAST;
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.NORTH;
|
ax = ForgeDirection.NORTH;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.WEST;
|
az = ForgeDirection.WEST;
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.WEST;
|
ax = ForgeDirection.WEST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.NORTH;
|
az = ForgeDirection.NORTH;
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
az = ForgeDirection.SOUTH;
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
default:
|
default:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
az = ForgeDirection.SOUTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusRenderHelper.instance.setOrientation( ax, ay, az );
|
||||||
part.renderDynamic( x, y, z, BusRenderHelper.instance, BusRenderer.instance.renderer );
|
part.renderDynamic( x, y, z, BusRenderHelper.instance, BusRenderer.instance.renderer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,8 @@ public class RenderBlockCrafting extends BaseBlockRender
|
||||||
BusRenderHelper i = BusRenderHelper.instance;
|
BusRenderHelper i = BusRenderHelper.instance;
|
||||||
renderer.blockAccess = w;
|
renderer.blockAccess = w;
|
||||||
i.setPass( 0 );
|
i.setPass( 0 );
|
||||||
i.ax = ForgeDirection.EAST;
|
|
||||||
i.ay = ForgeDirection.UP;
|
i.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||||
i.az = ForgeDirection.SOUTH;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -528,46 +528,49 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
||||||
|
|
||||||
public void setSide(ForgeDirection s)
|
public void setSide(ForgeDirection s)
|
||||||
{
|
{
|
||||||
|
ForgeDirection ax, ay, az;
|
||||||
|
|
||||||
switch (s)
|
switch (s)
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.NORTH;
|
ay = ForgeDirection.NORTH;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.DOWN;
|
az = ForgeDirection.DOWN;
|
||||||
break;
|
break;
|
||||||
case UP:
|
case UP:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.SOUTH;
|
ay = ForgeDirection.SOUTH;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.UP;
|
az = ForgeDirection.UP;
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.SOUTH;
|
ax = ForgeDirection.SOUTH;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.EAST;
|
az = ForgeDirection.EAST;
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.NORTH;
|
ax = ForgeDirection.NORTH;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.WEST;
|
az = ForgeDirection.WEST;
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.WEST;
|
ax = ForgeDirection.WEST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.NORTH;
|
az = ForgeDirection.NORTH;
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
az = ForgeDirection.SOUTH;
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
default:
|
default:
|
||||||
BusRenderHelper.instance.ax = ForgeDirection.EAST;
|
ax = ForgeDirection.EAST;
|
||||||
BusRenderHelper.instance.ay = ForgeDirection.UP;
|
ay = ForgeDirection.UP;
|
||||||
BusRenderHelper.instance.az = ForgeDirection.SOUTH;
|
az = ForgeDirection.SOUTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusRenderHelper.instance.setOrientation( ax, ay, az );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
Loading…
Reference in a new issue