    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import net.minecraft.client.Minecraft;
    006    import org.lwjgl.opengl.GL11;
    007    import org.lwjgl.opengl.GL12;
    008
    009    @SideOnly(Side.CLIENT)
    010    public class RenderFish extends Render
    011    {
    012        /**
    013         * Actually renders the fishing line and hook
    014         */
    015        public void doRenderFishHook(EntityFishHook par1EntityFishHook, double par2, double par4, double par6, float par8, float par9)
    016        {
    017            GL11.glPushMatrix();
    018            GL11.glTranslatef((float)par2, (float)par4, (float)par6);
    019            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    020            GL11.glScalef(0.5F, 0.5F, 0.5F);
    021            byte var10 = 1;
    022            byte var11 = 2;
    023            this.loadTexture("/particles.png");
    024            Tessellator var12 = Tessellator.instance;
    025            float var13 = (float)(var10 * 8 + 0) / 128.0F;
    026            float var14 = (float)(var10 * 8 + 8) / 128.0F;
    027            float var15 = (float)(var11 * 8 + 0) / 128.0F;
    028            float var16 = (float)(var11 * 8 + 8) / 128.0F;
    029            float var17 = 1.0F;
    030            float var18 = 0.5F;
    031            float var19 = 0.5F;
    032            GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    033            GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    034            var12.startDrawingQuads();
    035            var12.setNormal(0.0F, 1.0F, 0.0F);
    036            var12.addVertexWithUV((double)(0.0F - var18), (double)(0.0F - var19), 0.0D, (double)var13, (double)var16);
    037            var12.addVertexWithUV((double)(var17 - var18), (double)(0.0F - var19), 0.0D, (double)var14, (double)var16);
    038            var12.addVertexWithUV((double)(var17 - var18), (double)(1.0F - var19), 0.0D, (double)var14, (double)var15);
    039            var12.addVertexWithUV((double)(0.0F - var18), (double)(1.0F - var19), 0.0D, (double)var13, (double)var15);
    040            var12.draw();
    041            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    042            GL11.glPopMatrix();
    043
    044            if (par1EntityFishHook.angler != null)
    045            {
    046                float var20 = par1EntityFishHook.angler.getSwingProgress(par9);
    047                float var21 = MathHelper.sin(MathHelper.sqrt_float(var20) * (float)Math.PI);
    048                Vec3 var22 = par1EntityFishHook.worldObj.func_82732_R().getVecFromPool(-0.5D, 0.03D, 0.8D);
    049                var22.rotateAroundX(-(par1EntityFishHook.angler.prevRotationPitch + (par1EntityFishHook.angler.rotationPitch - par1EntityFishHook.angler.prevRotationPitch) * par9) * (float)Math.PI / 180.0F);
    050                var22.rotateAroundY(-(par1EntityFishHook.angler.prevRotationYaw + (par1EntityFishHook.angler.rotationYaw - par1EntityFishHook.angler.prevRotationYaw) * par9) * (float)Math.PI / 180.0F);
    051                var22.rotateAroundY(var21 * 0.5F);
    052                var22.rotateAroundX(-var21 * 0.7F);
    053                double var23 = par1EntityFishHook.angler.prevPosX + (par1EntityFishHook.angler.posX - par1EntityFishHook.angler.prevPosX) * (double)par9 + var22.xCoord;
    054                double var25 = par1EntityFishHook.angler.prevPosY + (par1EntityFishHook.angler.posY - par1EntityFishHook.angler.prevPosY) * (double)par9 + var22.yCoord;
    055                double var27 = par1EntityFishHook.angler.prevPosZ + (par1EntityFishHook.angler.posZ - par1EntityFishHook.angler.prevPosZ) * (double)par9 + var22.zCoord;
    056                double var29 = par1EntityFishHook.angler != Minecraft.getMinecraft().thePlayer ? (double)par1EntityFishHook.angler.getEyeHeight() : 0.0D;
    057
    058                if (this.renderManager.options.thirdPersonView > 0 || par1EntityFishHook.angler != Minecraft.getMinecraft().thePlayer)
    059                {
    060                    float var31 = (par1EntityFishHook.angler.prevRenderYawOffset + (par1EntityFishHook.angler.renderYawOffset - par1EntityFishHook.angler.prevRenderYawOffset) * par9) * (float)Math.PI / 180.0F;
    061                    double var32 = (double)MathHelper.sin(var31);
    062                    double var34 = (double)MathHelper.cos(var31);
    063                    var23 = par1EntityFishHook.angler.prevPosX + (par1EntityFishHook.angler.posX - par1EntityFishHook.angler.prevPosX) * (double)par9 - var34 * 0.35D - var32 * 0.85D;
    064                    var25 = par1EntityFishHook.angler.prevPosY + var29 + (par1EntityFishHook.angler.posY - par1EntityFishHook.angler.prevPosY) * (double)par9 - 0.45D;
    065                    var27 = par1EntityFishHook.angler.prevPosZ + (par1EntityFishHook.angler.posZ - par1EntityFishHook.angler.prevPosZ) * (double)par9 - var32 * 0.35D + var34 * 0.85D;
    066                }
    067
    068                double var46 = par1EntityFishHook.prevPosX + (par1EntityFishHook.posX - par1EntityFishHook.prevPosX) * (double)par9;
    069                double var33 = par1EntityFishHook.prevPosY + (par1EntityFishHook.posY - par1EntityFishHook.prevPosY) * (double)par9 + 0.25D;
    070                double var35 = par1EntityFishHook.prevPosZ + (par1EntityFishHook.posZ - par1EntityFishHook.prevPosZ) * (double)par9;
    071                double var37 = (double)((float)(var23 - var46));
    072                double var39 = (double)((float)(var25 - var33));
    073                double var41 = (double)((float)(var27 - var35));
    074                GL11.glDisable(GL11.GL_TEXTURE_2D);
    075                GL11.glDisable(GL11.GL_LIGHTING);
    076                var12.startDrawing(3);
    077                var12.setColorOpaque_I(0);
    078                byte var43 = 16;
    079
    080                for (int var44 = 0; var44 <= var43; ++var44)
    081                {
    082                    float var45 = (float)var44 / (float)var43;
    083                    var12.addVertex(par2 + var37 * (double)var45, par4 + var39 * (double)(var45 * var45 + var45) * 0.5D + 0.25D, par6 + var41 * (double)var45);
    084                }
    085
    086                var12.draw();
    087                GL11.glEnable(GL11.GL_LIGHTING);
    088                GL11.glEnable(GL11.GL_TEXTURE_2D);
    089            }
    090        }
    091
    092        /**
    093         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    094         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    095         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    096         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    097         */
    098        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    099        {
    100            this.doRenderFishHook((EntityFishHook)par1Entity, par2, par4, par6, par8, par9);
    101        }
    102    }