    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.awt.Color;
    006    import java.util.List;
    007    import java.util.Random;
    008    import net.minecraft.client.Minecraft;
    009    import net.minecraftforge.common.ForgeHooks;
    010
    011    import org.lwjgl.opengl.GL11;
    012    import org.lwjgl.opengl.GL12;
    013
    014    @SideOnly(Side.CLIENT)
    015    public class GuiIngame extends Gui
    016    {
    017        private static final RenderItem itemRenderer = new RenderItem();
    018        private final Random rand = new Random();
    019        private final Minecraft mc;
    020
    021        /** ChatGUI instance that retains all previous chat data */
    022        private final GuiNewChat persistantChatGUI;
    023        private int updateCounter = 0;
    024
    025        /** The string specifying which record music is playing */
    026        private String recordPlaying = "";
    027
    028        /** How many ticks the record playing message will be displayed */
    029        private int recordPlayingUpFor = 0;
    030        private boolean recordIsPlaying = false;
    031
    032        /** Previous frame vignette brightness (slowly changes by 1% each frame) */
    033        public float prevVignetteBrightness = 1.0F;
    034
    035        public GuiIngame(Minecraft par1Minecraft)
    036        {
    037            this.mc = par1Minecraft;
    038            this.persistantChatGUI = new GuiNewChat(par1Minecraft);
    039        }
    040
    041        /**
    042         * Render the ingame overlay with quick icon bar, ...
    043         */
    044        public void renderGameOverlay(float par1, boolean par2, int par3, int par4)
    045        {
    046            ScaledResolution var5 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
    047            int var6 = var5.getScaledWidth();
    048            int var7 = var5.getScaledHeight();
    049            FontRenderer var8 = this.mc.fontRenderer;
    050            this.mc.entityRenderer.setupOverlayRendering();
    051            GL11.glEnable(GL11.GL_BLEND);
    052
    053            if (Minecraft.isFancyGraphicsEnabled())
    054            {
    055                this.renderVignette(this.mc.thePlayer.getBrightness(par1), var6, var7);
    056            }
    057            else
    058            {
    059                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    060            }
    061
    062            ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);
    063
    064            if (this.mc.gameSettings.thirdPersonView == 0 && var9 != null && var9.itemID == Block.pumpkin.blockID)
    065            {
    066                this.renderPumpkinBlur(var6, var7);
    067            }
    068
    069            if (!this.mc.thePlayer.isPotionActive(Potion.confusion))
    070            {
    071                float var10 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * par1;
    072
    073                if (var10 > 0.0F)
    074                {
    075                    this.renderPortalOverlay(var10, var6, var7);
    076                }
    077            }
    078
    079            boolean var11;
    080            int var12;
    081            int var13;
    082            int var17;
    083            int var16;
    084            int var19;
    085            int var20;
    086            int var23;
    087            int var22;
    088            int var24;
    089            int var47;
    090
    091            if (!this.mc.playerController.func_78747_a())
    092            {
    093                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    094                GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/gui.png"));
    095                InventoryPlayer var31 = this.mc.thePlayer.inventory;
    096                this.zLevel = -90.0F;
    097                this.drawTexturedModalRect(var6 / 2 - 91, var7 - 22, 0, 0, 182, 22);
    098                this.drawTexturedModalRect(var6 / 2 - 91 - 1 + var31.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22);
    099                GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
    100                GL11.glEnable(GL11.GL_BLEND);
    101                GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    102                this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
    103                GL11.glDisable(GL11.GL_BLEND);
    104                var11 = this.mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
    105
    106                if (this.mc.thePlayer.hurtResistantTime < 10)
    107                {
    108                    var11 = false;
    109                }
    110
    111                var12 = this.mc.thePlayer.getHealth();
    112                var13 = this.mc.thePlayer.prevHealth;
    113                this.rand.setSeed((long)(this.updateCounter * 312871));
    114                boolean var14 = false;
    115                FoodStats var15 = this.mc.thePlayer.getFoodStats();
    116                var16 = var15.getFoodLevel();
    117                var17 = var15.getPrevFoodLevel();
    118                this.mc.mcProfiler.startSection("bossHealth");
    119                this.renderBossHealth();
    120                this.mc.mcProfiler.endSection();
    121                int var18;
    122
    123                if (this.mc.playerController.shouldDrawHUD())
    124                {
    125                    var18 = var6 / 2 - 91;
    126                    var19 = var6 / 2 + 91;
    127                    this.mc.mcProfiler.startSection("expBar");
    128                    var20 = this.mc.thePlayer.xpBarCap();
    129
    130                    if (var20 > 0)
    131                    {
    132                        short var21 = 182;
    133                        var22 = (int)(this.mc.thePlayer.experience * (float)(var21 + 1));
    134                        var23 = var7 - 32 + 3;
    135                        this.drawTexturedModalRect(var18, var23, 0, 64, var21, 5);
    136
    137                        if (var22 > 0)
    138                        {
    139                            this.drawTexturedModalRect(var18, var23, 0, 69, var22, 5);
    140                        }
    141                    }
    142
    143                    var47 = var7 - 39;
    144                    var22 = var47 - 10;
    145                    var23 = ForgeHooks.getTotalArmorValue(mc.thePlayer);
    146                    var24 = -1;
    147
    148                    if (this.mc.thePlayer.isPotionActive(Potion.regeneration))
    149                    {
    150                        var24 = this.updateCounter % 25;
    151                    }
    152
    153                    this.mc.mcProfiler.endStartSection("healthArmor");
    154                    int var25;
    155                    int var26;
    156                    int var29;
    157                    int var28;
    158
    159                    for (var25 = 0; var25 < 10; ++var25)
    160                    {
    161                        if (var23 > 0)
    162                        {
    163                            var26 = var18 + var25 * 8;
    164
    165                            if (var25 * 2 + 1 < var23)
    166                            {
    167                                this.drawTexturedModalRect(var26, var22, 34, 9, 9, 9);
    168                            }
    169
    170                            if (var25 * 2 + 1 == var23)
    171                            {
    172                                this.drawTexturedModalRect(var26, var22, 25, 9, 9, 9);
    173                            }
    174
    175                            if (var25 * 2 + 1 > var23)
    176                            {
    177                                this.drawTexturedModalRect(var26, var22, 16, 9, 9, 9);
    178                            }
    179                        }
    180
    181                        var26 = 16;
    182
    183                        if (this.mc.thePlayer.isPotionActive(Potion.poison))
    184                        {
    185                            var26 += 36;
    186                        }
    187                        else if (this.mc.thePlayer.isPotionActive(Potion.wither))
    188                        {
    189                            var26 += 72;
    190                        }
    191
    192                        byte var27 = 0;
    193
    194                        if (var11)
    195                        {
    196                            var27 = 1;
    197                        }
    198
    199                        var28 = var18 + var25 * 8;
    200                        var29 = var47;
    201
    202                        if (var12 <= 4)
    203                        {
    204                            var29 = var47 + this.rand.nextInt(2);
    205                        }
    206
    207                        if (var25 == var24)
    208                        {
    209                            var29 -= 2;
    210                        }
    211
    212                        byte var30 = 0;
    213
    214                        if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled())
    215                        {
    216                            var30 = 5;
    217                        }
    218
    219                        this.drawTexturedModalRect(var28, var29, 16 + var27 * 9, 9 * var30, 9, 9);
    220
    221                        if (var11)
    222                        {
    223                            if (var25 * 2 + 1 < var13)
    224                            {
    225                                this.drawTexturedModalRect(var28, var29, var26 + 54, 9 * var30, 9, 9);
    226                            }
    227
    228                            if (var25 * 2 + 1 == var13)
    229                            {
    230                                this.drawTexturedModalRect(var28, var29, var26 + 63, 9 * var30, 9, 9);
    231                            }
    232                        }
    233
    234                        if (var25 * 2 + 1 < var12)
    235                        {
    236                            this.drawTexturedModalRect(var28, var29, var26 + 36, 9 * var30, 9, 9);
    237                        }
    238
    239                        if (var25 * 2 + 1 == var12)
    240                        {
    241                            this.drawTexturedModalRect(var28, var29, var26 + 45, 9 * var30, 9, 9);
    242                        }
    243                    }
    244
    245                    this.mc.mcProfiler.endStartSection("food");
    246                    int var51;
    247
    248                    for (var25 = 0; var25 < 10; ++var25)
    249                    {
    250                        var26 = var47;
    251                        var51 = 16;
    252                        byte var52 = 0;
    253
    254                        if (this.mc.thePlayer.isPotionActive(Potion.hunger))
    255                        {
    256                            var51 += 36;
    257                            var52 = 13;
    258                        }
    259
    260                        if (this.mc.thePlayer.getFoodStats().getSaturationLevel() <= 0.0F && this.updateCounter % (var16 * 3 + 1) == 0)
    261                        {
    262                            var26 = var47 + (this.rand.nextInt(3) - 1);
    263                        }
    264
    265                        if (var14)
    266                        {
    267                            var52 = 1;
    268                        }
    269
    270                        var29 = var19 - var25 * 8 - 9;
    271                        this.drawTexturedModalRect(var29, var26, 16 + var52 * 9, 27, 9, 9);
    272
    273                        if (var14)
    274                        {
    275                            if (var25 * 2 + 1 < var17)
    276                            {
    277                                this.drawTexturedModalRect(var29, var26, var51 + 54, 27, 9, 9);
    278                            }
    279
    280                            if (var25 * 2 + 1 == var17)
    281                            {
    282                                this.drawTexturedModalRect(var29, var26, var51 + 63, 27, 9, 9);
    283                            }
    284                        }
    285
    286                        if (var25 * 2 + 1 < var16)
    287                        {
    288                            this.drawTexturedModalRect(var29, var26, var51 + 36, 27, 9, 9);
    289                        }
    290
    291                        if (var25 * 2 + 1 == var16)
    292                        {
    293                            this.drawTexturedModalRect(var29, var26, var51 + 45, 27, 9, 9);
    294                        }
    295                    }
    296
    297                    this.mc.mcProfiler.endStartSection("air");
    298
    299                    if (this.mc.thePlayer.isInsideOfMaterial(Material.water))
    300                    {
    301                        var25 = this.mc.thePlayer.getAir();
    302                        var26 = MathHelper.ceiling_double_int((double)(var25 - 2) * 10.0D / 300.0D);
    303                        var51 = MathHelper.ceiling_double_int((double)var25 * 10.0D / 300.0D) - var26;
    304
    305                        for (var28 = 0; var28 < var26 + var51; ++var28)
    306                        {
    307                            if (var28 < var26)
    308                            {
    309                                this.drawTexturedModalRect(var19 - var28 * 8 - 9, var22, 16, 18, 9, 9);
    310                            }
    311                            else
    312                            {
    313                                this.drawTexturedModalRect(var19 - var28 * 8 - 9, var22, 25, 18, 9, 9);
    314                            }
    315                        }
    316                    }
    317
    318                    this.mc.mcProfiler.endSection();
    319                }
    320
    321                GL11.glDisable(GL11.GL_BLEND);
    322                this.mc.mcProfiler.startSection("actionBar");
    323                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    324                RenderHelper.enableGUIStandardItemLighting();
    325
    326                for (var18 = 0; var18 < 9; ++var18)
    327                {
    328                    var19 = var6 / 2 - 90 + var18 * 20 + 2;
    329                    var20 = var7 - 16 - 3;
    330                    this.renderInventorySlot(var18, var19, var20, par1);
    331                }
    332
    333                RenderHelper.disableStandardItemLighting();
    334                GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    335                this.mc.mcProfiler.endSection();
    336            }
    337
    338            float var33;
    339
    340            if (this.mc.thePlayer.getSleepTimer() > 0)
    341            {
    342                this.mc.mcProfiler.startSection("sleep");
    343                GL11.glDisable(GL11.GL_DEPTH_TEST);
    344                GL11.glDisable(GL11.GL_ALPHA_TEST);
    345                int var32 = this.mc.thePlayer.getSleepTimer();
    346                var33 = (float)var32 / 100.0F;
    347
    348                if (var33 > 1.0F)
    349                {
    350                    var33 = 1.0F - (float)(var32 - 100) / 10.0F;
    351                }
    352
    353                var12 = (int)(220.0F * var33) << 24 | 1052704;
    354                drawRect(0, 0, var6, var7, var12);
    355                GL11.glEnable(GL11.GL_ALPHA_TEST);
    356                GL11.glEnable(GL11.GL_DEPTH_TEST);
    357                this.mc.mcProfiler.endSection();
    358            }
    359
    360            int var38;
    361            int var40;
    362
    363            if (this.mc.playerController.func_78763_f() && this.mc.thePlayer.experienceLevel > 0)
    364            {
    365                this.mc.mcProfiler.startSection("expLevel");
    366                var11 = false;
    367                var12 = var11 ? 16777215 : 8453920;
    368                String var35 = "" + this.mc.thePlayer.experienceLevel;
    369                var40 = (var6 - var8.getStringWidth(var35)) / 2;
    370                var38 = var7 - 31 - 4;
    371                var8.drawString(var35, var40 + 1, var38, 0);
    372                var8.drawString(var35, var40 - 1, var38, 0);
    373                var8.drawString(var35, var40, var38 + 1, 0);
    374                var8.drawString(var35, var40, var38 - 1, 0);
    375                var8.drawString(var35, var40, var38, var12);
    376                this.mc.mcProfiler.endSection();
    377            }
    378
    379            if (this.mc.isDemo())
    380            {
    381                this.mc.mcProfiler.startSection("demo");
    382                String var36 = "";
    383
    384                if (this.mc.theWorld.getTotalWorldTime() >= 120500L)
    385                {
    386                    var36 = StatCollector.translateToLocal("demo.demoExpired");
    387                }
    388                else
    389                {
    390                    var36 = String.format(StatCollector.translateToLocal("demo.remainingTime"), new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.theWorld.getTotalWorldTime()))});
    391                }
    392
    393                var12 = var8.getStringWidth(var36);
    394                var8.drawStringWithShadow(var36, var6 - var12 - 10, 5, 16777215);
    395                this.mc.mcProfiler.endSection();
    396            }
    397
    398            if (this.mc.gameSettings.showDebugInfo)
    399            {
    400                this.mc.mcProfiler.startSection("debug");
    401                GL11.glPushMatrix();
    402                var8.drawStringWithShadow("Minecraft 1.4.3 (" + this.mc.debug + ")", 2, 2, 16777215);
    403                var8.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
    404                var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
    405                var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
    406                var8.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215);
    407                long var41 = Runtime.getRuntime().maxMemory();
    408                long var34 = Runtime.getRuntime().totalMemory();
    409                long var42 = Runtime.getRuntime().freeMemory();
    410                long var43 = var34 - var42;
    411                String var45 = "Used memory: " + var43 * 100L / var41 + "% (" + var43 / 1024L / 1024L + "MB) of " + var41 / 1024L / 1024L + "MB";
    412                this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 2, 14737632);
    413                var45 = "Allocated memory: " + var34 * 100L / var41 + "% (" + var34 / 1024L / 1024L + "MB)";
    414                this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 12, 14737632);
    415                var47 = MathHelper.floor_double(this.mc.thePlayer.posX);
    416                var22 = MathHelper.floor_double(this.mc.thePlayer.posY);
    417                var23 = MathHelper.floor_double(this.mc.thePlayer.posZ);
    418                this.drawString(var8, String.format("x: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posX), Integer.valueOf(var47), Integer.valueOf(var47 >> 4), Integer.valueOf(var47 & 15)}), 2, 64, 14737632);
    419                this.drawString(var8, String.format("y: %.3f (feet pos, %.3f eyes pos)", new Object[] {Double.valueOf(this.mc.thePlayer.boundingBox.minY), Double.valueOf(this.mc.thePlayer.posY)}), 2, 72, 14737632);
    420                this.drawString(var8, String.format("z: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posZ), Integer.valueOf(var23), Integer.valueOf(var23 >> 4), Integer.valueOf(var23 & 15)}), 2, 80, 14737632);
    421                var24 = MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
    422                this.drawString(var8, "f: " + var24 + " (" + Direction.directions[var24] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 88, 14737632);
    423
    424                if (this.mc.theWorld != null && this.mc.theWorld.blockExists(var47, var22, var23))
    425                {
    426                    Chunk var53 = this.mc.theWorld.getChunkFromBlockCoords(var47, var23);
    427                    this.drawString(var8, "lc: " + (var53.getTopFilledSegment() + 15) + " b: " + var53.getBiomeGenForWorldCoords(var47 & 15, var23 & 15, this.mc.theWorld.getWorldChunkManager()).biomeName + " bl: " + var53.getSavedLightValue(EnumSkyBlock.Block, var47 & 15, var22, var23 & 15) + " sl: " + var53.getSavedLightValue(EnumSkyBlock.Sky, var47 & 15, var22, var23 & 15) + " rl: " + var53.getBlockLightValue(var47 & 15, var22, var23 & 15, 0), 2, 96, 14737632);
    428                }
    429
    430                this.drawString(var8, String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", new Object[] {Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()), Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var47, var23))}), 2, 104, 14737632);
    431                GL11.glPopMatrix();
    432                this.mc.mcProfiler.endSection();
    433            }
    434
    435            if (this.recordPlayingUpFor > 0)
    436            {
    437                this.mc.mcProfiler.startSection("overlayMessage");
    438                var33 = (float)this.recordPlayingUpFor - par1;
    439                var12 = (int)(var33 * 256.0F / 20.0F);
    440
    441                if (var12 > 255)
    442                {
    443                    var12 = 255;
    444                }
    445
    446                if (var12 > 0)
    447                {
    448                    GL11.glPushMatrix();
    449                    GL11.glTranslatef((float)(var6 / 2), (float)(var7 - 48), 0.0F);
    450                    GL11.glEnable(GL11.GL_BLEND);
    451                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    452                    var13 = 16777215;
    453
    454                    if (this.recordIsPlaying)
    455                    {
    456                        var13 = Color.HSBtoRGB(var33 / 50.0F, 0.7F, 0.6F) & 16777215;
    457                    }
    458
    459                    var8.drawString(this.recordPlaying, -var8.getStringWidth(this.recordPlaying) / 2, -4, var13 + (var12 << 24));
    460                    GL11.glDisable(GL11.GL_BLEND);
    461                    GL11.glPopMatrix();
    462                }
    463
    464                this.mc.mcProfiler.endSection();
    465            }
    466
    467            GL11.glEnable(GL11.GL_BLEND);
    468            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    469            GL11.glDisable(GL11.GL_ALPHA_TEST);
    470            GL11.glPushMatrix();
    471            GL11.glTranslatef(0.0F, (float)(var7 - 48), 0.0F);
    472            this.mc.mcProfiler.startSection("chat");
    473            this.persistantChatGUI.drawChat(this.updateCounter);
    474            this.mc.mcProfiler.endSection();
    475            GL11.glPopMatrix();
    476
    477            if (this.mc.gameSettings.keyBindPlayerList.pressed && (!this.mc.isIntegratedServerRunning() || this.mc.thePlayer.sendQueue.playerInfoList.size() > 1))
    478            {
    479                this.mc.mcProfiler.startSection("playerList");
    480                NetClientHandler var37 = this.mc.thePlayer.sendQueue;
    481                List var39 = var37.playerInfoList;
    482                var13 = var37.currentServerMaxPlayers;
    483                var40 = var13;
    484
    485                for (var38 = 1; var40 > 20; var40 = (var13 + var38 - 1) / var38)
    486                {
    487                    ++var38;
    488                }
    489
    490                var16 = 300 / var38;
    491
    492                if (var16 > 150)
    493                {
    494                    var16 = 150;
    495                }
    496
    497                var17 = (var6 - var38 * var16) / 2;
    498                byte var44 = 10;
    499                drawRect(var17 - 1, var44 - 1, var17 + var16 * var38, var44 + 9 * var40, Integer.MIN_VALUE);
    500
    501                for (var19 = 0; var19 < var13; ++var19)
    502                {
    503                    var20 = var17 + var19 % var38 * var16;
    504                    var47 = var44 + var19 / var38 * 9;
    505                    drawRect(var20, var47, var20 + var16 - 1, var47 + 8, 553648127);
    506                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    507                    GL11.glEnable(GL11.GL_ALPHA_TEST);
    508
    509                    if (var19 < var39.size())
    510                    {
    511                        GuiPlayerInfo var46 = (GuiPlayerInfo)var39.get(var19);
    512                        var8.drawStringWithShadow(var46.name, var20, var47, 16777215);
    513                        this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/gui/icons.png"));
    514                        byte var50 = 0;
    515                        boolean var48 = false;
    516                        byte var49;
    517
    518                        if (var46.responseTime < 0)
    519                        {
    520                            var49 = 5;
    521                        }
    522                        else if (var46.responseTime < 150)
    523                        {
    524                            var49 = 0;
    525                        }
    526                        else if (var46.responseTime < 300)
    527                        {
    528                            var49 = 1;
    529                        }
    530                        else if (var46.responseTime < 600)
    531                        {
    532                            var49 = 2;
    533                        }
    534                        else if (var46.responseTime < 1000)
    535                        {
    536                            var49 = 3;
    537                        }
    538                        else
    539                        {
    540                            var49 = 4;
    541                        }
    542
    543                        this.zLevel += 100.0F;
    544                        this.drawTexturedModalRect(var20 + var16 - 12, var47, 0 + var50 * 10, 176 + var49 * 8, 10, 8);
    545                        this.zLevel -= 100.0F;
    546                    }
    547                }
    548            }
    549
    550            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    551            GL11.glDisable(GL11.GL_LIGHTING);
    552            GL11.glEnable(GL11.GL_ALPHA_TEST);
    553        }
    554
    555        /**
    556         * Renders dragon's (boss) health on the HUD
    557         */
    558        private void renderBossHealth()
    559        {
    560            if (BossStatus.bossName != null && BossStatus.field_82826_b > 0)
    561            {
    562                --BossStatus.field_82826_b;
    563                FontRenderer var1 = this.mc.fontRenderer;
    564                ScaledResolution var2 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
    565                int var3 = var2.getScaledWidth();
    566                short var4 = 182;
    567                int var5 = var3 / 2 - var4 / 2;
    568                int var6 = (int)(BossStatus.healthScale * (float)(var4 + 1));
    569                byte var7 = 12;
    570                this.drawTexturedModalRect(var5, var7, 0, 74, var4, 5);
    571                this.drawTexturedModalRect(var5, var7, 0, 74, var4, 5);
    572
    573                if (var6 > 0)
    574                {
    575                    this.drawTexturedModalRect(var5, var7, 0, 79, var6, 5);
    576                }
    577
    578                String var8 = BossStatus.bossName;
    579                var1.drawStringWithShadow(var8, var3 / 2 - var1.getStringWidth(var8) / 2, var7 - 10, 16777215);
    580                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    581                GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
    582            }
    583        }
    584
    585        private void renderPumpkinBlur(int par1, int par2)
    586        {
    587            GL11.glDisable(GL11.GL_DEPTH_TEST);
    588            GL11.glDepthMask(false);
    589            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    590            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    591            GL11.glDisable(GL11.GL_ALPHA_TEST);
    592            GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/misc/pumpkinblur.png"));
    593            Tessellator var3 = Tessellator.instance;
    594            var3.startDrawingQuads();
    595            var3.addVertexWithUV(0.0D, (double)par2, -90.0D, 0.0D, 1.0D);
    596            var3.addVertexWithUV((double)par1, (double)par2, -90.0D, 1.0D, 1.0D);
    597            var3.addVertexWithUV((double)par1, 0.0D, -90.0D, 1.0D, 0.0D);
    598            var3.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
    599            var3.draw();
    600            GL11.glDepthMask(true);
    601            GL11.glEnable(GL11.GL_DEPTH_TEST);
    602            GL11.glEnable(GL11.GL_ALPHA_TEST);
    603            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    604        }
    605
    606        /**
    607         * Renders the vignette. Args: vignetteBrightness, width, height
    608         */
    609        private void renderVignette(float par1, int par2, int par3)
    610        {
    611            par1 = 1.0F - par1;
    612
    613            if (par1 < 0.0F)
    614            {
    615                par1 = 0.0F;
    616            }
    617
    618            if (par1 > 1.0F)
    619            {
    620                par1 = 1.0F;
    621            }
    622
    623            this.prevVignetteBrightness = (float)((double)this.prevVignetteBrightness + (double)(par1 - this.prevVignetteBrightness) * 0.01D);
    624            GL11.glDisable(GL11.GL_DEPTH_TEST);
    625            GL11.glDepthMask(false);
    626            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR);
    627            GL11.glColor4f(this.prevVignetteBrightness, this.prevVignetteBrightness, this.prevVignetteBrightness, 1.0F);
    628            GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("%blur%/misc/vignette.png"));
    629            Tessellator var4 = Tessellator.instance;
    630            var4.startDrawingQuads();
    631            var4.addVertexWithUV(0.0D, (double)par3, -90.0D, 0.0D, 1.0D);
    632            var4.addVertexWithUV((double)par2, (double)par3, -90.0D, 1.0D, 1.0D);
    633            var4.addVertexWithUV((double)par2, 0.0D, -90.0D, 1.0D, 0.0D);
    634            var4.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
    635            var4.draw();
    636            GL11.glDepthMask(true);
    637            GL11.glEnable(GL11.GL_DEPTH_TEST);
    638            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    639            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    640        }
    641
    642        /**
    643         * Renders the portal overlay. Args: portalStrength, width, height
    644         */
    645        private void renderPortalOverlay(float par1, int par2, int par3)
    646        {
    647            if (par1 < 1.0F)
    648            {
    649                par1 *= par1;
    650                par1 *= par1;
    651                par1 = par1 * 0.8F + 0.2F;
    652            }
    653
    654            GL11.glDisable(GL11.GL_ALPHA_TEST);
    655            GL11.glDisable(GL11.GL_DEPTH_TEST);
    656            GL11.glDepthMask(false);
    657            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    658            GL11.glColor4f(1.0F, 1.0F, 1.0F, par1);
    659            GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
    660            float var4 = (float)(Block.portal.blockIndexInTexture % 16) / 16.0F;
    661            float var5 = (float)(Block.portal.blockIndexInTexture / 16) / 16.0F;
    662            float var6 = (float)(Block.portal.blockIndexInTexture % 16 + 1) / 16.0F;
    663            float var7 = (float)(Block.portal.blockIndexInTexture / 16 + 1) / 16.0F;
    664            Tessellator var8 = Tessellator.instance;
    665            var8.startDrawingQuads();
    666            var8.addVertexWithUV(0.0D, (double)par3, -90.0D, (double)var4, (double)var7);
    667            var8.addVertexWithUV((double)par2, (double)par3, -90.0D, (double)var6, (double)var7);
    668            var8.addVertexWithUV((double)par2, 0.0D, -90.0D, (double)var6, (double)var5);
    669            var8.addVertexWithUV(0.0D, 0.0D, -90.0D, (double)var4, (double)var5);
    670            var8.draw();
    671            GL11.glDepthMask(true);
    672            GL11.glEnable(GL11.GL_DEPTH_TEST);
    673            GL11.glEnable(GL11.GL_ALPHA_TEST);
    674            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    675        }
    676
    677        /**
    678         * Renders the specified item of the inventory slot at the specified location. Args: slot, x, y, partialTick
    679         */
    680        private void renderInventorySlot(int par1, int par2, int par3, float par4)
    681        {
    682            ItemStack var5 = this.mc.thePlayer.inventory.mainInventory[par1];
    683
    684            if (var5 != null)
    685            {
    686                float var6 = (float)var5.animationsToGo - par4;
    687
    688                if (var6 > 0.0F)
    689                {
    690                    GL11.glPushMatrix();
    691                    float var7 = 1.0F + var6 / 5.0F;
    692                    GL11.glTranslatef((float)(par2 + 8), (float)(par3 + 12), 0.0F);
    693                    GL11.glScalef(1.0F / var7, (var7 + 1.0F) / 2.0F, 1.0F);
    694                    GL11.glTranslatef((float)(-(par2 + 8)), (float)(-(par3 + 12)), 0.0F);
    695                }
    696
    697                itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, var5, par2, par3);
    698
    699                if (var6 > 0.0F)
    700                {
    701                    GL11.glPopMatrix();
    702                }
    703
    704                itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, var5, par2, par3);
    705            }
    706        }
    707
    708        /**
    709         * The update tick for the ingame UI
    710         */
    711        public void updateTick()
    712        {
    713            if (this.recordPlayingUpFor > 0)
    714            {
    715                --this.recordPlayingUpFor;
    716            }
    717
    718            ++this.updateCounter;
    719        }
    720
    721        public void setRecordPlayingMessage(String par1Str)
    722        {
    723            this.recordPlaying = "Now playing: " + par1Str;
    724            this.recordPlayingUpFor = 60;
    725            this.recordIsPlaying = true;
    726        }
    727
    728        /**
    729         * returns a pointer to the persistant Chat GUI, containing all previous chat messages and such
    730         */
    731        public GuiNewChat getChatGUI()
    732        {
    733            return this.persistantChatGUI;
    734        }
    735
    736        public int getUpdateCounter()
    737        {
    738            return this.updateCounter;
    739        }
    740    }