90 lines
2.7 KiB
Java
90 lines
2.7 KiB
Java
|
package biomesoplenty.blocks.renderers;
|
||
|
|
||
|
import net.minecraft.block.Block;
|
||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||
|
import net.minecraft.client.renderer.Tessellator;
|
||
|
import net.minecraft.item.Item;
|
||
|
import net.minecraft.world.IBlockAccess;
|
||
|
import net.minecraftforge.client.ForgeHooksClient;
|
||
|
import net.minecraftforge.liquids.LiquidStack;
|
||
|
|
||
|
import org.lwjgl.opengl.GL11;
|
||
|
|
||
|
import biomesoplenty.BiomesOPlenty;
|
||
|
|
||
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||
|
|
||
|
public class PuddleRender implements ISimpleBlockRenderingHandler
|
||
|
{
|
||
|
public static int puddleID = RenderingRegistry.getNextAvailableRenderId();
|
||
|
|
||
|
@Override
|
||
|
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||
|
{
|
||
|
if (modelID == puddleID)
|
||
|
{
|
||
|
RenderUtils.renderStandardInvBlock(renderer, block, metadata);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||
|
{
|
||
|
if (modelID == puddleID)
|
||
|
{
|
||
|
renderer.renderStandardBlock(block, x, y, z);
|
||
|
|
||
|
//Liquid
|
||
|
renderer.setRenderBounds(0.0, 0.8135, 0.0, 1.0, 0.8880, 1.0);
|
||
|
|
||
|
Block liquidBlock = Block.blocksList[Block.waterStill.blockID];
|
||
|
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, 0, x, y, z, renderer, world);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean shouldRender3DInInventory()
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getRenderId()
|
||
|
{
|
||
|
return puddleID;
|
||
|
}
|
||
|
|
||
|
private void renderDoRe (RenderBlocks renderblocks, Block block, int meta)
|
||
|
{
|
||
|
Tessellator tessellator = Tessellator.instance;
|
||
|
GL11.glTranslatef(-0.5F, 0.5F, -0.5F);
|
||
|
tessellator.startDrawingQuads();
|
||
|
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||
|
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||
|
tessellator.draw();
|
||
|
tessellator.startDrawingQuads();
|
||
|
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||
|
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||
|
tessellator.draw();
|
||
|
tessellator.startDrawingQuads();
|
||
|
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||
|
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||
|
tessellator.draw();
|
||
|
tessellator.startDrawingQuads();
|
||
|
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||
|
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||
|
tessellator.draw();
|
||
|
tessellator.startDrawingQuads();
|
||
|
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||
|
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||
|
tessellator.draw();
|
||
|
tessellator.startDrawingQuads();
|
||
|
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||
|
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||
|
tessellator.draw();
|
||
|
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||
|
}
|
||
|
}
|