001package net.minecraft.client.renderer.entity; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import net.minecraft.block.Block; 006import net.minecraft.block.BlockAnvil; 007import net.minecraft.block.BlockDragonEgg; 008import net.minecraft.client.renderer.RenderBlocks; 009import net.minecraft.client.renderer.Tessellator; 010import net.minecraft.entity.Entity; 011import net.minecraft.entity.item.EntityFallingSand; 012import net.minecraft.util.MathHelper; 013import net.minecraft.world.World; 014import org.lwjgl.opengl.GL11; 015 016@SideOnly(Side.CLIENT) 017public 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 block = Block.blocksList[par1EntityFallingSand.blockID]; 035 World world = par1EntityFallingSand.getWorld(); 036 GL11.glDisable(GL11.GL_LIGHTING); 037 Tessellator tessellator; 038 039 if (block instanceof BlockAnvil && block.getRenderType() == 35) 040 { 041 this.sandRenderBlocks.blockAccess = world; 042 tessellator = Tessellator.instance; 043 tessellator.startDrawingQuads(); 044 tessellator.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)block, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ), par1EntityFallingSand.metadata); 046 tessellator.setTranslation(0.0D, 0.0D, 0.0D); 047 tessellator.draw(); 048 } 049 else if (block.getRenderType() == 27) 050 { 051 this.sandRenderBlocks.blockAccess = world; 052 tessellator = Tessellator.instance; 053 tessellator.startDrawingQuads(); 054 tessellator.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)block, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ)); 056 tessellator.setTranslation(0.0D, 0.0D, 0.0D); 057 tessellator.draw(); 058 } 059 else if (block != null) 060 { 061 this.sandRenderBlocks.setRenderBoundsFromBlock(block); 062 this.sandRenderBlocks.renderBlockSandFalling(block, world, 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}