001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005 import org.lwjgl.opengl.GL11;
006
007 @SideOnly(Side.CLIENT)
008 public class RenderFallingSand extends Render
009 {
010 private RenderBlocks renderBlocks = new RenderBlocks();
011
012 public RenderFallingSand()
013 {
014 this.shadowSize = 0.5F;
015 }
016
017 /**
018 * The actual render method that is used in doRender
019 */
020 public void doRenderFallingSand(EntityFallingSand par1EntityFallingSand, double par2, double par4, double par6, float par8, float par9)
021 {
022 GL11.glPushMatrix();
023 GL11.glTranslatef((float)par2, (float)par4, (float)par6);
024 this.loadTexture("/terrain.png");
025 Block var10 = Block.blocksList[par1EntityFallingSand.blockID];
026 World var11 = par1EntityFallingSand.getWorld();
027 GL11.glDisable(GL11.GL_LIGHTING);
028
029 if (var10.getRenderType() != 0)
030 {
031 this.renderBlocks.blockAccess = var11;
032 Tessellator var12 = Tessellator.instance;
033 var12.startDrawingQuads();
034 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));
035 this.renderBlocks.renderBlockByRenderType(var10, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ));
036 var12.setTranslation(0.0D, 0.0D, 0.0D);
037 var12.draw();
038 }
039 else if (var10 != null)
040 {
041 this.renderBlocks.func_78588_a(var10, var11, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ), par1EntityFallingSand.field_70285_b);
042 }
043
044 GL11.glEnable(GL11.GL_LIGHTING);
045 GL11.glPopMatrix();
046 }
047
048 /**
049 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
050 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
051 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
052 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
053 */
054 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
055 {
056 this.doRenderFallingSand((EntityFallingSand)par1Entity, par2, par4, par6, par8, par9);
057 }
058 }