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