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