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