2013-05-22 20:08:28 +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.world.IBlockAccess;
|
|
|
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|
|
|
|
|
|
|
public class SmallBlockRenderer implements ISimpleBlockRenderingHandler
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
if (modelId == RenderUtils.bonesModel)
|
2013-05-22 20:08:28 +00:00
|
|
|
{
|
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-24 07:34:08 +00:00
|
|
|
//0.062 Approx (Per pixel)
|
2013-05-22 20:08:28 +00:00
|
|
|
if (meta == 0)
|
|
|
|
{
|
2013-05-24 22:34:03 +00:00
|
|
|
renderer.setRenderBounds(0.374F, 0.0F, 0.374F, 0.626F, 1.0F, 0.626F);
|
2013-05-22 20:08:28 +00:00
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
else if (meta == 1)
|
|
|
|
{
|
2013-05-24 22:08:58 +00:00
|
|
|
renderer.setRenderBounds(0.187F, 0.0F, 0.187F, 0.813F, 1.0F, 0.813F);
|
2013-05-23 09:06:58 +00:00
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
else if (meta == 3)
|
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.374F, 0.374F, 0.0F, 0.626F, 0.626F, 1.0F);
|
2013-05-23 09:06:58 +00:00
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
else if (meta == 4)
|
2013-05-24 07:34:08 +00:00
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.0F, 0.374F, 0.374F, 1.0F, 0.626F, 0.626F);
|
2013-05-24 07:34:08 +00:00
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
else if (meta == 5)
|
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.187F, 0.187F, 0.0F, 0.813F, 0.813F, 1.0F);
|
2013-05-24 07:34:08 +00:00
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
else if (meta == 6)
|
2013-05-23 09:06:58 +00:00
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.0F, 0.187F, 0.187F, 1.0F, 0.813F, 0.813F);
|
2013-05-22 20:08:28 +00:00
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
if (modelID == RenderUtils.bonesModel)
|
2013-05-22 20:08:28 +00:00
|
|
|
{
|
|
|
|
Tessellator tessellator = Tessellator.instance;
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-23 09:06:58 +00:00
|
|
|
if (metadata == 0)
|
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.374F, 0.0F, 0.374F, 0.626F, 1.0F, 0.626F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-23 09:06:58 +00:00
|
|
|
}
|
|
|
|
else if (metadata == 1)
|
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.187F, 0.0F, 0.187F, 0.813F, 1.0F, 0.813F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-23 09:06:58 +00:00
|
|
|
}
|
|
|
|
else if (metadata == 3)
|
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.374F, 0.374F, 0.0F, 0.626F, 0.626F, 1.0F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-23 09:06:58 +00:00
|
|
|
}
|
|
|
|
else if (metadata == 4)
|
2013-05-24 07:34:08 +00:00
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.0F, 0.374F, 0.374F, 1.0F, 0.626F, 0.626F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-24 07:34:08 +00:00
|
|
|
}
|
|
|
|
else if (metadata == 5)
|
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.187F, 0.187F, 0.0F, 0.813F, 0.813F, 1.0F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-24 07:34:08 +00:00
|
|
|
}
|
|
|
|
else if (metadata == 6)
|
2013-05-23 09:06:58 +00:00
|
|
|
{
|
2013-05-24 23:00:43 +00:00
|
|
|
renderer.setRenderBounds(0.0F, 0.187F, 0.187F, 1.0F, 0.813F, 0.813F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-23 09:06:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
2013-06-07 21:36:52 +00:00
|
|
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
2013-05-23 09:06:58 +00:00
|
|
|
}
|
2013-05-22 20:08:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldRender3DInInventory()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getRenderId()
|
|
|
|
{
|
2013-07-01 00:31:34 +00:00
|
|
|
return RenderUtils.bonesModel;
|
2013-05-22 20:08:28 +00:00
|
|
|
}
|
|
|
|
}
|