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