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 RenderBoat extends Render 009 { 010 /** instance of ModelBoat for rendering */ 011 protected ModelBase modelBoat; 012 013 public RenderBoat() 014 { 015 this.shadowSize = 0.5F; 016 this.modelBoat = new ModelBoat(); 017 } 018 019 /** 020 * The render method used in RenderBoat that renders the boat model. 021 */ 022 public void renderBoat(EntityBoat par1EntityBoat, double par2, double par4, double par6, float par8, float par9) 023 { 024 GL11.glPushMatrix(); 025 GL11.glTranslatef((float)par2, (float)par4, (float)par6); 026 GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); 027 float var10 = (float)par1EntityBoat.getTimeSinceHit() - par9; 028 float var11 = (float)par1EntityBoat.getDamageTaken() - par9; 029 030 if (var11 < 0.0F) 031 { 032 var11 = 0.0F; 033 } 034 035 if (var10 > 0.0F) 036 { 037 GL11.glRotatef(MathHelper.sin(var10) * var10 * var11 / 10.0F * (float)par1EntityBoat.getForwardDirection(), 1.0F, 0.0F, 0.0F); 038 } 039 040 this.loadTexture("/terrain.png"); 041 float var12 = 0.75F; 042 GL11.glScalef(var12, var12, var12); 043 GL11.glScalef(1.0F / var12, 1.0F / var12, 1.0F / var12); 044 this.loadTexture("/item/boat.png"); 045 GL11.glScalef(-1.0F, -1.0F, 1.0F); 046 this.modelBoat.render(par1EntityBoat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); 047 GL11.glPopMatrix(); 048 } 049 050 /** 051 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then 052 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic 053 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, 054 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. 055 */ 056 public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) 057 { 058 this.renderBoat((EntityBoat)par1Entity, par2, par4, par6, par8, par9); 059 } 060 }