@Override
public void renderBlock(RenderBlocks renderblocks, IBlockAccess world, int x, int y, int z, Block block) {
// BlockSignal structure = (BlockSignal)block;
TileSwitchBase tile = (TileSwitchBase) world.getTileEntity(x, y, z);
ITrackSwitch track = null;
boolean powered = false;
int facing = 0;
if (tile != null) {
track = tile.getSwitchTrack();
facing = tile.getFacing();
powered = tile.isPowered();
}
setTextureCore();
// Core
float f = 4.0F * PIX;
float f1 = 12.0F * PIX;
info.setBlockBounds(f, 0.0F, f, f1, 5.0F * PIX, f1);
RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
// Post
f = 7.0F * PIX;
f1 = 9.0F * PIX;
info.setBlockBounds(f, 0.0F, f, f1, 8.0F * PIX, f1);
RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
info.setBlockBounds(f, 11.0F * PIX, f, f1, 12.0F * PIX, f1);
RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
// Extensions
setTextureExtension();
if (facing == 2 || facing == 3) {
info.setBlockBounds(5.99F * PIX, 0.0F, 0.0F, 10.01F * PIX, 3.01F * PIX, 1.0F);
RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
} else {
info.setBlockBounds(0.0F, 0.0F, 5.99F * PIX, 1.0F, 3.01F * PIX, 10.01F * PIX);
RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
}
// if (type == EnumSignal.SWITCH_ROUTING) {
// if (facing == 2 || facing == 3) {
// info.setBlockBounds(0.0F, 0.0F, 5.99F * PIX, 1.0F, 3.01F * PIX, 10.01F * PIX);
// RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
// } else {
// info.setBlockBounds(5.99F * PIX, 0.0F, 2F * PIX, 10.01F * PIX, 3.01F * PIX, 1.0F);
// RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
// }
// }
// Targets
if (track == null) {
setTextureWhite();
renderTargetNorthSouth(renderblocks, world, x, y, z);
setTextureRed();
renderTargetEastWest(renderblocks, world, x, y, z);
return;
}
setTextureWhite();
ArrowDirection whiteArrow = track.getWhiteSignDirection();
renderTarget(whiteArrow, renderblocks, world, x, y, z);
setTextureRed();
ArrowDirection redArrow = track.getRedSignDirection();
renderTarget(redArrow, renderblocks, world, x, y, z);
if (type == EnumSignal.SWITCH_LEVER)
renderLever(x, y, z, facing, powered);
}