public void renderStatic(int x, int y, int z, IPartRenderHelper instance2, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds,
boolean renderStilt)
{
if ( facade != null )
{
BusRenderHelper instance = (BusRenderHelper) instance2;
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 );
((RenderBlocksWorkaround) renderer).setTexture(
blk.getIcon( ForgeDirection.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
}
else
{
instance.setTexture( blk.getIcon( ForgeDirection.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
blk.getIcon( ForgeDirection.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
}
if ( busBounds == null )
{
if ( side == ForgeDirection.UP || side == ForgeDirection.DOWN )
{
instance.renderBlockCurrentBounds( x, y, z, renderer );
}
else if ( side == ForgeDirection.NORTH || side == ForgeDirection.SOUTH )
{
if ( fc.getFacade( ForgeDirection.UP ) != null )
renderer.renderMaxY -= getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
renderer.renderMinY += getFacadeThickness() / 16.0;
instance.renderBlockCurrentBounds( x, y, z, renderer );
}
else
{
if ( fc.getFacade( ForgeDirection.UP ) != null )
renderer.renderMaxY -= getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
renderer.renderMinY += getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
renderer.renderMaxZ -= getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
renderer.renderMinZ += getFacadeThickness() / 16.0;
instance.renderBlockCurrentBounds( x, y, z, renderer );
}
}
else
{
if ( side == ForgeDirection.UP || side == ForgeDirection.DOWN )
{
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.minZ, busBounds.minX, 1.0, busBounds.maxZ );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, busBounds.minZ, 1.0, 1.0, busBounds.maxZ );
}
else if ( side == ForgeDirection.NORTH || side == ForgeDirection.SOUTH )
{
if ( fc.getFacade( ForgeDirection.UP ) != null )
renderer.renderMaxY -= getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
renderer.renderMinY += getFacadeThickness() / 16.0;
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, 0.0, 1.0, 1.0, 1.0 );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, busBounds.minX, 1.0, 1.0 );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.minX, 0.0, 0.0, busBounds.maxX, busBounds.minY, 1.0 );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.minX, busBounds.maxY, 0.0, busBounds.maxX, 1.0, 1.0 );
}
else
{
if ( fc.getFacade( ForgeDirection.UP ) != null )
renderer.renderMaxY -= getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.DOWN ) != null )
renderer.renderMinY += getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
renderer.renderMaxZ -= getFacadeThickness() / 16.0;
if ( fc.getFacade( ForgeDirection.NORTH ) != null )
renderer.renderMinZ += getFacadeThickness() / 16.0;
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.minZ, 1.0, busBounds.minY, busBounds.maxZ );
renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, busBounds.maxY, busBounds.minZ, 1.0, 1.0, busBounds.maxZ );
}
}
if ( rbw != null )
{
rbw.opacity = 1.0f;
rbw.faces = EnumSet.allOf( ForgeDirection.class );
}
instance.renderForPass( 0 );
instance.setTexture( null );
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
}
}
}
catch (Throwable t)