BiomesOPlenty/common/biomesoplenty/blocks/renderers/AltarRenderer.java

97 lines
2.8 KiB
Java
Raw Normal View History

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;
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);
if (modelId == RenderUtils.altarModel)
{
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);
if (renderer.hasOverrideBlockTexture())
{
renderer.setOverrideBlockTexture(null);
}
if (tileentityaltar.getPresent(10))
{
2013-07-01 00:31:34 +00:00
renderAltarSlotFaces(renderer, block, BlockAltar.frameRuby, world, x, y, z);
}
if (tileentityaltar.getPresent(11))
{
2013-07-01 00:31:34 +00:00
renderAltarSlotFaces(renderer, block, BlockAltar.framePeridot, world, x, y, z);
}
if (tileentityaltar.getPresent(12))
{
2013-07-01 00:31:34 +00:00
renderAltarSlotFaces(renderer, block, BlockAltar.frameTopaz, world, x, y, z);
}
if (tileentityaltar.getPresent(13))
{
2013-07-01 00:31:34 +00:00
renderAltarSlotFaces(renderer, block, BlockAltar.frameTanzanite, world, x, y, z);
}
if (tileentityaltar.getPresent(14))
{
2013-11-06 22:04:21 +00:00
renderAltarSlotFaces(renderer, block, BlockAltar.frameMalachite, world, x, y, z);
}
if (tileentityaltar.getPresent(15))
{
2013-07-01 00:31:34 +00:00
renderAltarSlotFaces(renderer, block, BlockAltar.frameSapphire, world, x, y, z);
}
}
}
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()
{
return RenderUtils.altarModel;
}
}