    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.renderer.OpenGlHelper;
    006    import net.minecraft.client.renderer.Tessellator;
    007    import net.minecraft.entity.Entity;
    008    import net.minecraft.entity.item.EntityXPOrb;
    009    import net.minecraft.util.MathHelper;
    010    import org.lwjgl.opengl.GL11;
    011    import org.lwjgl.opengl.GL12;
    012
    013    @SideOnly(Side.CLIENT)
    014    public class RenderXPOrb extends Render
    015    {
    016        public RenderXPOrb()
    017        {
    018            this.shadowSize = 0.15F;
    019            this.shadowOpaque = 0.75F;
    020        }
    021
    022        /**
    023         * Renders the XP Orb.
    024         */
    025        public void renderTheXPOrb(EntityXPOrb par1EntityXPOrb, double par2, double par4, double par6, float par8, float par9)
    026        {
    027            GL11.glPushMatrix();
    028            GL11.glTranslatef((float)par2, (float)par4, (float)par6);
    029            int var10 = par1EntityXPOrb.getTextureByXP();
    030            this.loadTexture("/item/xporb.png");
    031            Tessellator var11 = Tessellator.instance;
    032            float var12 = (float)(var10 % 4 * 16 + 0) / 64.0F;
    033            float var13 = (float)(var10 % 4 * 16 + 16) / 64.0F;
    034            float var14 = (float)(var10 / 4 * 16 + 0) / 64.0F;
    035            float var15 = (float)(var10 / 4 * 16 + 16) / 64.0F;
    036            float var16 = 1.0F;
    037            float var17 = 0.5F;
    038            float var18 = 0.25F;
    039            int var19 = par1EntityXPOrb.getBrightnessForRender(par9);
    040            int var20 = var19 % 65536;
    041            int var21 = var19 / 65536;
    042            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var20 / 1.0F, (float)var21 / 1.0F);
    043            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    044            float var26 = 255.0F;
    045            float var27 = ((float)par1EntityXPOrb.xpColor + par9) / 2.0F;
    046            var21 = (int)((MathHelper.sin(var27 + 0.0F) + 1.0F) * 0.5F * var26);
    047            int var22 = (int)var26;
    048            int var23 = (int)((MathHelper.sin(var27 + 4.1887903F) + 1.0F) * 0.1F * var26);
    049            int var24 = var21 << 16 | var22 << 8 | var23;
    050            GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    051            GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    052            float var25 = 0.3F;
    053            GL11.glScalef(var25, var25, var25);
    054            var11.startDrawingQuads();
    055            var11.setColorRGBA_I(var24, 128);
    056            var11.setNormal(0.0F, 1.0F, 0.0F);
    057            var11.addVertexWithUV((double)(0.0F - var17), (double)(0.0F - var18), 0.0D, (double)var12, (double)var15);
    058            var11.addVertexWithUV((double)(var16 - var17), (double)(0.0F - var18), 0.0D, (double)var13, (double)var15);
    059            var11.addVertexWithUV((double)(var16 - var17), (double)(1.0F - var18), 0.0D, (double)var13, (double)var14);
    060            var11.addVertexWithUV((double)(0.0F - var17), (double)(1.0F - var18), 0.0D, (double)var12, (double)var14);
    061            var11.draw();
    062            GL11.glDisable(GL11.GL_BLEND);
    063            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    064            GL11.glPopMatrix();
    065        }
    066
    067        /**
    068         * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    069         * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    070         * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    071         * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    072         */
    073        public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    074        {
    075            this.renderTheXPOrb((EntityXPOrb)par1Entity, par2, par4, par6, par8, par9);
    076        }
    077    }