2013-06-07 21:36:52 +00:00
|
|
|
package biomesoplenty.blocks.renderers;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
import net.minecraft.client.renderer.Tessellator;
|
|
|
|
import net.minecraft.util.Icon;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
|
|
|
import biomesoplenty.blocks.BlockAltar;
|
2013-07-03 07:51:39 +00:00
|
|
|
import biomesoplenty.tileentities.TileEntityAltar;
|
2013-06-07 21:36:52 +00:00
|
|
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|
|
|
|
|
|
|
public class AltarRenderer implements ISimpleBlockRenderingHandler
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
TileEntityAltar tileentityaltar = (TileEntityAltar) world.getBlockTileEntity(x, y, z);
|
|
|
|
|
2013-06-08 07:04:09 +00:00
|
|
|
if (modelId == RenderUtils.altarModel)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
|
|
|
if (tileentityaltar != null)
|
|
|
|
{
|
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.altarFrame, world, x, y, z);
|
2013-06-09 22:45:23 +00:00
|
|
|
|
2013-07-21 10:26:12 +00:00
|
|
|
if (renderer.hasOverrideBlockTexture())
|
|
|
|
{
|
|
|
|
renderer.setOverrideBlockTexture(null);
|
|
|
|
}
|
|
|
|
|
2013-06-09 22:45:23 +00:00
|
|
|
if (tileentityaltar.getPresent(10))
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.frameRuby, world, x, y, z);
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
|
|
|
|
2013-06-09 22:45:23 +00:00
|
|
|
if (tileentityaltar.getPresent(11))
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.framePeridot, world, x, y, z);
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
|
|
|
|
if (tileentityaltar.getPresent(12))
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.frameTopaz, world, x, y, z);
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
|
|
|
|
if (tileentityaltar.getPresent(13))
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.frameTanzanite, world, x, y, z);
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
|
|
|
|
if (tileentityaltar.getPresent(14))
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.frameApatite, world, x, y, z);
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
|
|
|
|
2013-06-09 22:45:23 +00:00
|
|
|
if (tileentityaltar.getPresent(15))
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
renderAltarSlotFaces(renderer, block, BlockAltar.frameSapphire, world, x, y, z);
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void renderAltarSlotFaces(RenderBlocks renderer, Block block, Icon icon, IBlockAccess world, int x, int y, int z)
|
|
|
|
{
|
|
|
|
RenderUtils.renderFace(renderer, block, icon, world, x, y, z, ForgeDirection.NORTH);
|
|
|
|
RenderUtils.renderFace(renderer, block, icon, world, x, y, z, ForgeDirection.EAST);
|
|
|
|
RenderUtils.renderFace(renderer, block, icon, world, x, y, z, ForgeDirection.SOUTH);
|
|
|
|
RenderUtils.renderFace(renderer, block, icon, world, x, y, z, ForgeDirection.WEST);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
Tessellator tessellator = Tessellator.instance;
|
|
|
|
|
|
|
|
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldRender3DInInventory()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getRenderId()
|
|
|
|
{
|
2013-06-08 07:04:09 +00:00
|
|
|
return RenderUtils.altarModel;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
|
|
|
}
|