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