    001package net.minecraft.client.renderer.entity;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.renderer.Tessellator;
    006import net.minecraft.entity.Entity;
    007import net.minecraft.entity.projectile.EntityArrow;
    008import net.minecraft.util.MathHelper;
    009import org.lwjgl.opengl.GL11;
    010import org.lwjgl.opengl.GL12;
    011
    012@SideOnly(Side.CLIENT)
    013public class RenderArrow extends Render
    014{
    015    public void renderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
    016    {
    017        this.loadTexture("/item/arrows.png");
    018        GL11.glPushMatrix();
    019        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
    020        GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
    021        GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
    022        Tessellator var10 = Tessellator.instance;
    023        byte var11 = 0;
    024        float var12 = 0.0F;
    025        float var13 = 0.5F;
    026        float var14 = (float)(0 + var11 * 10) / 32.0F;
    027        float var15 = (float)(5 + var11 * 10) / 32.0F;
    028        float var16 = 0.0F;
    029        float var17 = 0.15625F;
    030        float var18 = (float)(5 + var11 * 10) / 32.0F;
    031        float var19 = (float)(10 + var11 * 10) / 32.0F;
    032        float var20 = 0.05625F;
    033        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    034        float var21 = (float)par1EntityArrow.arrowShake - par9;
    035
    036        if (var21 > 0.0F)
    037        {
    038            float var22 = -MathHelper.sin(var21 * 3.0F) * var21;
    039            GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F);
    040        }
    041
    042        GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    043        GL11.glScalef(var20, var20, var20);
    044        GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    045        GL11.glNormal3f(var20, 0.0F, 0.0F);
    046        var10.startDrawingQuads();
    047        var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var18);
    048        var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var18);
    049        var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var19);
    050        var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var19);
    051        var10.draw();
    052        GL11.glNormal3f(-var20, 0.0F, 0.0F);
    053        var10.startDrawingQuads();
    054        var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var18);
    055        var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var18);
    056        var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var19);
    057        var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var19);
    058        var10.draw();
    059
    060        for (int var23 = 0; var23 < 4; ++var23)
    061        {
    062            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    063            GL11.glNormal3f(0.0F, 0.0F, var20);
    064            var10.startDrawingQuads();
    065            var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)var12, (double)var14);
    066            var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)var13, (double)var14);
    067            var10.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)var13, (double)var15);
    068            var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)var12, (double)var15);
    069            var10.draw();
    070        }
    071
    072        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    073        GL11.glPopMatrix();
    074    }
    075
    076    /**
    077     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    078     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    079     * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    080     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    081     */
    082    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    083    {
    084        this.renderArrow((EntityArrow)par1Entity, par2, par4, par6, par8, par9);
    085    }
    086}