    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.EntityFireball;
    008import net.minecraft.item.Item;
    009import net.minecraft.util.Icon;
    010import org.lwjgl.opengl.GL11;
    011import org.lwjgl.opengl.GL12;
    012
    013@SideOnly(Side.CLIENT)
    014public class RenderFireball extends Render
    015{
    016    private float field_77002_a;
    017
    018    public RenderFireball(float par1)
    019    {
    020        this.field_77002_a = par1;
    021    }
    022
    023    public void doRenderFireball(EntityFireball par1EntityFireball, double par2, double par4, double par6, float par8, float par9)
    024    {
    025        GL11.glPushMatrix();
    026        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
    027        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    028        float f2 = this.field_77002_a;
    029        GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
    030        Icon icon = Item.fireballCharge.getIconFromDamage(0);
    031        this.loadTexture("/gui/items.png");
    032        Tessellator tessellator = Tessellator.instance;
    033        float f3 = icon.func_94209_e();
    034        float f4 = icon.func_94212_f();
    035        float f5 = icon.func_94206_g();
    036        float f6 = icon.func_94210_h();
    037        float f7 = 1.0F;
    038        float f8 = 0.5F;
    039        float f9 = 0.25F;
    040        GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    041        GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    042        tessellator.startDrawingQuads();
    043        tessellator.setNormal(0.0F, 1.0F, 0.0F);
    044        tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6);
    045        tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6);
    046        tessellator.addVertexWithUV((double)(f7 - f8), (double)(1.0F - f9), 0.0D, (double)f4, (double)f5);
    047        tessellator.addVertexWithUV((double)(0.0F - f8), (double)(1.0F - f9), 0.0D, (double)f3, (double)f5);
    048        tessellator.draw();
    049        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    050        GL11.glPopMatrix();
    051    }
    052
    053    /**
    054     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    055     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    056     * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    057     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    058     */
    059    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    060    {
    061        this.doRenderFireball((EntityFireball)par1Entity, par2, par4, par6, par8, par9);
    062    }
    063}