try
{
ItemStack randomItem = getTexture();
RenderBlocksWorkaround rbw = null;
if ( renderer instanceof RenderBlocksWorkaround )
{
rbw = (RenderBlocksWorkaround) renderer;
}
if ( renderStilt && busBounds == null )
{
if ( rbw != null )
{
rbw.isFacade = false;
rbw.calculations = true;
}
IIcon myIcon = null;
if ( isBC() )
{
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
myIcon = bc.getFacadeTexture();
}
if ( myIcon == null )
myIcon = facade.getIconIndex();
instance.setTexture( myIcon );
if ( isBC() )
instance.setBounds( 6, 6, 10, 10, 10, 15 );
else
instance.setBounds( 7, 7, 10, 9, 9, 15 );
instance.renderBlock( x, y, z, renderer );
instance.setTexture( null );
}
if ( randomItem != null )
{
if ( randomItem.getItem() instanceof ItemBlock )
{
ItemBlock ib = (ItemBlock) randomItem.getItem();
Block blk = Block.getBlockFromItem( ib );
if ( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
{
if ( rbw != null )
rbw.opacity = 0.3f;
instance.renderForPass( 1 );
}
else
{
if ( blk.canRenderInPass( 1 ) )
{
instance.renderForPass( 1 );
}
}
int color = 0xffffff;
try
{
color = ib.getColorFromItemStack( randomItem, 0 );
}
catch (Throwable ignored)
{
}
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
instance.setBounds( 0, 0, 16 - getFacadeThickness(), 16, 16, 16 );
instance.prepareBounds( renderer );
if ( rbw != null )
{
rbw.isFacade = true;
rbw.calculations = true;
rbw.faces = EnumSet.noneOf( ForgeDirection.class );
if ( prevLight != null && rbw.similarLighting( blk, rbw.blockAccess, x, y, z, prevLight ) )
rbw.populate( prevLight );
else
{
instance.setRenderColor( color );
rbw.renderStandardBlock( instance.getBlock(), x, y, z );
instance.setRenderColor( 0xffffff );
prevLight = rbw.getLightingCache();
}
rbw.calculations = false;
rbw.faces = calculateFaceOpenFaces( rbw.blockAccess, fc, x, y, z, side );