@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == renderID)
{
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
Set<ForgeDirection> outputs = tile.getOutputs().keySet();
if (!outputs.contains(ForgeDirection.DOWN))//CentrePiece, floor is removed if tank below is found
{
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
else
//"Guiding Borders" when tank below is found
{
renderer.setRenderBounds(0.375D, 0.125D, 0.3125D, 0.625D, 0.5D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.375D, 0.125D, 0.625D, 0.625D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.3125D, 0.125D, 0.3125D, 0.375D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
if (outputs.contains(ForgeDirection.NORTH))//Channel to Z-
{
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
renderer.renderStandardBlock(block, x, y, z);
}
else
//Wall to Z-
{
renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
}
if (outputs.contains(ForgeDirection.SOUTH))//Channel to Z+
{
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
renderer.renderStandardBlock(block, x, y, z);
}
else
//Wall to Z+
{
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
if (outputs.contains(ForgeDirection.WEST))//Channel to X-
{
renderer.setRenderBounds(0D, 0.375D, 0.3125D, 0.3125D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
else
//Wall to X-
{
renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
if (outputs.contains(ForgeDirection.EAST))//Channel to X+
{
renderer.setRenderBounds(0.6875D, 0.375D, 0.3125D, 1D, 0.5D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 1D, 0.625D, 0.375D);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
else
//Wall to X+
{
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
renderer.renderStandardBlock(block, x, y, z);
}
FluidTankInfo tankMain = tile.getTankInfo(null)[0];
if (tankMain.fluid != null)
{
float liquidAmount = (float) tankMain.fluid.amount / (float) tankMain.capacity * 0.125f;
double startY = tile.tankBelow();
renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.51 + liquidAmount, 0.625D); //Center
renderLiquidPart(world, x, y, z, block, renderer, tankMain.fluid, false);
}
for (ForgeDirection dir : outputs)
{
double[] bounds = getRenderboundsForLiquid(dir);
if (bounds == null)
break;
FluidTankInfo tankSub = tile.getTankInfo(dir)[0];
if (tankSub == null || tankSub.fluid == null)
break;
float liquidAmount = (float) tankSub.fluid.amount / (float) tankSub.capacity * 0.125f / 2;
renderer.setRenderBounds(bounds[0], 0.51, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]);
renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, false);