001 package net.minecraft.client.renderer.entity;
002
003 import cpw.mods.fml.relauncher.Side;
004 import cpw.mods.fml.relauncher.SideOnly;
005 import net.minecraft.block.Block;
006 import net.minecraft.block.BlockAnvil;
007 import net.minecraft.block.BlockDragonEgg;
008 import net.minecraft.client.renderer.RenderBlocks;
009 import net.minecraft.client.renderer.Tessellator;
010 import net.minecraft.entity.Entity;
011 import net.minecraft.entity.item.EntityFallingSand;
012 import net.minecraft.util.MathHelper;
013 import net.minecraft.world.World;
014 import org.lwjgl.opengl.GL11;
015
016 @SideOnly(Side.CLIENT)
017 public class RenderFallingSand extends Render
018 {
019 private RenderBlocks sandRenderBlocks = new RenderBlocks();
020
021 public RenderFallingSand()
022 {
023 this.shadowSize = 0.5F;
024 }
025
026 /**
027 * The actual render method that is used in doRender
028 */
029 public void doRenderFallingSand(EntityFallingSand par1EntityFallingSand, double par2, double par4, double par6, float par8, float par9)
030 {
031 GL11.glPushMatrix();
032 GL11.glTranslatef((float)par2, (float)par4, (float)par6);
033 this.loadTexture("/terrain.png");
034 Block var10 = Block.blocksList[par1EntityFallingSand.blockID];
035 World var11 = par1EntityFallingSand.getWorld();
036 GL11.glDisable(GL11.GL_LIGHTING);
037 Tessellator var12;
038
039 if (var10 instanceof BlockAnvil && var10.getRenderType() == 35)
040 {
041 this.sandRenderBlocks.blockAccess = var11;
042 var12 = Tessellator.instance;
043 var12.startDrawingQuads();
044 var12.setTranslation((double)((float)(-MathHelper.floor_double(par1EntityFallingSand.posX)) - 0.5F), (double)((float)(-MathHelper.floor_double(par1EntityFallingSand.posY)) - 0.5F), (double)((float)(-MathHelper.floor_double(par1EntityFallingSand.posZ)) - 0.5F));
045 this.sandRenderBlocks.renderBlockAnvilMetadata((BlockAnvil)var10, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ), par1EntityFallingSand.metadata);
046 var12.setTranslation(0.0D, 0.0D, 0.0D);
047 var12.draw();
048 }
049 else if (var10.getRenderType() == 27)
050 {
051 this.sandRenderBlocks.blockAccess = var11;
052 var12 = Tessellator.instance;
053 var12.startDrawingQuads();
054 var12.setTranslation((double)((float)(-MathHelper.floor_double(par1EntityFallingSand.posX)) - 0.5F), (double)((float)(-MathHelper.floor_double(par1EntityFallingSand.posY)) - 0.5F), (double)((float)(-MathHelper.floor_double(par1EntityFallingSand.posZ)) - 0.5F));
055 this.sandRenderBlocks.renderBlockDragonEgg((BlockDragonEgg)var10, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ));
056 var12.setTranslation(0.0D, 0.0D, 0.0D);
057 var12.draw();
058 }
059 else if (var10 != null)
060 {
061 this.sandRenderBlocks.setRenderBoundsFromBlock(var10);
062 this.sandRenderBlocks.renderBlockSandFalling(var10, var11, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ), par1EntityFallingSand.metadata);
063 }
064
065 GL11.glEnable(GL11.GL_LIGHTING);
066 GL11.glPopMatrix();
067 }
068
069 /**
070 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
071 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
072 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
073 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
074 */
075 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
076 {
077 this.doRenderFallingSand((EntityFallingSand)par1Entity, par2, par4, par6, par8, par9);
078 }
079 }