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