{
IIcon theIcon = null;
boolean formed = false;
boolean emitsLight = false;
TileCraftingTile ct = blk.getTileEntity( w, x, y, z );
if ( ct != null && ct.isFormed() )
{
formed = true;
emitsLight = ct.isPowered();
}
int meta = w.getBlockMetadata( x, y, z ) & 3;
boolean isMonitor = blk.getClass() == BlockCraftingMonitor.class;
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | (formed ? 8 : 0) );
IIcon nonForward = theIcon;
if ( isMonitor )
nonForward = AEApi.instance().blocks().blockCraftingUnit.block().getIcon( 0, meta | (formed ? 8 : 0) );
if ( formed && renderer.overrideBlockTexture == null )
{
renderer = BusRenderer.instance.renderer;
BusRenderHelper i = BusRenderHelper.instance;
BusRenderer.instance.renderer.isFacade = true;
renderer.blockAccess = w;
i.setPass( 0 );
i.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
try
{
ct.lightCache = i.useSimplifiedRendering( x, y, z, null, ct.lightCache );
}
catch (Throwable ignored)
{
}
float highX = isConnected( w, x, y, z, ForgeDirection.EAST ) ? 16 : 13.01f;
float lowX = isConnected( w, x, y, z, ForgeDirection.WEST ) ? 0 : 2.99f;
float highY = isConnected( w, x, y, z, ForgeDirection.UP ) ? 16 : 13.01f;
float lowY = isConnected( w, x, y, z, ForgeDirection.DOWN ) ? 0 : 2.99f;
float highZ = isConnected( w, x, y, z, ForgeDirection.SOUTH ) ? 16 : 13.01f;
float lowZ = isConnected( w, x, y, z, ForgeDirection.NORTH ) ? 0 : 2.99f;
renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.NORTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.SOUTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.WEST, ForgeDirection.NORTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.WEST, ForgeDirection.SOUTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.NORTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.SOUTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.NORTH );
renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.SOUTH );
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
i.setBounds( fso( side, lowX, ForgeDirection.WEST ), fso( side, lowY, ForgeDirection.DOWN ), fso( side, lowZ, ForgeDirection.NORTH ),
fso( side, highX, ForgeDirection.EAST ), fso( side, highY, ForgeDirection.UP ), fso( side, highZ, ForgeDirection.SOUTH ) );
i.prepareBounds( renderer );
boolean LocalEmit = emitsLight;
if ( blk instanceof BlockCraftingMonitor && !ct.getForward().equals( side ) )
LocalEmit = false;
handleSide( blk, meta, x, y, z, i, renderer, ct.getForward().equals( side ) ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
}
BusRenderer.instance.renderer.isFacade = false;
i.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
i.normalRendering();