| 1 | package net.minecraft.client.gui.achievement;
|
| 2 |
|
| 3 | import java.io.IOException;
|
| 4 | import java.util.Random;
|
| 5 | import net.minecraft.block.Block;
|
| 6 | import net.minecraft.client.Minecraft;
|
| 7 | import net.minecraft.client.gui.GuiButton;
|
| 8 | import net.minecraft.client.gui.GuiOptionButton;
|
| 9 | import net.minecraft.client.gui.GuiScreen;
|
| 10 | import net.minecraft.client.gui.IProgressMeter;
|
| 11 | import net.minecraft.client.renderer.GlStateManager;
|
| 12 | import net.minecraft.client.renderer.RenderHelper;
|
| 13 | import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
| 14 | import net.minecraft.client.renderer.texture.TextureMap;
|
| 15 | import net.minecraft.client.resources.I18n;
|
| 16 | import net.minecraft.init.Blocks;
|
| 17 | import net.minecraft.network.play.client.C16PacketClientStatus;
|
| 18 | import net.minecraft.stats.Achievement;
|
| 19 | import net.minecraft.stats.AchievementList;
|
| 20 | import net.minecraft.stats.StatFileWriter;
|
| 21 | import net.minecraft.util.ChatComponentTranslation;
|
| 22 | import net.minecraft.util.MathHelper;
|
| 23 | import net.minecraft.util.ResourceLocation;
|
| 24 | import org.lwjgl.input.Mouse;
|
| 25 |
|
| 26 | public class GuiAchievements extends GuiScreen implements IProgressMeter
|
| 27 | {
|
| 28 | private static final int field_146572_y = AchievementList.minDisplayColumn * 24 - 112;
|
| 29 | private static final int field_146571_z = AchievementList.minDisplayRow * 24 - 112;
|
| 30 | private static final int field_146559_A = AchievementList.maxDisplayColumn * 24 - 77;
|
| 31 | private static final int field_146560_B = AchievementList.maxDisplayRow * 24 - 77;
|
| 32 | private static final ResourceLocation ACHIEVEMENT_BACKGROUND = new ResourceLocation("textures/gui/achievement/achievement_background.png");
|
| 33 | protected GuiScreen parentScreen;
|
| 34 | protected int field_146555_f = 256;
|
| 35 | protected int field_146557_g = 202;
|
| 36 | protected int field_146563_h;
|
| 37 | protected int field_146564_i;
|
| 38 | protected float field_146570_r = 1.0F;
|
| 39 | protected double field_146569_s;
|
| 40 | protected double field_146568_t;
|
| 41 | protected double field_146567_u;
|
| 42 | protected double field_146566_v;
|
| 43 | protected double field_146565_w;
|
| 44 | protected double field_146573_x;
|
| 45 | private int field_146554_D;
|
| 46 | private StatFileWriter statFileWriter;
|
| 47 | private boolean loadingAchievements = true;
|
| 48 |
|
| 49 | public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn)
|
| 50 | {
|
| 51 | this.parentScreen = parentScreenIn;
|
| 52 | this.statFileWriter = statFileWriterIn;
|
| 53 | int i = 141;
|
| 54 | int j = 141;
|
| 55 | this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12);
|
| 56 | this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2);
|
| 57 | }
|
| 58 |
|
| 59 | /**
|
| 60 | * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
|
| 61 | * window resizes, the buttonList is cleared beforehand.
|
| 62 | */
|
| 63 | public void initGui()
|
| 64 | {
|
| 65 | this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS));
|
| 66 | this.buttonList.clear();
|
| 67 | this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0])));
|
| 68 | }
|
| 69 |
|
| 70 | /**
|
| 71 | * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
|
| 72 | */
|
| 73 | protected void actionPerformed(GuiButton button) throws IOException
|
| 74 | {
|
| 75 | if (!this.loadingAchievements)
|
| 76 | {
|
| 77 | if (button.id == 1)
|
| 78 | {
|
| 79 | this.mc.displayGuiScreen(this.parentScreen);
|
| 80 | }
|
| 81 | }
|
| 82 | }
|
| 83 |
|
| 84 | /**
|
| 85 | * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
|
| 86 | * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
|
| 87 | */
|
| 88 | protected void keyTyped(char typedChar, int keyCode) throws IOException
|
| 89 | {
|
| 90 | if (keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode())
|
| 91 | {
|
| 92 | this.mc.displayGuiScreen((GuiScreen)null);
|
| 93 | this.mc.setIngameFocus();
|
| 94 | }
|
| 95 | else
|
| 96 | {
|
| 97 | super.keyTyped(typedChar, keyCode);
|
| 98 | }
|
| 99 | }
|
| 100 |
|
| 101 | /**
|
| 102 | * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
|
| 103 | */
|
| 104 | public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
| 105 | {
|
| 106 | if (this.loadingAchievements)
|
| 107 | {
|
| 108 | this.drawDefaultBackground();
|
| 109 | this.drawCenteredString(this.fontRendererObj, I18n.format("multiplayer.downloadingStats", new Object[0]), this.width / 2, this.height / 2, 16777215);
|
| 110 | this.drawCenteredString(this.fontRendererObj, lanSearchStates[(int)(Minecraft.getSystemTime() / 150L % (long)lanSearchStates.length)], this.width / 2, this.height / 2 + this.fontRendererObj.FONT_HEIGHT * 2, 16777215);
|
| 111 | }
|
| 112 | else
|
| 113 | {
|
| 114 | if (Mouse.isButtonDown(0))
|
| 115 | {
|
| 116 | int i = (this.width - this.field_146555_f) / 2;
|
| 117 | int j = (this.height - this.field_146557_g) / 2;
|
| 118 | int k = i + 8;
|
| 119 | int l = j + 17;
|
| 120 |
|
| 121 | if ((this.field_146554_D == 0 || this.field_146554_D == 1) && mouseX >= k && mouseX < k + 224 && mouseY >= l && mouseY < l + 155)
|
| 122 | {
|
| 123 | if (this.field_146554_D == 0)
|
| 124 | {
|
| 125 | this.field_146554_D = 1;
|
| 126 | }
|
| 127 | else
|
| 128 | {
|
| 129 | this.field_146567_u -= (double)((float)(mouseX - this.field_146563_h) * this.field_146570_r);
|
| 130 | this.field_146566_v -= (double)((float)(mouseY - this.field_146564_i) * this.field_146570_r);
|
| 131 | this.field_146565_w = this.field_146569_s = this.field_146567_u;
|
| 132 | this.field_146573_x = this.field_146568_t = this.field_146566_v;
|
| 133 | }
|
| 134 |
|
| 135 | this.field_146563_h = mouseX;
|
| 136 | this.field_146564_i = mouseY;
|
| 137 | }
|
| 138 | }
|
| 139 | else
|
| 140 | {
|
| 141 | this.field_146554_D = 0;
|
| 142 | }
|
| 143 |
|
| 144 | int i1 = Mouse.getDWheel();
|
| 145 | float f3 = this.field_146570_r;
|
| 146 |
|
| 147 | if (i1 < 0)
|
| 148 | {
|
| 149 | this.field_146570_r += 0.25F;
|
| 150 | }
|
| 151 | else if (i1 > 0)
|
| 152 | {
|
| 153 | this.field_146570_r -= 0.25F;
|
| 154 | }
|
| 155 |
|
| 156 | this.field_146570_r = MathHelper.clamp_float(this.field_146570_r, 1.0F, 2.0F);
|
| 157 |
|
| 158 | if (this.field_146570_r != f3)
|
| 159 | {
|
| 160 | float f5 = f3 - this.field_146570_r;
|
| 161 | float f4 = f3 * (float)this.field_146555_f;
|
| 162 | float f = f3 * (float)this.field_146557_g;
|
| 163 | float f1 = this.field_146570_r * (float)this.field_146555_f;
|
| 164 | float f2 = this.field_146570_r * (float)this.field_146557_g;
|
| 165 | this.field_146567_u -= (double)((f1 - f4) * 0.5F);
|
| 166 | this.field_146566_v -= (double)((f2 - f) * 0.5F);
|
| 167 | this.field_146565_w = this.field_146569_s = this.field_146567_u;
|
| 168 | this.field_146573_x = this.field_146568_t = this.field_146566_v;
|
| 169 | }
|
| 170 |
|
| 171 | if (this.field_146565_w < (double)field_146572_y)
|
| 172 | {
|
| 173 | this.field_146565_w = (double)field_146572_y;
|
| 174 | }
|
| 175 |
|
| 176 | if (this.field_146573_x < (double)field_146571_z)
|
| 177 | {
|
| 178 | this.field_146573_x = (double)field_146571_z;
|
| 179 | }
|
| 180 |
|
| 181 | if (this.field_146565_w >= (double)field_146559_A)
|
| 182 | {
|
| 183 | this.field_146565_w = (double)(field_146559_A - 1);
|
| 184 | }
|
| 185 |
|
| 186 | if (this.field_146573_x >= (double)field_146560_B)
|
| 187 | {
|
| 188 | this.field_146573_x = (double)(field_146560_B - 1);
|
| 189 | }
|
| 190 |
|
| 191 | this.drawDefaultBackground();
|
| 192 | this.drawAchievementScreen(mouseX, mouseY, partialTicks);
|
| 193 | GlStateManager.disableLighting();
|
| 194 | GlStateManager.disableDepth();
|
| 195 | this.drawTitle();
|
| 196 | GlStateManager.enableLighting();
|
| 197 | GlStateManager.enableDepth();
|
| 198 | }
|
| 199 | }
|
| 200 |
|
| 201 | public void doneLoading()
|
| 202 | {
|
| 203 | if (this.loadingAchievements)
|
| 204 | {
|
| 205 | this.loadingAchievements = false;
|
| 206 | }
|
| 207 | }
|
| 208 |
|
| 209 | /**
|
| 210 | * Called from the main game loop to update the screen.
|
| 211 | */
|
| 212 | public void updateScreen()
|
| 213 | {
|
| 214 | if (!this.loadingAchievements)
|
| 215 | {
|
| 216 | this.field_146569_s = this.field_146567_u;
|
| 217 | this.field_146568_t = this.field_146566_v;
|
| 218 | double d0 = this.field_146565_w - this.field_146567_u;
|
| 219 | double d1 = this.field_146573_x - this.field_146566_v;
|
| 220 |
|
| 221 | if (d0 * d0 + d1 * d1 < 4.0D)
|
| 222 | {
|
| 223 | this.field_146567_u += d0;
|
| 224 | this.field_146566_v += d1;
|
| 225 | }
|
| 226 | else
|
| 227 | {
|
| 228 | this.field_146567_u += d0 * 0.85D;
|
| 229 | this.field_146566_v += d1 * 0.85D;
|
| 230 | }
|
| 231 | }
|
| 232 | }
|
| 233 |
|
| 234 | protected void drawTitle()
|
| 235 | {
|
| 236 | int i = (this.width - this.field_146555_f) / 2;
|
| 237 | int j = (this.height - this.field_146557_g) / 2;
|
| 238 | this.fontRendererObj.drawString(I18n.format("gui.achievements", new Object[0]), i + 15, j + 5, 4210752);
|
| 239 | }
|
| 240 |
|
| 241 | protected void drawAchievementScreen(int p_146552_1_, int p_146552_2_, float p_146552_3_)
|
| 242 | {
|
| 243 | int i = MathHelper.floor_double(this.field_146569_s + (this.field_146567_u - this.field_146569_s) * (double)p_146552_3_);
|
| 244 | int j = MathHelper.floor_double(this.field_146568_t + (this.field_146566_v - this.field_146568_t) * (double)p_146552_3_);
|
| 245 |
|
| 246 | if (i < field_146572_y)
|
| 247 | {
|
| 248 | i = field_146572_y;
|
| 249 | }
|
| 250 |
|
| 251 | if (j < field_146571_z)
|
| 252 | {
|
| 253 | j = field_146571_z;
|
| 254 | }
|
| 255 |
|
| 256 | if (i >= field_146559_A)
|
| 257 | {
|
| 258 | i = field_146559_A - 1;
|
| 259 | }
|
| 260 |
|
| 261 | if (j >= field_146560_B)
|
| 262 | {
|
| 263 | j = field_146560_B - 1;
|
| 264 | }
|
| 265 |
|
| 266 | int k = (this.width - this.field_146555_f) / 2;
|
| 267 | int l = (this.height - this.field_146557_g) / 2;
|
| 268 | int i1 = k + 16;
|
| 269 | int j1 = l + 17;
|
| 270 | this.zLevel = 0.0F;
|
| 271 | GlStateManager.depthFunc(518);
|
| 272 | GlStateManager.pushMatrix();
|
| 273 | GlStateManager.translate((float)i1, (float)j1, -200.0F);
|
| 274 | GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F);
|
| 275 | GlStateManager.enableTexture2D();
|
| 276 | GlStateManager.disableLighting();
|
| 277 | GlStateManager.enableRescaleNormal();
|
| 278 | GlStateManager.enableColorMaterial();
|
| 279 | int k1 = i + 288 >> 4;
|
| 280 | int l1 = j + 288 >> 4;
|
| 281 | int i2 = (i + 288) % 16;
|
| 282 | int j2 = (j + 288) % 16;
|
| 283 | int k2 = 4;
|
| 284 | int l2 = 8;
|
| 285 | int i3 = 10;
|
| 286 | int j3 = 22;
|
| 287 | int k3 = 37;
|
| 288 | Random random = new Random();
|
| 289 | float f = 16.0F / this.field_146570_r;
|
| 290 | float f1 = 16.0F / this.field_146570_r;
|
| 291 |
|
| 292 | for (int l3 = 0; (float)l3 * f - (float)j2 < 155.0F; ++l3)
|
| 293 | {
|
| 294 | float f2 = 0.6F - (float)(l1 + l3) / 25.0F * 0.3F;
|
| 295 | GlStateManager.color(f2, f2, f2, 1.0F);
|
| 296 |
|
| 297 | for (int i4 = 0; (float)i4 * f1 - (float)i2 < 224.0F; ++i4)
|
| 298 | {
|
| 299 | random.setSeed((long)(this.mc.getSession().getPlayerID().hashCode() + k1 + i4 + (l1 + l3) * 16));
|
| 300 | int j4 = random.nextInt(1 + l1 + l3) + (l1 + l3) / 2;
|
| 301 | TextureAtlasSprite textureatlassprite = this.func_175371_a(Blocks.sand);
|
| 302 |
|
| 303 | if (j4 <= 37 && l1 + l3 != 35)
|
| 304 | {
|
| 305 | if (j4 == 22)
|
| 306 | {
|
| 307 | if (random.nextInt(2) == 0)
|
| 308 | {
|
| 309 | textureatlassprite = this.func_175371_a(Blocks.diamond_ore);
|
| 310 | }
|
| 311 | else
|
| 312 | {
|
| 313 | textureatlassprite = this.func_175371_a(Blocks.redstone_ore);
|
| 314 | }
|
| 315 | }
|
| 316 | else if (j4 == 10)
|
| 317 | {
|
| 318 | textureatlassprite = this.func_175371_a(Blocks.iron_ore);
|
| 319 | }
|
| 320 | else if (j4 == 8)
|
| 321 | {
|
| 322 | textureatlassprite = this.func_175371_a(Blocks.coal_ore);
|
| 323 | }
|
| 324 | else if (j4 > 4)
|
| 325 | {
|
| 326 | textureatlassprite = this.func_175371_a(Blocks.stone);
|
| 327 | }
|
| 328 | else if (j4 > 0)
|
| 329 | {
|
| 330 | textureatlassprite = this.func_175371_a(Blocks.dirt);
|
| 331 | }
|
| 332 | }
|
| 333 | else
|
| 334 | {
|
| 335 | Block block = Blocks.bedrock;
|
| 336 | textureatlassprite = this.func_175371_a(block);
|
| 337 | }
|
| 338 |
|
| 339 | this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
| 340 | this.drawTexturedModalRect(i4 * 16 - i2, l3 * 16 - j2, textureatlassprite, 16, 16);
|
| 341 | }
|
| 342 | }
|
| 343 |
|
| 344 | GlStateManager.enableDepth();
|
| 345 | GlStateManager.depthFunc(515);
|
| 346 | this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
|
| 347 |
|
| 348 | for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5)
|
| 349 | {
|
| 350 | Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5);
|
| 351 |
|
| 352 | if (achievement1.parentAchievement != null)
|
| 353 | {
|
| 354 | int k5 = achievement1.displayColumn * 24 - i + 11;
|
| 355 | int l5 = achievement1.displayRow * 24 - j + 11;
|
| 356 | int j6 = achievement1.parentAchievement.displayColumn * 24 - i + 11;
|
| 357 | int k6 = achievement1.parentAchievement.displayRow * 24 - j + 11;
|
| 358 | boolean flag = this.statFileWriter.hasAchievementUnlocked(achievement1);
|
| 359 | boolean flag1 = this.statFileWriter.canUnlockAchievement(achievement1);
|
| 360 | int k4 = this.statFileWriter.func_150874_c(achievement1);
|
| 361 |
|
| 362 | if (k4 <= 4)
|
| 363 | {
|
| 364 | int l4 = -16777216;
|
| 365 |
|
| 366 | if (flag)
|
| 367 | {
|
| 368 | l4 = -6250336;
|
| 369 | }
|
| 370 | else if (flag1)
|
| 371 | {
|
| 372 | l4 = -16711936;
|
| 373 | }
|
| 374 |
|
| 375 | this.drawHorizontalLine(k5, j6, l5, l4);
|
| 376 | this.drawVerticalLine(j6, l5, k6, l4);
|
| 377 |
|
| 378 | if (k5 > j6)
|
| 379 | {
|
| 380 | this.drawTexturedModalRect(k5 - 11 - 7, l5 - 5, 114, 234, 7, 11);
|
| 381 | }
|
| 382 | else if (k5 < j6)
|
| 383 | {
|
| 384 | this.drawTexturedModalRect(k5 + 11, l5 - 5, 107, 234, 7, 11);
|
| 385 | }
|
| 386 | else if (l5 > k6)
|
| 387 | {
|
| 388 | this.drawTexturedModalRect(k5 - 5, l5 - 11 - 7, 96, 234, 11, 7);
|
| 389 | }
|
| 390 | else if (l5 < k6)
|
| 391 | {
|
| 392 | this.drawTexturedModalRect(k5 - 5, l5 + 11, 96, 241, 11, 7);
|
| 393 | }
|
| 394 | }
|
| 395 | }
|
| 396 | }
|
| 397 |
|
| 398 | Achievement achievement = null;
|
| 399 | float f3 = (float)(p_146552_1_ - i1) * this.field_146570_r;
|
| 400 | float f4 = (float)(p_146552_2_ - j1) * this.field_146570_r;
|
| 401 | RenderHelper.enableGUIStandardItemLighting();
|
| 402 | GlStateManager.disableLighting();
|
| 403 | GlStateManager.enableRescaleNormal();
|
| 404 | GlStateManager.enableColorMaterial();
|
| 405 |
|
| 406 | for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6)
|
| 407 | {
|
| 408 | Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6);
|
| 409 | int l6 = achievement2.displayColumn * 24 - i;
|
| 410 | int j7 = achievement2.displayRow * 24 - j;
|
| 411 |
|
| 412 | if (l6 >= -24 && j7 >= -24 && (float)l6 <= 224.0F * this.field_146570_r && (float)j7 <= 155.0F * this.field_146570_r)
|
| 413 | {
|
| 414 | int l7 = this.statFileWriter.func_150874_c(achievement2);
|
| 415 |
|
| 416 | if (this.statFileWriter.hasAchievementUnlocked(achievement2))
|
| 417 | {
|
| 418 | float f5 = 0.75F;
|
| 419 | GlStateManager.color(f5, f5, f5, 1.0F);
|
| 420 | }
|
| 421 | else if (this.statFileWriter.canUnlockAchievement(achievement2))
|
| 422 | {
|
| 423 | float f6 = 1.0F;
|
| 424 | GlStateManager.color(f6, f6, f6, 1.0F);
|
| 425 | }
|
| 426 | else if (l7 < 3)
|
| 427 | {
|
| 428 | float f7 = 0.3F;
|
| 429 | GlStateManager.color(f7, f7, f7, 1.0F);
|
| 430 | }
|
| 431 | else if (l7 == 3)
|
| 432 | {
|
| 433 | float f8 = 0.2F;
|
| 434 | GlStateManager.color(f8, f8, f8, 1.0F);
|
| 435 | }
|
| 436 | else
|
| 437 | {
|
| 438 | if (l7 != 4)
|
| 439 | {
|
| 440 | continue;
|
| 441 | }
|
| 442 |
|
| 443 | float f9 = 0.1F;
|
| 444 | GlStateManager.color(f9, f9, f9, 1.0F);
|
| 445 | }
|
| 446 |
|
| 447 | this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
|
| 448 |
|
| 449 | if (achievement2.getSpecial())
|
| 450 | {
|
| 451 | this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26);
|
| 452 | }
|
| 453 | else
|
| 454 | {
|
| 455 | this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26);
|
| 456 | }
|
| 457 |
|
| 458 | if (!this.statFileWriter.canUnlockAchievement(achievement2))
|
| 459 | {
|
| 460 | float f10 = 0.1F;
|
| 461 | GlStateManager.color(f10, f10, f10, 1.0F);
|
| 462 | this.itemRender.isNotRenderingEffectsInGUI(false);
|
| 463 | }
|
| 464 |
|
| 465 | GlStateManager.enableLighting();
|
| 466 | GlStateManager.enableCull();
|
| 467 | this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3);
|
| 468 | GlStateManager.blendFunc(770, 771);
|
| 469 | GlStateManager.disableLighting();
|
| 470 |
|
| 471 | if (!this.statFileWriter.canUnlockAchievement(achievement2))
|
| 472 | {
|
| 473 | this.itemRender.isNotRenderingEffectsInGUI(true);
|
| 474 | }
|
| 475 |
|
| 476 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 477 |
|
| 478 | if (f3 >= (float)l6 && f3 <= (float)(l6 + 22) && f4 >= (float)j7 && f4 <= (float)(j7 + 22))
|
| 479 | {
|
| 480 | achievement = achievement2;
|
| 481 | }
|
| 482 | }
|
| 483 | }
|
| 484 |
|
| 485 | GlStateManager.disableDepth();
|
| 486 | GlStateManager.enableBlend();
|
| 487 | GlStateManager.popMatrix();
|
| 488 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 489 | this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
|
| 490 | this.drawTexturedModalRect(k, l, 0, 0, this.field_146555_f, this.field_146557_g);
|
| 491 | this.zLevel = 0.0F;
|
| 492 | GlStateManager.depthFunc(515);
|
| 493 | GlStateManager.disableDepth();
|
| 494 | GlStateManager.enableTexture2D();
|
| 495 | super.drawScreen(p_146552_1_, p_146552_2_, p_146552_3_);
|
| 496 |
|
| 497 | if (achievement != null)
|
| 498 | {
|
| 499 | String s = achievement.getStatName().getUnformattedText();
|
| 500 | String s1 = achievement.getDescription();
|
| 501 | int i7 = p_146552_1_ + 12;
|
| 502 | int k7 = p_146552_2_ - 4;
|
| 503 | int i8 = this.statFileWriter.func_150874_c(achievement);
|
| 504 |
|
| 505 | if (this.statFileWriter.canUnlockAchievement(achievement))
|
| 506 | {
|
| 507 | int j8 = Math.max(this.fontRendererObj.getStringWidth(s), 120);
|
| 508 | int i9 = this.fontRendererObj.splitStringWidth(s1, j8);
|
| 509 |
|
| 510 | if (this.statFileWriter.hasAchievementUnlocked(achievement))
|
| 511 | {
|
| 512 | i9 += 12;
|
| 513 | }
|
| 514 |
|
| 515 | this.drawGradientRect(i7 - 3, k7 - 3, i7 + j8 + 3, k7 + i9 + 3 + 12, -1073741824, -1073741824);
|
| 516 | this.fontRendererObj.drawSplitString(s1, i7, k7 + 12, j8, -6250336);
|
| 517 |
|
| 518 | if (this.statFileWriter.hasAchievementUnlocked(achievement))
|
| 519 | {
|
| 520 | this.fontRendererObj.drawStringWithShadow(I18n.format("achievement.taken", new Object[0]), (float)i7, (float)(k7 + i9 + 4), -7302913);
|
| 521 | }
|
| 522 | }
|
| 523 | else if (i8 == 3)
|
| 524 | {
|
| 525 | s = I18n.format("achievement.unknown", new Object[0]);
|
| 526 | int k8 = Math.max(this.fontRendererObj.getStringWidth(s), 120);
|
| 527 | String s2 = (new ChatComponentTranslation("achievement.requires", new Object[] {achievement.parentAchievement.getStatName()})).getUnformattedText();
|
| 528 | int i5 = this.fontRendererObj.splitStringWidth(s2, k8);
|
| 529 | this.drawGradientRect(i7 - 3, k7 - 3, i7 + k8 + 3, k7 + i5 + 12 + 3, -1073741824, -1073741824);
|
| 530 | this.fontRendererObj.drawSplitString(s2, i7, k7 + 12, k8, -9416624);
|
| 531 | }
|
| 532 | else if (i8 < 3)
|
| 533 | {
|
| 534 | int l8 = Math.max(this.fontRendererObj.getStringWidth(s), 120);
|
| 535 | String s3 = (new ChatComponentTranslation("achievement.requires", new Object[] {achievement.parentAchievement.getStatName()})).getUnformattedText();
|
| 536 | int j9 = this.fontRendererObj.splitStringWidth(s3, l8);
|
| 537 | this.drawGradientRect(i7 - 3, k7 - 3, i7 + l8 + 3, k7 + j9 + 12 + 3, -1073741824, -1073741824);
|
| 538 | this.fontRendererObj.drawSplitString(s3, i7, k7 + 12, l8, -9416624);
|
| 539 | }
|
| 540 | else
|
| 541 | {
|
| 542 | s = null;
|
| 543 | }
|
| 544 |
|
| 545 | if (s != null)
|
| 546 | {
|
| 547 | this.fontRendererObj.drawStringWithShadow(s, (float)i7, (float)k7, this.statFileWriter.canUnlockAchievement(achievement) ? (achievement.getSpecial() ? -128 : -1) : (achievement.getSpecial() ? -8355776 : -8355712));
|
| 548 | }
|
| 549 | }
|
| 550 |
|
| 551 | GlStateManager.enableDepth();
|
| 552 | GlStateManager.enableLighting();
|
| 553 | RenderHelper.disableStandardItemLighting();
|
| 554 | }
|
| 555 |
|
| 556 | private TextureAtlasSprite func_175371_a(Block p_175371_1_)
|
| 557 | {
|
| 558 | return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(p_175371_1_.getDefaultState());
|
| 559 | }
|
| 560 |
|
| 561 | /**
|
| 562 | * Returns true if this GUI should pause the game when it is displayed in single-player
|
| 563 | */
|
| 564 | public boolean doesGuiPauseGame()
|
| 565 | {
|
| 566 | return !this.loadingAchievements;
|
| 567 | }
|
| 568 | }
|
| 569 |
|