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