| 1 | package net.minecraft.client.gui;
|
| 2 |
|
| 3 | import com.google.common.base.Predicate;
|
| 4 | import com.google.common.collect.Iterables;
|
| 5 | import com.google.common.collect.Lists;
|
| 6 | import java.util.Collection;
|
| 7 | import java.util.List;
|
| 8 | import java.util.Random;
|
| 9 | import net.minecraft.block.material.Material;
|
| 10 | import net.minecraft.client.Minecraft;
|
| 11 | import net.minecraft.client.renderer.GlStateManager;
|
| 12 | import net.minecraft.client.renderer.RenderHelper;
|
| 13 | import net.minecraft.client.renderer.Tessellator;
|
| 14 | import net.minecraft.client.renderer.WorldRenderer;
|
| 15 | import net.minecraft.client.renderer.entity.RenderItem;
|
| 16 | import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
| 17 | import net.minecraft.client.renderer.texture.TextureMap;
|
| 18 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
| 19 | import net.minecraft.client.resources.I18n;
|
| 20 | import net.minecraft.entity.Entity;
|
| 21 | import net.minecraft.entity.EntityLivingBase;
|
| 22 | import net.minecraft.entity.SharedMonsterAttributes;
|
| 23 | import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
| 24 | import net.minecraft.entity.boss.BossStatus;
|
| 25 | import net.minecraft.entity.player.EntityPlayer;
|
| 26 | import net.minecraft.init.Blocks;
|
| 27 | import net.minecraft.inventory.IInventory;
|
| 28 | import net.minecraft.item.Item;
|
| 29 | import net.minecraft.item.ItemStack;
|
| 30 | import net.minecraft.potion.Potion;
|
| 31 | import net.minecraft.scoreboard.Score;
|
| 32 | import net.minecraft.scoreboard.ScoreObjective;
|
| 33 | import net.minecraft.scoreboard.ScorePlayerTeam;
|
| 34 | import net.minecraft.scoreboard.Scoreboard;
|
| 35 | import net.minecraft.util.BlockPos;
|
| 36 | import net.minecraft.util.EnumChatFormatting;
|
| 37 | import net.minecraft.util.FoodStats;
|
| 38 | import net.minecraft.util.IChatComponent;
|
| 39 | import net.minecraft.util.MathHelper;
|
| 40 | import net.minecraft.util.MovingObjectPosition;
|
| 41 | import net.minecraft.util.ResourceLocation;
|
| 42 | import net.minecraft.util.StringUtils;
|
| 43 | import net.minecraft.world.border.WorldBorder;
|
| 44 |
|
| 45 | public class GuiIngame extends Gui
|
| 46 | {
|
| 47 | private static final ResourceLocation vignetteTexPath = new ResourceLocation("textures/misc/vignette.png");
|
| 48 | private static final ResourceLocation widgetsTexPath = new ResourceLocation("textures/gui/widgets.png");
|
| 49 | private static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png");
|
| 50 | private final Random rand = new Random();
|
| 51 | private final Minecraft mc;
|
| 52 | private final RenderItem itemRenderer;
|
| 53 |
|
| 54 | /** ChatGUI instance that retains all previous chat data */
|
| 55 | private final GuiNewChat persistantChatGUI;
|
| 56 | private final GuiStreamIndicator streamIndicator;
|
| 57 | private int updateCounter;
|
| 58 |
|
| 59 | /** The string specifying which record music is playing */
|
| 60 | private String recordPlaying = "";
|
| 61 |
|
| 62 | /** How many ticks the record playing message will be displayed */
|
| 63 | private int recordPlayingUpFor;
|
| 64 | private boolean recordIsPlaying;
|
| 65 |
|
| 66 | /** Previous frame vignette brightness (slowly changes by 1% each frame) */
|
| 67 | public float prevVignetteBrightness = 1.0F;
|
| 68 |
|
| 69 | /** Remaining ticks the item highlight should be visible */
|
| 70 | private int remainingHighlightTicks;
|
| 71 |
|
| 72 | /** The ItemStack that is currently being highlighted */
|
| 73 | private ItemStack highlightingItemStack;
|
| 74 | private final GuiOverlayDebug overlayDebug;
|
| 75 |
|
| 76 | /** The spectator GUI for this in-game GUI instance */
|
| 77 | private final GuiSpectator spectatorGui;
|
| 78 | private final GuiPlayerTabOverlay overlayPlayerList;
|
| 79 |
|
| 80 | /** A timer for the current title and subtitle displayed */
|
| 81 | private int titlesTimer;
|
| 82 |
|
| 83 | /** The current title displayed */
|
| 84 | private String displayedTitle = "";
|
| 85 |
|
| 86 | /** The current sub-title displayed */
|
| 87 | private String displayedSubTitle = "";
|
| 88 |
|
| 89 | /** The time that the title take to fade in */
|
| 90 | private int titleFadeIn;
|
| 91 |
|
| 92 | /** The time that the title is display */
|
| 93 | private int titleDisplayTime;
|
| 94 |
|
| 95 | /** The time that the title take to fade out */
|
| 96 | private int titleFadeOut;
|
| 97 | private int playerHealth = 0;
|
| 98 | private int lastPlayerHealth = 0;
|
| 99 |
|
| 100 | /** The last recorded system time */
|
| 101 | private long lastSystemTime = 0L;
|
| 102 |
|
| 103 | /** Used with updateCounter to make the heart bar flash */
|
| 104 | private long healthUpdateCounter = 0L;
|
| 105 |
|
| 106 | public GuiIngame(Minecraft mcIn)
|
| 107 | {
|
| 108 | this.mc = mcIn;
|
| 109 | this.itemRenderer = mcIn.getRenderItem();
|
| 110 | this.overlayDebug = new GuiOverlayDebug(mcIn);
|
| 111 | this.spectatorGui = new GuiSpectator(mcIn);
|
| 112 | this.persistantChatGUI = new GuiNewChat(mcIn);
|
| 113 | this.streamIndicator = new GuiStreamIndicator(mcIn);
|
| 114 | this.overlayPlayerList = new GuiPlayerTabOverlay(mcIn, this);
|
| 115 | this.setDefaultTitlesTimes();
|
| 116 | }
|
| 117 |
|
| 118 | /**
|
| 119 | * Set the differents times for the titles to their default values
|
| 120 | */
|
| 121 | public void setDefaultTitlesTimes()
|
| 122 | {
|
| 123 | this.titleFadeIn = 10;
|
| 124 | this.titleDisplayTime = 70;
|
| 125 | this.titleFadeOut = 20;
|
| 126 | }
|
| 127 |
|
| 128 | public void renderGameOverlay(float partialTicks)
|
| 129 | {
|
| 130 | ScaledResolution scaledresolution = new ScaledResolution(this.mc);
|
| 131 | int i = scaledresolution.getScaledWidth();
|
| 132 | int j = scaledresolution.getScaledHeight();
|
| 133 | this.mc.entityRenderer.setupOverlayRendering();
|
| 134 | GlStateManager.enableBlend();
|
| 135 |
|
| 136 | if (Minecraft.isFancyGraphicsEnabled())
|
| 137 | {
|
| 138 | this.renderVignette(this.mc.thePlayer.getBrightness(partialTicks), scaledresolution);
|
| 139 | }
|
| 140 | else
|
| 141 | {
|
| 142 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 143 | }
|
| 144 |
|
| 145 | ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3);
|
| 146 |
|
| 147 | if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
|
| 148 | {
|
| 149 | this.renderPumpkinOverlay(scaledresolution);
|
| 150 | }
|
| 151 |
|
| 152 | if (!this.mc.thePlayer.isPotionActive(Potion.confusion))
|
| 153 | {
|
| 154 | float f = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * partialTicks;
|
| 155 |
|
| 156 | if (f > 0.0F)
|
| 157 | {
|
| 158 | this.renderPortal(f, scaledresolution);
|
| 159 | }
|
| 160 | }
|
| 161 |
|
| 162 | if (this.mc.playerController.isSpectator())
|
| 163 | {
|
| 164 | this.spectatorGui.renderTooltip(scaledresolution, partialTicks);
|
| 165 | }
|
| 166 | else
|
| 167 | {
|
| 168 | this.renderTooltip(scaledresolution, partialTicks);
|
| 169 | }
|
| 170 |
|
| 171 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 172 | this.mc.getTextureManager().bindTexture(icons);
|
| 173 | GlStateManager.enableBlend();
|
| 174 |
|
| 175 | if (this.showCrosshair())
|
| 176 | {
|
| 177 | GlStateManager.tryBlendFuncSeparate(775, 769, 1, 0);
|
| 178 | GlStateManager.enableAlpha();
|
| 179 | this.drawTexturedModalRect(i / 2 - 7, j / 2 - 7, 0, 0, 16, 16);
|
| 180 | }
|
| 181 |
|
| 182 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 183 | this.mc.mcProfiler.startSection("bossHealth");
|
| 184 | this.renderBossHealth();
|
| 185 | this.mc.mcProfiler.endSection();
|
| 186 |
|
| 187 | if (this.mc.playerController.shouldDrawHUD())
|
| 188 | {
|
| 189 | this.renderPlayerStats(scaledresolution);
|
| 190 | }
|
| 191 |
|
| 192 | GlStateManager.disableBlend();
|
| 193 |
|
| 194 | if (this.mc.thePlayer.getSleepTimer() > 0)
|
| 195 | {
|
| 196 | this.mc.mcProfiler.startSection("sleep");
|
| 197 | GlStateManager.disableDepth();
|
| 198 | GlStateManager.disableAlpha();
|
| 199 | int j1 = this.mc.thePlayer.getSleepTimer();
|
| 200 | float f1 = (float)j1 / 100.0F;
|
| 201 |
|
| 202 | if (f1 > 1.0F)
|
| 203 | {
|
| 204 | f1 = 1.0F - (float)(j1 - 100) / 10.0F;
|
| 205 | }
|
| 206 |
|
| 207 | int k = (int)(220.0F * f1) << 24 | 1052704;
|
| 208 | drawRect(0, 0, i, j, k);
|
| 209 | GlStateManager.enableAlpha();
|
| 210 | GlStateManager.enableDepth();
|
| 211 | this.mc.mcProfiler.endSection();
|
| 212 | }
|
| 213 |
|
| 214 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 215 | int k1 = i / 2 - 91;
|
| 216 |
|
| 217 | if (this.mc.thePlayer.isRidingHorse())
|
| 218 | {
|
| 219 | this.renderHorseJumpBar(scaledresolution, k1);
|
| 220 | }
|
| 221 | else if (this.mc.playerController.gameIsSurvivalOrAdventure())
|
| 222 | {
|
| 223 | this.renderExpBar(scaledresolution, k1);
|
| 224 | }
|
| 225 |
|
| 226 | if (this.mc.gameSettings.heldItemTooltips && !this.mc.playerController.isSpectator())
|
| 227 | {
|
| 228 | this.renderSelectedItem(scaledresolution);
|
| 229 | }
|
| 230 | else if (this.mc.thePlayer.isSpectator())
|
| 231 | {
|
| 232 | this.spectatorGui.renderSelectedItem(scaledresolution);
|
| 233 | }
|
| 234 |
|
| 235 | if (this.mc.isDemo())
|
| 236 | {
|
| 237 | this.renderDemo(scaledresolution);
|
| 238 | }
|
| 239 |
|
| 240 | if (this.mc.gameSettings.showDebugInfo)
|
| 241 | {
|
| 242 | this.overlayDebug.renderDebugInfo(scaledresolution);
|
| 243 | }
|
| 244 |
|
| 245 | if (this.recordPlayingUpFor > 0)
|
| 246 | {
|
| 247 | this.mc.mcProfiler.startSection("overlayMessage");
|
| 248 | float f2 = (float)this.recordPlayingUpFor - partialTicks;
|
| 249 | int l1 = (int)(f2 * 255.0F / 20.0F);
|
| 250 |
|
| 251 | if (l1 > 255)
|
| 252 | {
|
| 253 | l1 = 255;
|
| 254 | }
|
| 255 |
|
| 256 | if (l1 > 8)
|
| 257 | {
|
| 258 | GlStateManager.pushMatrix();
|
| 259 | GlStateManager.translate((float)(i / 2), (float)(j - 68), 0.0F);
|
| 260 | GlStateManager.enableBlend();
|
| 261 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 262 | int l = 16777215;
|
| 263 |
|
| 264 | if (this.recordIsPlaying)
|
| 265 | {
|
| 266 | l = MathHelper.hsvToRGB(f2 / 50.0F, 0.7F, 0.6F) & 16777215;
|
| 267 | }
|
| 268 |
|
| 269 | this.getFontRenderer().drawString(this.recordPlaying, -this.getFontRenderer().getStringWidth(this.recordPlaying) / 2, -4, l + (l1 << 24 & -16777216));
|
| 270 | GlStateManager.disableBlend();
|
| 271 | GlStateManager.popMatrix();
|
| 272 | }
|
| 273 |
|
| 274 | this.mc.mcProfiler.endSection();
|
| 275 | }
|
| 276 |
|
| 277 | if (this.titlesTimer > 0)
|
| 278 | {
|
| 279 | this.mc.mcProfiler.startSection("titleAndSubtitle");
|
| 280 | float f3 = (float)this.titlesTimer - partialTicks;
|
| 281 | int i2 = 255;
|
| 282 |
|
| 283 | if (this.titlesTimer > this.titleFadeOut + this.titleDisplayTime)
|
| 284 | {
|
| 285 | float f4 = (float)(this.titleFadeIn + this.titleDisplayTime + this.titleFadeOut) - f3;
|
| 286 | i2 = (int)(f4 * 255.0F / (float)this.titleFadeIn);
|
| 287 | }
|
| 288 |
|
| 289 | if (this.titlesTimer <= this.titleFadeOut)
|
| 290 | {
|
| 291 | i2 = (int)(f3 * 255.0F / (float)this.titleFadeOut);
|
| 292 | }
|
| 293 |
|
| 294 | i2 = MathHelper.clamp_int(i2, 0, 255);
|
| 295 |
|
| 296 | if (i2 > 8)
|
| 297 | {
|
| 298 | GlStateManager.pushMatrix();
|
| 299 | GlStateManager.translate((float)(i / 2), (float)(j / 2), 0.0F);
|
| 300 | GlStateManager.enableBlend();
|
| 301 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 302 | GlStateManager.pushMatrix();
|
| 303 | GlStateManager.scale(4.0F, 4.0F, 4.0F);
|
| 304 | int j2 = i2 << 24 & -16777216;
|
| 305 | this.getFontRenderer().drawString(this.displayedTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedTitle) / 2), -10.0F, 16777215 | j2, true);
|
| 306 | GlStateManager.popMatrix();
|
| 307 | GlStateManager.pushMatrix();
|
| 308 | GlStateManager.scale(2.0F, 2.0F, 2.0F);
|
| 309 | this.getFontRenderer().drawString(this.displayedSubTitle, (float)(-this.getFontRenderer().getStringWidth(this.displayedSubTitle) / 2), 5.0F, 16777215 | j2, true);
|
| 310 | GlStateManager.popMatrix();
|
| 311 | GlStateManager.disableBlend();
|
| 312 | GlStateManager.popMatrix();
|
| 313 | }
|
| 314 |
|
| 315 | this.mc.mcProfiler.endSection();
|
| 316 | }
|
| 317 |
|
| 318 | Scoreboard scoreboard = this.mc.theWorld.getScoreboard();
|
| 319 | ScoreObjective scoreobjective = null;
|
| 320 | ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(this.mc.thePlayer.getName());
|
| 321 |
|
| 322 | if (scoreplayerteam != null)
|
| 323 | {
|
| 324 | int i1 = scoreplayerteam.getChatFormat().getColorIndex();
|
| 325 |
|
| 326 | if (i1 >= 0)
|
| 327 | {
|
| 328 | scoreobjective = scoreboard.getObjectiveInDisplaySlot(3 + i1);
|
| 329 | }
|
| 330 | }
|
| 331 |
|
| 332 | ScoreObjective scoreobjective1 = scoreobjective != null ? scoreobjective : scoreboard.getObjectiveInDisplaySlot(1);
|
| 333 |
|
| 334 | if (scoreobjective1 != null)
|
| 335 | {
|
| 336 | this.renderScoreboard(scoreobjective1, scaledresolution);
|
| 337 | }
|
| 338 |
|
| 339 | GlStateManager.enableBlend();
|
| 340 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 341 | GlStateManager.disableAlpha();
|
| 342 | GlStateManager.pushMatrix();
|
| 343 | GlStateManager.translate(0.0F, (float)(j - 48), 0.0F);
|
| 344 | this.mc.mcProfiler.startSection("chat");
|
| 345 | this.persistantChatGUI.drawChat(this.updateCounter);
|
| 346 | this.mc.mcProfiler.endSection();
|
| 347 | GlStateManager.popMatrix();
|
| 348 | scoreobjective1 = scoreboard.getObjectiveInDisplaySlot(0);
|
| 349 |
|
| 350 | if (!this.mc.gameSettings.keyBindPlayerList.isKeyDown() || this.mc.isIntegratedServerRunning() && this.mc.thePlayer.sendQueue.getPlayerInfoMap().size() <= 1 && scoreobjective1 == null)
|
| 351 | {
|
| 352 | this.overlayPlayerList.updatePlayerList(false);
|
| 353 | }
|
| 354 | else
|
| 355 | {
|
| 356 | this.overlayPlayerList.updatePlayerList(true);
|
| 357 | this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1);
|
| 358 | }
|
| 359 |
|
| 360 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 361 | GlStateManager.disableLighting();
|
| 362 | GlStateManager.enableAlpha();
|
| 363 | }
|
| 364 |
|
| 365 | protected void renderTooltip(ScaledResolution sr, float partialTicks)
|
| 366 | {
|
| 367 | if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
|
| 368 | {
|
| 369 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 370 | this.mc.getTextureManager().bindTexture(widgetsTexPath);
|
| 371 | EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
|
| 372 | int i = sr.getScaledWidth() / 2;
|
| 373 | float f = this.zLevel;
|
| 374 | this.zLevel = -90.0F;
|
| 375 | this.drawTexturedModalRect(i - 91, sr.getScaledHeight() - 22, 0, 0, 182, 22);
|
| 376 | this.drawTexturedModalRect(i - 91 - 1 + entityplayer.inventory.currentItem * 20, sr.getScaledHeight() - 22 - 1, 0, 22, 24, 22);
|
| 377 | this.zLevel = f;
|
| 378 | GlStateManager.enableRescaleNormal();
|
| 379 | GlStateManager.enableBlend();
|
| 380 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 381 | RenderHelper.enableGUIStandardItemLighting();
|
| 382 |
|
| 383 | for (int j = 0; j < 9; ++j)
|
| 384 | {
|
| 385 | int k = sr.getScaledWidth() / 2 - 90 + j * 20 + 2;
|
| 386 | int l = sr.getScaledHeight() - 16 - 3;
|
| 387 | this.renderHotbarItem(j, k, l, partialTicks, entityplayer);
|
| 388 | }
|
| 389 |
|
| 390 | RenderHelper.disableStandardItemLighting();
|
| 391 | GlStateManager.disableRescaleNormal();
|
| 392 | GlStateManager.disableBlend();
|
| 393 | }
|
| 394 | }
|
| 395 |
|
| 396 | public void renderHorseJumpBar(ScaledResolution scaledRes, int x)
|
| 397 | {
|
| 398 | this.mc.mcProfiler.startSection("jumpBar");
|
| 399 | this.mc.getTextureManager().bindTexture(Gui.icons);
|
| 400 | float f = this.mc.thePlayer.getHorseJumpPower();
|
| 401 | int i = 182;
|
| 402 | int j = (int)(f * (float)(i + 1));
|
| 403 | int k = scaledRes.getScaledHeight() - 32 + 3;
|
| 404 | this.drawTexturedModalRect(x, k, 0, 84, i, 5);
|
| 405 |
|
| 406 | if (j > 0)
|
| 407 | {
|
| 408 | this.drawTexturedModalRect(x, k, 0, 89, j, 5);
|
| 409 | }
|
| 410 |
|
| 411 | this.mc.mcProfiler.endSection();
|
| 412 | }
|
| 413 |
|
| 414 | public void renderExpBar(ScaledResolution scaledRes, int x)
|
| 415 | {
|
| 416 | this.mc.mcProfiler.startSection("expBar");
|
| 417 | this.mc.getTextureManager().bindTexture(Gui.icons);
|
| 418 | int i = this.mc.thePlayer.xpBarCap();
|
| 419 |
|
| 420 | if (i > 0)
|
| 421 | {
|
| 422 | int j = 182;
|
| 423 | int k = (int)(this.mc.thePlayer.experience * (float)(j + 1));
|
| 424 | int l = scaledRes.getScaledHeight() - 32 + 3;
|
| 425 | this.drawTexturedModalRect(x, l, 0, 64, j, 5);
|
| 426 |
|
| 427 | if (k > 0)
|
| 428 | {
|
| 429 | this.drawTexturedModalRect(x, l, 0, 69, k, 5);
|
| 430 | }
|
| 431 | }
|
| 432 |
|
| 433 | this.mc.mcProfiler.endSection();
|
| 434 |
|
| 435 | if (this.mc.thePlayer.experienceLevel > 0)
|
| 436 | {
|
| 437 | this.mc.mcProfiler.startSection("expLevel");
|
| 438 | int k1 = 8453920;
|
| 439 | String s = "" + this.mc.thePlayer.experienceLevel;
|
| 440 | int l1 = (scaledRes.getScaledWidth() - this.getFontRenderer().getStringWidth(s)) / 2;
|
| 441 | int i1 = scaledRes.getScaledHeight() - 31 - 4;
|
| 442 | int j1 = 0;
|
| 443 | this.getFontRenderer().drawString(s, l1 + 1, i1, 0);
|
| 444 | this.getFontRenderer().drawString(s, l1 - 1, i1, 0);
|
| 445 | this.getFontRenderer().drawString(s, l1, i1 + 1, 0);
|
| 446 | this.getFontRenderer().drawString(s, l1, i1 - 1, 0);
|
| 447 | this.getFontRenderer().drawString(s, l1, i1, k1);
|
| 448 | this.mc.mcProfiler.endSection();
|
| 449 | }
|
| 450 | }
|
| 451 |
|
| 452 | public void renderSelectedItem(ScaledResolution scaledRes)
|
| 453 | {
|
| 454 | this.mc.mcProfiler.startSection("selectedItemName");
|
| 455 |
|
| 456 | if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null)
|
| 457 | {
|
| 458 | String s = this.highlightingItemStack.getDisplayName();
|
| 459 |
|
| 460 | if (this.highlightingItemStack.hasDisplayName())
|
| 461 | {
|
| 462 | s = EnumChatFormatting.ITALIC + s;
|
| 463 | }
|
| 464 |
|
| 465 | int i = (scaledRes.getScaledWidth() - this.getFontRenderer().getStringWidth(s)) / 2;
|
| 466 | int j = scaledRes.getScaledHeight() - 59;
|
| 467 |
|
| 468 | if (!this.mc.playerController.shouldDrawHUD())
|
| 469 | {
|
| 470 | j += 14;
|
| 471 | }
|
| 472 |
|
| 473 | int k = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);
|
| 474 |
|
| 475 | if (k > 255)
|
| 476 | {
|
| 477 | k = 255;
|
| 478 | }
|
| 479 |
|
| 480 | if (k > 0)
|
| 481 | {
|
| 482 | GlStateManager.pushMatrix();
|
| 483 | GlStateManager.enableBlend();
|
| 484 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 485 | this.getFontRenderer().drawStringWithShadow(s, (float)i, (float)j, 16777215 + (k << 24));
|
| 486 | GlStateManager.disableBlend();
|
| 487 | GlStateManager.popMatrix();
|
| 488 | }
|
| 489 | }
|
| 490 |
|
| 491 | this.mc.mcProfiler.endSection();
|
| 492 | }
|
| 493 |
|
| 494 | public void renderDemo(ScaledResolution scaledRes)
|
| 495 | {
|
| 496 | this.mc.mcProfiler.startSection("demo");
|
| 497 | String s = "";
|
| 498 |
|
| 499 | if (this.mc.theWorld.getTotalWorldTime() >= 120500L)
|
| 500 | {
|
| 501 | s = I18n.format("demo.demoExpired", new Object[0]);
|
| 502 | }
|
| 503 | else
|
| 504 | {
|
| 505 | s = I18n.format("demo.remainingTime", new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.theWorld.getTotalWorldTime()))});
|
| 506 | }
|
| 507 |
|
| 508 | int i = this.getFontRenderer().getStringWidth(s);
|
| 509 | this.getFontRenderer().drawStringWithShadow(s, (float)(scaledRes.getScaledWidth() - i - 10), 5.0F, 16777215);
|
| 510 | this.mc.mcProfiler.endSection();
|
| 511 | }
|
| 512 |
|
| 513 | protected boolean showCrosshair()
|
| 514 | {
|
| 515 | if (this.mc.gameSettings.showDebugInfo && !this.mc.thePlayer.hasReducedDebug() && !this.mc.gameSettings.reducedDebugInfo)
|
| 516 | {
|
| 517 | return false;
|
| 518 | }
|
| 519 | else if (this.mc.playerController.isSpectator())
|
| 520 | {
|
| 521 | if (this.mc.pointedEntity != null)
|
| 522 | {
|
| 523 | return true;
|
| 524 | }
|
| 525 | else
|
| 526 | {
|
| 527 | if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
| 528 | {
|
| 529 | BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
|
| 530 |
|
| 531 | if (this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory)
|
| 532 | {
|
| 533 | return true;
|
| 534 | }
|
| 535 | }
|
| 536 |
|
| 537 | return false;
|
| 538 | }
|
| 539 | }
|
| 540 | else
|
| 541 | {
|
| 542 | return true;
|
| 543 | }
|
| 544 | }
|
| 545 |
|
| 546 | public void renderStreamIndicator(ScaledResolution scaledRes)
|
| 547 | {
|
| 548 | this.streamIndicator.render(scaledRes.getScaledWidth() - 10, 10);
|
| 549 | }
|
| 550 |
|
| 551 | private void renderScoreboard(ScoreObjective objective, ScaledResolution scaledRes)
|
| 552 | {
|
| 553 | Scoreboard scoreboard = objective.getScoreboard();
|
| 554 | Collection<Score> collection = scoreboard.getSortedScores(objective);
|
| 555 | List<Score> list = Lists.newArrayList(Iterables.filter(collection, new Predicate<Score>()
|
| 556 | {
|
| 557 | public boolean apply(Score p_apply_1_)
|
| 558 | {
|
| 559 | return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#");
|
| 560 | }
|
| 561 | }));
|
| 562 |
|
| 563 | if (list.size() > 15)
|
| 564 | {
|
| 565 | collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15));
|
| 566 | }
|
| 567 | else
|
| 568 | {
|
| 569 | collection = list;
|
| 570 | }
|
| 571 |
|
| 572 | int i = this.getFontRenderer().getStringWidth(objective.getDisplayName());
|
| 573 |
|
| 574 | for (Score score : collection)
|
| 575 | {
|
| 576 | ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(score.getPlayerName());
|
| 577 | String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, score.getPlayerName()) + ": " + EnumChatFormatting.RED + score.getScorePoints();
|
| 578 | i = Math.max(i, this.getFontRenderer().getStringWidth(s));
|
| 579 | }
|
| 580 |
|
| 581 | int i1 = collection.size() * this.getFontRenderer().FONT_HEIGHT;
|
| 582 | int j1 = scaledRes.getScaledHeight() / 2 + i1 / 3;
|
| 583 | int k1 = 3;
|
| 584 | int l1 = scaledRes.getScaledWidth() - i - k1;
|
| 585 | int j = 0;
|
| 586 |
|
| 587 | for (Score score1 : collection)
|
| 588 | {
|
| 589 | ++j;
|
| 590 | ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName());
|
| 591 | String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName());
|
| 592 | String s2 = EnumChatFormatting.RED + "" + score1.getScorePoints();
|
| 593 | int k = j1 - j * this.getFontRenderer().FONT_HEIGHT;
|
| 594 | int l = scaledRes.getScaledWidth() - k1 + 2;
|
| 595 | drawRect(l1 - 2, k, l, k + this.getFontRenderer().FONT_HEIGHT, 1342177280);
|
| 596 | this.getFontRenderer().drawString(s1, l1, k, 553648127);
|
| 597 | this.getFontRenderer().drawString(s2, l - this.getFontRenderer().getStringWidth(s2), k, 553648127);
|
| 598 |
|
| 599 | if (j == collection.size())
|
| 600 | {
|
| 601 | String s3 = objective.getDisplayName();
|
| 602 | drawRect(l1 - 2, k - this.getFontRenderer().FONT_HEIGHT - 1, l, k - 1, 1610612736);
|
| 603 | drawRect(l1 - 2, k - 1, l, k, 1342177280);
|
| 604 | this.getFontRenderer().drawString(s3, l1 + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, k - this.getFontRenderer().FONT_HEIGHT, 553648127);
|
| 605 | }
|
| 606 | }
|
| 607 | }
|
| 608 |
|
| 609 | private void renderPlayerStats(ScaledResolution scaledRes)
|
| 610 | {
|
| 611 | if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
|
| 612 | {
|
| 613 | EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
|
| 614 | int i = MathHelper.ceiling_float_int(entityplayer.getHealth());
|
| 615 | boolean flag = this.healthUpdateCounter > (long)this.updateCounter && (this.healthUpdateCounter - (long)this.updateCounter) / 3L % 2L == 1L;
|
| 616 |
|
| 617 | if (i < this.playerHealth && entityplayer.hurtResistantTime > 0)
|
| 618 | {
|
| 619 | this.lastSystemTime = Minecraft.getSystemTime();
|
| 620 | this.healthUpdateCounter = (long)(this.updateCounter + 20);
|
| 621 | }
|
| 622 | else if (i > this.playerHealth && entityplayer.hurtResistantTime > 0)
|
| 623 | {
|
| 624 | this.lastSystemTime = Minecraft.getSystemTime();
|
| 625 | this.healthUpdateCounter = (long)(this.updateCounter + 10);
|
| 626 | }
|
| 627 |
|
| 628 | if (Minecraft.getSystemTime() - this.lastSystemTime > 1000L)
|
| 629 | {
|
| 630 | this.playerHealth = i;
|
| 631 | this.lastPlayerHealth = i;
|
| 632 | this.lastSystemTime = Minecraft.getSystemTime();
|
| 633 | }
|
| 634 |
|
| 635 | this.playerHealth = i;
|
| 636 | int j = this.lastPlayerHealth;
|
| 637 | this.rand.setSeed((long)(this.updateCounter * 312871));
|
| 638 | boolean flag1 = false;
|
| 639 | FoodStats foodstats = entityplayer.getFoodStats();
|
| 640 | int k = foodstats.getFoodLevel();
|
| 641 | int l = foodstats.getPrevFoodLevel();
|
| 642 | IAttributeInstance iattributeinstance = entityplayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
|
| 643 | int i1 = scaledRes.getScaledWidth() / 2 - 91;
|
| 644 | int j1 = scaledRes.getScaledWidth() / 2 + 91;
|
| 645 | int k1 = scaledRes.getScaledHeight() - 39;
|
| 646 | float f = (float)iattributeinstance.getAttributeValue();
|
| 647 | float f1 = entityplayer.getAbsorptionAmount();
|
| 648 | int l1 = MathHelper.ceiling_float_int((f + f1) / 2.0F / 10.0F);
|
| 649 | int i2 = Math.max(10 - (l1 - 2), 3);
|
| 650 | int j2 = k1 - (l1 - 1) * i2 - 10;
|
| 651 | float f2 = f1;
|
| 652 | int k2 = entityplayer.getTotalArmorValue();
|
| 653 | int l2 = -1;
|
| 654 |
|
| 655 | if (entityplayer.isPotionActive(Potion.regeneration))
|
| 656 | {
|
| 657 | l2 = this.updateCounter % MathHelper.ceiling_float_int(f + 5.0F);
|
| 658 | }
|
| 659 |
|
| 660 | this.mc.mcProfiler.startSection("armor");
|
| 661 |
|
| 662 | for (int i3 = 0; i3 < 10; ++i3)
|
| 663 | {
|
| 664 | if (k2 > 0)
|
| 665 | {
|
| 666 | int j3 = i1 + i3 * 8;
|
| 667 |
|
| 668 | if (i3 * 2 + 1 < k2)
|
| 669 | {
|
| 670 | this.drawTexturedModalRect(j3, j2, 34, 9, 9, 9);
|
| 671 | }
|
| 672 |
|
| 673 | if (i3 * 2 + 1 == k2)
|
| 674 | {
|
| 675 | this.drawTexturedModalRect(j3, j2, 25, 9, 9, 9);
|
| 676 | }
|
| 677 |
|
| 678 | if (i3 * 2 + 1 > k2)
|
| 679 | {
|
| 680 | this.drawTexturedModalRect(j3, j2, 16, 9, 9, 9);
|
| 681 | }
|
| 682 | }
|
| 683 | }
|
| 684 |
|
| 685 | this.mc.mcProfiler.endStartSection("health");
|
| 686 |
|
| 687 | for (int i6 = MathHelper.ceiling_float_int((f + f1) / 2.0F) - 1; i6 >= 0; --i6)
|
| 688 | {
|
| 689 | int j6 = 16;
|
| 690 |
|
| 691 | if (entityplayer.isPotionActive(Potion.poison))
|
| 692 | {
|
| 693 | j6 += 36;
|
| 694 | }
|
| 695 | else if (entityplayer.isPotionActive(Potion.wither))
|
| 696 | {
|
| 697 | j6 += 72;
|
| 698 | }
|
| 699 |
|
| 700 | int k3 = 0;
|
| 701 |
|
| 702 | if (flag)
|
| 703 | {
|
| 704 | k3 = 1;
|
| 705 | }
|
| 706 |
|
| 707 | int l3 = MathHelper.ceiling_float_int((float)(i6 + 1) / 10.0F) - 1;
|
| 708 | int i4 = i1 + i6 % 10 * 8;
|
| 709 | int j4 = k1 - l3 * i2;
|
| 710 |
|
| 711 | if (i <= 4)
|
| 712 | {
|
| 713 | j4 += this.rand.nextInt(2);
|
| 714 | }
|
| 715 |
|
| 716 | if (i6 == l2)
|
| 717 | {
|
| 718 | j4 -= 2;
|
| 719 | }
|
| 720 |
|
| 721 | int k4 = 0;
|
| 722 |
|
| 723 | if (entityplayer.worldObj.getWorldInfo().isHardcoreModeEnabled())
|
| 724 | {
|
| 725 | k4 = 5;
|
| 726 | }
|
| 727 |
|
| 728 | this.drawTexturedModalRect(i4, j4, 16 + k3 * 9, 9 * k4, 9, 9);
|
| 729 |
|
| 730 | if (flag)
|
| 731 | {
|
| 732 | if (i6 * 2 + 1 < j)
|
| 733 | {
|
| 734 | this.drawTexturedModalRect(i4, j4, j6 + 54, 9 * k4, 9, 9);
|
| 735 | }
|
| 736 |
|
| 737 | if (i6 * 2 + 1 == j)
|
| 738 | {
|
| 739 | this.drawTexturedModalRect(i4, j4, j6 + 63, 9 * k4, 9, 9);
|
| 740 | }
|
| 741 | }
|
| 742 |
|
| 743 | if (f2 > 0.0F)
|
| 744 | {
|
| 745 | if (f2 == f1 && f1 % 2.0F == 1.0F)
|
| 746 | {
|
| 747 | this.drawTexturedModalRect(i4, j4, j6 + 153, 9 * k4, 9, 9);
|
| 748 | }
|
| 749 | else
|
| 750 | {
|
| 751 | this.drawTexturedModalRect(i4, j4, j6 + 144, 9 * k4, 9, 9);
|
| 752 | }
|
| 753 |
|
| 754 | f2 -= 2.0F;
|
| 755 | }
|
| 756 | else
|
| 757 | {
|
| 758 | if (i6 * 2 + 1 < i)
|
| 759 | {
|
| 760 | this.drawTexturedModalRect(i4, j4, j6 + 36, 9 * k4, 9, 9);
|
| 761 | }
|
| 762 |
|
| 763 | if (i6 * 2 + 1 == i)
|
| 764 | {
|
| 765 | this.drawTexturedModalRect(i4, j4, j6 + 45, 9 * k4, 9, 9);
|
| 766 | }
|
| 767 | }
|
| 768 | }
|
| 769 |
|
| 770 | Entity entity = entityplayer.ridingEntity;
|
| 771 |
|
| 772 | if (entity == null)
|
| 773 | {
|
| 774 | this.mc.mcProfiler.endStartSection("food");
|
| 775 |
|
| 776 | for (int k6 = 0; k6 < 10; ++k6)
|
| 777 | {
|
| 778 | int i7 = k1;
|
| 779 | int l7 = 16;
|
| 780 | int j8 = 0;
|
| 781 |
|
| 782 | if (entityplayer.isPotionActive(Potion.hunger))
|
| 783 | {
|
| 784 | l7 += 36;
|
| 785 | j8 = 13;
|
| 786 | }
|
| 787 |
|
| 788 | if (entityplayer.getFoodStats().getSaturationLevel() <= 0.0F && this.updateCounter % (k * 3 + 1) == 0)
|
| 789 | {
|
| 790 | i7 = k1 + (this.rand.nextInt(3) - 1);
|
| 791 | }
|
| 792 |
|
| 793 | if (flag1)
|
| 794 | {
|
| 795 | j8 = 1;
|
| 796 | }
|
| 797 |
|
| 798 | int i9 = j1 - k6 * 8 - 9;
|
| 799 | this.drawTexturedModalRect(i9, i7, 16 + j8 * 9, 27, 9, 9);
|
| 800 |
|
| 801 | if (flag1)
|
| 802 | {
|
| 803 | if (k6 * 2 + 1 < l)
|
| 804 | {
|
| 805 | this.drawTexturedModalRect(i9, i7, l7 + 54, 27, 9, 9);
|
| 806 | }
|
| 807 |
|
| 808 | if (k6 * 2 + 1 == l)
|
| 809 | {
|
| 810 | this.drawTexturedModalRect(i9, i7, l7 + 63, 27, 9, 9);
|
| 811 | }
|
| 812 | }
|
| 813 |
|
| 814 | if (k6 * 2 + 1 < k)
|
| 815 | {
|
| 816 | this.drawTexturedModalRect(i9, i7, l7 + 36, 27, 9, 9);
|
| 817 | }
|
| 818 |
|
| 819 | if (k6 * 2 + 1 == k)
|
| 820 | {
|
| 821 | this.drawTexturedModalRect(i9, i7, l7 + 45, 27, 9, 9);
|
| 822 | }
|
| 823 | }
|
| 824 | }
|
| 825 | else if (entity instanceof EntityLivingBase)
|
| 826 | {
|
| 827 | this.mc.mcProfiler.endStartSection("mountHealth");
|
| 828 | EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
|
| 829 | int j7 = (int)Math.ceil((double)entitylivingbase.getHealth());
|
| 830 | float f3 = entitylivingbase.getMaxHealth();
|
| 831 | int k8 = (int)(f3 + 0.5F) / 2;
|
| 832 |
|
| 833 | if (k8 > 30)
|
| 834 | {
|
| 835 | k8 = 30;
|
| 836 | }
|
| 837 |
|
| 838 | int j9 = k1;
|
| 839 |
|
| 840 | for (int k9 = 0; k8 > 0; k9 += 20)
|
| 841 | {
|
| 842 | int l4 = Math.min(k8, 10);
|
| 843 | k8 -= l4;
|
| 844 |
|
| 845 | for (int i5 = 0; i5 < l4; ++i5)
|
| 846 | {
|
| 847 | int j5 = 52;
|
| 848 | int k5 = 0;
|
| 849 |
|
| 850 | if (flag1)
|
| 851 | {
|
| 852 | k5 = 1;
|
| 853 | }
|
| 854 |
|
| 855 | int l5 = j1 - i5 * 8 - 9;
|
| 856 | this.drawTexturedModalRect(l5, j9, j5 + k5 * 9, 9, 9, 9);
|
| 857 |
|
| 858 | if (i5 * 2 + 1 + k9 < j7)
|
| 859 | {
|
| 860 | this.drawTexturedModalRect(l5, j9, j5 + 36, 9, 9, 9);
|
| 861 | }
|
| 862 |
|
| 863 | if (i5 * 2 + 1 + k9 == j7)
|
| 864 | {
|
| 865 | this.drawTexturedModalRect(l5, j9, j5 + 45, 9, 9, 9);
|
| 866 | }
|
| 867 | }
|
| 868 |
|
| 869 | j9 -= 10;
|
| 870 | }
|
| 871 | }
|
| 872 |
|
| 873 | this.mc.mcProfiler.endStartSection("air");
|
| 874 |
|
| 875 | if (entityplayer.isInsideOfMaterial(Material.water))
|
| 876 | {
|
| 877 | int l6 = this.mc.thePlayer.getAir();
|
| 878 | int k7 = MathHelper.ceiling_double_int((double)(l6 - 2) * 10.0D / 300.0D);
|
| 879 | int i8 = MathHelper.ceiling_double_int((double)l6 * 10.0D / 300.0D) - k7;
|
| 880 |
|
| 881 | for (int l8 = 0; l8 < k7 + i8; ++l8)
|
| 882 | {
|
| 883 | if (l8 < k7)
|
| 884 | {
|
| 885 | this.drawTexturedModalRect(j1 - l8 * 8 - 9, j2, 16, 18, 9, 9);
|
| 886 | }
|
| 887 | else
|
| 888 | {
|
| 889 | this.drawTexturedModalRect(j1 - l8 * 8 - 9, j2, 25, 18, 9, 9);
|
| 890 | }
|
| 891 | }
|
| 892 | }
|
| 893 |
|
| 894 | this.mc.mcProfiler.endSection();
|
| 895 | }
|
| 896 | }
|
| 897 |
|
| 898 | /**
|
| 899 | * Renders dragon's (boss) health on the HUD
|
| 900 | */
|
| 901 | private void renderBossHealth()
|
| 902 | {
|
| 903 | if (BossStatus.bossName != null && BossStatus.statusBarTime > 0)
|
| 904 | {
|
| 905 | --BossStatus.statusBarTime;
|
| 906 | FontRenderer fontrenderer = this.mc.fontRendererObj;
|
| 907 | ScaledResolution scaledresolution = new ScaledResolution(this.mc);
|
| 908 | int i = scaledresolution.getScaledWidth();
|
| 909 | int j = 182;
|
| 910 | int k = i / 2 - j / 2;
|
| 911 | int l = (int)(BossStatus.healthScale * (float)(j + 1));
|
| 912 | int i1 = 12;
|
| 913 | this.drawTexturedModalRect(k, i1, 0, 74, j, 5);
|
| 914 | this.drawTexturedModalRect(k, i1, 0, 74, j, 5);
|
| 915 |
|
| 916 | if (l > 0)
|
| 917 | {
|
| 918 | this.drawTexturedModalRect(k, i1, 0, 79, l, 5);
|
| 919 | }
|
| 920 |
|
| 921 | String s = BossStatus.bossName;
|
| 922 | this.getFontRenderer().drawStringWithShadow(s, (float)(i / 2 - this.getFontRenderer().getStringWidth(s) / 2), (float)(i1 - 10), 16777215);
|
| 923 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 924 | this.mc.getTextureManager().bindTexture(icons);
|
| 925 | }
|
| 926 | }
|
| 927 |
|
| 928 | private void renderPumpkinOverlay(ScaledResolution scaledRes)
|
| 929 | {
|
| 930 | GlStateManager.disableDepth();
|
| 931 | GlStateManager.depthMask(false);
|
| 932 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 933 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 934 | GlStateManager.disableAlpha();
|
| 935 | this.mc.getTextureManager().bindTexture(pumpkinBlurTexPath);
|
| 936 | Tessellator tessellator = Tessellator.getInstance();
|
| 937 | WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
| 938 | worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
| 939 | worldrenderer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
|
| 940 | worldrenderer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
|
| 941 | worldrenderer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
|
| 942 | worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
|
| 943 | tessellator.draw();
|
| 944 | GlStateManager.depthMask(true);
|
| 945 | GlStateManager.enableDepth();
|
| 946 | GlStateManager.enableAlpha();
|
| 947 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 948 | }
|
| 949 |
|
| 950 | /**
|
| 951 | * Renders a Vignette arount the entire screen that changes with light level.
|
| 952 | *
|
| 953 | * @param lightLevel The current brightness
|
| 954 | * @param scaledRes The current resolution of the game
|
| 955 | */
|
| 956 | private void renderVignette(float lightLevel, ScaledResolution scaledRes)
|
| 957 | {
|
| 958 | lightLevel = 1.0F - lightLevel;
|
| 959 | lightLevel = MathHelper.clamp_float(lightLevel, 0.0F, 1.0F);
|
| 960 | WorldBorder worldborder = this.mc.theWorld.getWorldBorder();
|
| 961 | float f = (float)worldborder.getClosestDistance(this.mc.thePlayer);
|
| 962 | double d0 = Math.min(worldborder.getResizeSpeed() * (double)worldborder.getWarningTime() * 1000.0D, Math.abs(worldborder.getTargetSize() - worldborder.getDiameter()));
|
| 963 | double d1 = Math.max((double)worldborder.getWarningDistance(), d0);
|
| 964 |
|
| 965 | if ((double)f < d1)
|
| 966 | {
|
| 967 | f = 1.0F - (float)((double)f / d1);
|
| 968 | }
|
| 969 | else
|
| 970 | {
|
| 971 | f = 0.0F;
|
| 972 | }
|
| 973 |
|
| 974 | this.prevVignetteBrightness = (float)((double)this.prevVignetteBrightness + (double)(lightLevel - this.prevVignetteBrightness) * 0.01D);
|
| 975 | GlStateManager.disableDepth();
|
| 976 | GlStateManager.depthMask(false);
|
| 977 | GlStateManager.tryBlendFuncSeparate(0, 769, 1, 0);
|
| 978 |
|
| 979 | if (f > 0.0F)
|
| 980 | {
|
| 981 | GlStateManager.color(0.0F, f, f, 1.0F);
|
| 982 | }
|
| 983 | else
|
| 984 | {
|
| 985 | GlStateManager.color(this.prevVignetteBrightness, this.prevVignetteBrightness, this.prevVignetteBrightness, 1.0F);
|
| 986 | }
|
| 987 |
|
| 988 | this.mc.getTextureManager().bindTexture(vignetteTexPath);
|
| 989 | Tessellator tessellator = Tessellator.getInstance();
|
| 990 | WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
| 991 | worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
| 992 | worldrenderer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
|
| 993 | worldrenderer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
|
| 994 | worldrenderer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
|
| 995 | worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
|
| 996 | tessellator.draw();
|
| 997 | GlStateManager.depthMask(true);
|
| 998 | GlStateManager.enableDepth();
|
| 999 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 1000 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 1001 | }
|
| 1002 |
|
| 1003 | private void renderPortal(float timeInPortal, ScaledResolution scaledRes)
|
| 1004 | {
|
| 1005 | if (timeInPortal < 1.0F)
|
| 1006 | {
|
| 1007 | timeInPortal = timeInPortal * timeInPortal;
|
| 1008 | timeInPortal = timeInPortal * timeInPortal;
|
| 1009 | timeInPortal = timeInPortal * 0.8F + 0.2F;
|
| 1010 | }
|
| 1011 |
|
| 1012 | GlStateManager.disableAlpha();
|
| 1013 | GlStateManager.disableDepth();
|
| 1014 | GlStateManager.depthMask(false);
|
| 1015 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
| 1016 | GlStateManager.color(1.0F, 1.0F, 1.0F, timeInPortal);
|
| 1017 | this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
| 1018 | TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.portal.getDefaultState());
|
| 1019 | float f = textureatlassprite.getMinU();
|
| 1020 | float f1 = textureatlassprite.getMinV();
|
| 1021 | float f2 = textureatlassprite.getMaxU();
|
| 1022 | float f3 = textureatlassprite.getMaxV();
|
| 1023 | Tessellator tessellator = Tessellator.getInstance();
|
| 1024 | WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
| 1025 | worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
| 1026 | worldrenderer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex();
|
| 1027 | worldrenderer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex();
|
| 1028 | worldrenderer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex();
|
| 1029 | worldrenderer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex();
|
| 1030 | tessellator.draw();
|
| 1031 | GlStateManager.depthMask(true);
|
| 1032 | GlStateManager.enableDepth();
|
| 1033 | GlStateManager.enableAlpha();
|
| 1034 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 1035 | }
|
| 1036 |
|
| 1037 | private void renderHotbarItem(int index, int xPos, int yPos, float partialTicks, EntityPlayer player)
|
| 1038 | {
|
| 1039 | ItemStack itemstack = player.inventory.mainInventory[index];
|
| 1040 |
|
| 1041 | if (itemstack != null)
|
| 1042 | {
|
| 1043 | float f = (float)itemstack.animationsToGo - partialTicks;
|
| 1044 |
|
| 1045 | if (f > 0.0F)
|
| 1046 | {
|
| 1047 | GlStateManager.pushMatrix();
|
| 1048 | float f1 = 1.0F + f / 5.0F;
|
| 1049 | GlStateManager.translate((float)(xPos + 8), (float)(yPos + 12), 0.0F);
|
| 1050 | GlStateManager.scale(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F);
|
| 1051 | GlStateManager.translate((float)(-(xPos + 8)), (float)(-(yPos + 12)), 0.0F);
|
| 1052 | }
|
| 1053 |
|
| 1054 | this.itemRenderer.renderItemAndEffectIntoGUI(itemstack, xPos, yPos);
|
| 1055 |
|
| 1056 | if (f > 0.0F)
|
| 1057 | {
|
| 1058 | GlStateManager.popMatrix();
|
| 1059 | }
|
| 1060 |
|
| 1061 | this.itemRenderer.renderItemOverlays(this.mc.fontRendererObj, itemstack, xPos, yPos);
|
| 1062 | }
|
| 1063 | }
|
| 1064 |
|
| 1065 | /**
|
| 1066 | * The update tick for the ingame UI
|
| 1067 | */
|
| 1068 | public void updateTick()
|
| 1069 | {
|
| 1070 | if (this.recordPlayingUpFor > 0)
|
| 1071 | {
|
| 1072 | --this.recordPlayingUpFor;
|
| 1073 | }
|
| 1074 |
|
| 1075 | if (this.titlesTimer > 0)
|
| 1076 | {
|
| 1077 | --this.titlesTimer;
|
| 1078 |
|
| 1079 | if (this.titlesTimer <= 0)
|
| 1080 | {
|
| 1081 | this.displayedTitle = "";
|
| 1082 | this.displayedSubTitle = "";
|
| 1083 | }
|
| 1084 | }
|
| 1085 |
|
| 1086 | ++this.updateCounter;
|
| 1087 | this.streamIndicator.updateStreamAlpha();
|
| 1088 |
|
| 1089 | if (this.mc.thePlayer != null)
|
| 1090 | {
|
| 1091 | ItemStack itemstack = this.mc.thePlayer.inventory.getCurrentItem();
|
| 1092 |
|
| 1093 | if (itemstack == null)
|
| 1094 | {
|
| 1095 | this.remainingHighlightTicks = 0;
|
| 1096 | }
|
| 1097 | else if (this.highlightingItemStack != null && itemstack.getItem() == this.highlightingItemStack.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.highlightingItemStack) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.highlightingItemStack.getMetadata()))
|
| 1098 | {
|
| 1099 | if (this.remainingHighlightTicks > 0)
|
| 1100 | {
|
| 1101 | --this.remainingHighlightTicks;
|
| 1102 | }
|
| 1103 | }
|
| 1104 | else
|
| 1105 | {
|
| 1106 | this.remainingHighlightTicks = 40;
|
| 1107 | }
|
| 1108 |
|
| 1109 | this.highlightingItemStack = itemstack;
|
| 1110 | }
|
| 1111 | }
|
| 1112 |
|
| 1113 | public void setRecordPlayingMessage(String recordName)
|
| 1114 | {
|
| 1115 | this.setRecordPlaying(I18n.format("record.nowPlaying", new Object[] {recordName}), true);
|
| 1116 | }
|
| 1117 |
|
| 1118 | public void setRecordPlaying(String message, boolean isPlaying)
|
| 1119 | {
|
| 1120 | this.recordPlaying = message;
|
| 1121 | this.recordPlayingUpFor = 60;
|
| 1122 | this.recordIsPlaying = isPlaying;
|
| 1123 | }
|
| 1124 |
|
| 1125 | public void displayTitle(String title, String subTitle, int timeFadeIn, int displayTime, int timeFadeOut)
|
| 1126 | {
|
| 1127 | if (title == null && subTitle == null && timeFadeIn < 0 && displayTime < 0 && timeFadeOut < 0)
|
| 1128 | {
|
| 1129 | this.displayedTitle = "";
|
| 1130 | this.displayedSubTitle = "";
|
| 1131 | this.titlesTimer = 0;
|
| 1132 | }
|
| 1133 | else if (title != null)
|
| 1134 | {
|
| 1135 | this.displayedTitle = title;
|
| 1136 | this.titlesTimer = this.titleFadeIn + this.titleDisplayTime + this.titleFadeOut;
|
| 1137 | }
|
| 1138 | else if (subTitle != null)
|
| 1139 | {
|
| 1140 | this.displayedSubTitle = subTitle;
|
| 1141 | }
|
| 1142 | else
|
| 1143 | {
|
| 1144 | if (timeFadeIn >= 0)
|
| 1145 | {
|
| 1146 | this.titleFadeIn = timeFadeIn;
|
| 1147 | }
|
| 1148 |
|
| 1149 | if (displayTime >= 0)
|
| 1150 | {
|
| 1151 | this.titleDisplayTime = displayTime;
|
| 1152 | }
|
| 1153 |
|
| 1154 | if (timeFadeOut >= 0)
|
| 1155 | {
|
| 1156 | this.titleFadeOut = timeFadeOut;
|
| 1157 | }
|
| 1158 |
|
| 1159 | if (this.titlesTimer > 0)
|
| 1160 | {
|
| 1161 | this.titlesTimer = this.titleFadeIn + this.titleDisplayTime + this.titleFadeOut;
|
| 1162 | }
|
| 1163 | }
|
| 1164 | }
|
| 1165 |
|
| 1166 | public void setRecordPlaying(IChatComponent component, boolean isPlaying)
|
| 1167 | {
|
| 1168 | this.setRecordPlaying(component.getUnformattedText(), isPlaying);
|
| 1169 | }
|
| 1170 |
|
| 1171 | /**
|
| 1172 | * returns a pointer to the persistant Chat GUI, containing all previous chat messages and such
|
| 1173 | */
|
| 1174 | public GuiNewChat getChatGUI()
|
| 1175 | {
|
| 1176 | return this.persistantChatGUI;
|
| 1177 | }
|
| 1178 |
|
| 1179 | public int getUpdateCounter()
|
| 1180 | {
|
| 1181 | return this.updateCounter;
|
| 1182 | }
|
| 1183 |
|
| 1184 | public FontRenderer getFontRenderer()
|
| 1185 | {
|
| 1186 | return this.mc.fontRendererObj;
|
| 1187 | }
|
| 1188 |
|
| 1189 | public GuiSpectator getSpectatorGui()
|
| 1190 | {
|
| 1191 | return this.spectatorGui;
|
| 1192 | }
|
| 1193 |
|
| 1194 | public GuiPlayerTabOverlay getTabList()
|
| 1195 | {
|
| 1196 | return this.overlayPlayerList;
|
| 1197 | }
|
| 1198 |
|
| 1199 | /**
|
| 1200 | * Reset the GuiPlayerTabOverlay's message header and footer
|
| 1201 | */
|
| 1202 | public void resetPlayersOverlayFooterHeader()
|
| 1203 | {
|
| 1204 | this.overlayPlayerList.resetFooterHeader();
|
| 1205 | }
|
| 1206 | }
|
| 1207 |
|