| 1 | package net.minecraft.client;
|
| 2 |
|
| 3 | import com.google.common.collect.*;
|
| 4 | import com.google.common.util.concurrent.Futures;
|
| 5 | import com.google.common.util.concurrent.ListenableFuture;
|
| 6 | import com.google.common.util.concurrent.ListenableFutureTask;
|
| 7 | import com.mojang.authlib.minecraft.MinecraftSessionService;
|
| 8 | import com.mojang.authlib.properties.Property;
|
| 9 | import com.mojang.authlib.properties.PropertyMap;
|
| 10 | import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
| 11 | import me.memewaredevs.client.Memeware;
|
| 12 | import me.memewaredevs.client.module.hud.GameHud;
|
| 13 | import net.minecraft.block.Block;
|
| 14 | import net.minecraft.block.material.Material;
|
| 15 | import net.minecraft.client.audio.MusicTicker;
|
| 16 | import net.minecraft.client.audio.SoundHandler;
|
| 17 | import net.minecraft.client.entity.EntityPlayerSP;
|
| 18 | import net.minecraft.client.gui.*;
|
| 19 | import net.minecraft.client.gui.achievement.GuiAchievement;
|
| 20 | import net.minecraft.client.gui.inventory.GuiInventory;
|
| 21 | import net.minecraft.client.gui.stream.GuiStreamUnavailable;
|
| 22 | import net.minecraft.client.main.GameConfiguration;
|
| 23 | import net.minecraft.client.multiplayer.GuiConnecting;
|
| 24 | import net.minecraft.client.multiplayer.PlayerControllerMP;
|
| 25 | import net.minecraft.client.multiplayer.ServerData;
|
| 26 | import net.minecraft.client.multiplayer.WorldClient;
|
| 27 | import net.minecraft.client.network.NetHandlerLoginClient;
|
| 28 | import net.minecraft.client.network.NetHandlerPlayClient;
|
| 29 | import net.minecraft.client.particle.EffectRenderer;
|
| 30 | import net.minecraft.client.renderer.*;
|
| 31 | import net.minecraft.client.renderer.chunk.RenderChunk;
|
| 32 | import net.minecraft.client.renderer.entity.RenderItem;
|
| 33 | import net.minecraft.client.renderer.entity.RenderManager;
|
| 34 | import net.minecraft.client.renderer.texture.DynamicTexture;
|
| 35 | import net.minecraft.client.renderer.texture.TextureManager;
|
| 36 | import net.minecraft.client.renderer.texture.TextureMap;
|
| 37 | import net.minecraft.client.resources.*;
|
| 38 | import net.minecraft.client.resources.data.*;
|
| 39 | import net.minecraft.client.resources.model.ModelManager;
|
| 40 | import net.minecraft.client.settings.GameSettings;
|
| 41 | import net.minecraft.client.settings.KeyBinding;
|
| 42 | import net.minecraft.client.shader.Framebuffer;
|
| 43 | import net.minecraft.client.stream.IStream;
|
| 44 | import net.minecraft.client.stream.NullStream;
|
| 45 | import net.minecraft.client.stream.TwitchStream;
|
| 46 | import net.minecraft.crash.CrashReport;
|
| 47 | import net.minecraft.crash.CrashReportCategory;
|
| 48 | import net.minecraft.entity.Entity;
|
| 49 | import net.minecraft.entity.EntityLeashKnot;
|
| 50 | import net.minecraft.entity.EntityList;
|
| 51 | import net.minecraft.entity.boss.BossStatus;
|
| 52 | import net.minecraft.entity.item.*;
|
| 53 | import net.minecraft.entity.player.EntityPlayer;
|
| 54 | import net.minecraft.entity.player.InventoryPlayer;
|
| 55 | import net.minecraft.init.Bootstrap;
|
| 56 | import net.minecraft.init.Items;
|
| 57 | import net.minecraft.item.Item;
|
| 58 | import net.minecraft.item.ItemBlock;
|
| 59 | import net.minecraft.item.ItemStack;
|
| 60 | import net.minecraft.nbt.NBTTagCompound;
|
| 61 | import net.minecraft.nbt.NBTTagList;
|
| 62 | import net.minecraft.nbt.NBTTagString;
|
| 63 | import net.minecraft.network.EnumConnectionState;
|
| 64 | import net.minecraft.network.NetworkManager;
|
| 65 | import net.minecraft.network.handshake.client.C00Handshake;
|
| 66 | import net.minecraft.network.login.client.C00PacketLoginStart;
|
| 67 | import net.minecraft.network.play.client.C16PacketClientStatus;
|
| 68 | import net.minecraft.profiler.IPlayerUsage;
|
| 69 | import net.minecraft.profiler.PlayerUsageSnooper;
|
| 70 | import net.minecraft.profiler.Profiler;
|
| 71 | import net.minecraft.server.MinecraftServer;
|
| 72 | import net.minecraft.server.integrated.IntegratedServer;
|
| 73 | import net.minecraft.stats.AchievementList;
|
| 74 | import net.minecraft.stats.IStatStringFormat;
|
| 75 | import net.minecraft.stats.StatFileWriter;
|
| 76 | import net.minecraft.tileentity.TileEntity;
|
| 77 | import net.minecraft.util.Timer;
|
| 78 | import net.minecraft.util.Util;
|
| 79 | import net.minecraft.util.*;
|
| 80 | import net.minecraft.world.EnumDifficulty;
|
| 81 | import net.minecraft.world.WorldProviderEnd;
|
| 82 | import net.minecraft.world.WorldProviderHell;
|
| 83 | import net.minecraft.world.WorldSettings;
|
| 84 | import net.minecraft.world.chunk.storage.AnvilSaveConverter;
|
| 85 | import net.minecraft.world.storage.ISaveFormat;
|
| 86 | import net.minecraft.world.storage.ISaveHandler;
|
| 87 | import net.minecraft.world.storage.WorldInfo;
|
| 88 | import org.apache.commons.io.IOUtils;
|
| 89 | import org.apache.commons.lang3.Validate;
|
| 90 | import org.apache.logging.log4j.LogManager;
|
| 91 | import org.apache.logging.log4j.Logger;
|
| 92 | import org.lwjgl.LWJGLException;
|
| 93 | import org.lwjgl.Sys;
|
| 94 | import org.lwjgl.input.Keyboard;
|
| 95 | import org.lwjgl.input.Mouse;
|
| 96 | import org.lwjgl.opengl.*;
|
| 97 | import org.lwjgl.util.glu.GLU;
|
| 98 |
|
| 99 | import javax.imageio.ImageIO;
|
| 100 | import java.awt.image.BufferedImage;
|
| 101 | import java.io.File;
|
| 102 | import java.io.IOException;
|
| 103 | import java.io.InputStream;
|
| 104 | import java.io.UnsupportedEncodingException;
|
| 105 | import java.net.MalformedURLException;
|
| 106 | import java.net.Proxy;
|
| 107 | import java.net.SocketAddress;
|
| 108 | import java.nio.ByteBuffer;
|
| 109 | import java.nio.ByteOrder;
|
| 110 | import java.security.NoSuchAlgorithmException;
|
| 111 | import java.text.DecimalFormat;
|
| 112 | import java.text.SimpleDateFormat;
|
| 113 | import java.util.*;
|
| 114 | import java.util.concurrent.Callable;
|
| 115 | import java.util.concurrent.Executors;
|
| 116 | import java.util.concurrent.FutureTask;
|
| 117 |
|
| 118 | public class Minecraft implements IThreadListener, IPlayerUsage {
|
| 119 | private static final Logger logger = LogManager.getLogger();
|
| 120 | private static final ResourceLocation locationMojangPng = new ResourceLocation("textures/gui/title/mojang.png");
|
| 121 | public static final boolean isRunningOnMac = Util.getOSType() == Util.EnumOS.OSX;
|
| 122 |
|
| 123 | /**
|
| 124 | * A 10MiB preallocation to ensure the heap is reasonably sized.
|
| 125 | */
|
| 126 | public static byte[] memoryReserve = new byte[10485760];
|
| 127 | private static final List macDisplayModes = Lists.newArrayList(new DisplayMode[]{new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)});
|
| 128 | private final File fileResourcepacks;
|
| 129 | private final PropertyMap twitchDetails;
|
| 130 | private ServerData currentServerData;
|
| 131 |
|
| 132 | /**
|
| 133 | * The RenderEngine instance used by Minecraft
|
| 134 | */
|
| 135 | private TextureManager renderEngine;
|
| 136 |
|
| 137 | /**
|
| 138 | * Set to 'this' in Minecraft constructor; used by some settings get methods
|
| 139 | */
|
| 140 | private static Minecraft theMinecraft;
|
| 141 | public PlayerControllerMP playerController;
|
| 142 | private boolean fullscreen;
|
| 143 | private boolean field_175619_R = true;
|
| 144 | private boolean hasCrashed;
|
| 145 |
|
| 146 | /**
|
| 147 | * Instance of CrashReport.
|
| 148 | */
|
| 149 | private CrashReport crashReporter;
|
| 150 | public int displayWidth;
|
| 151 | public int displayHeight;
|
| 152 | public Timer timer = new Timer(20.0F);
|
| 153 |
|
| 154 | /**
|
| 155 | * Instance of PlayerUsageSnooper.
|
| 156 | */
|
| 157 | private PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("client", this, MinecraftServer.getCurrentTimeMillis());
|
| 158 | public WorldClient theWorld;
|
| 159 | public RenderGlobal renderGlobal;
|
| 160 | private RenderManager renderManager;
|
| 161 | private RenderItem renderItem;
|
| 162 | private ItemRenderer itemRenderer;
|
| 163 | public EntityPlayerSP thePlayer;
|
| 164 | private Entity field_175622_Z;
|
| 165 | public Entity pointedEntity;
|
| 166 | public EffectRenderer effectRenderer;
|
| 167 | public Session session;
|
| 168 | private boolean isGamePaused;
|
| 169 |
|
| 170 | /**
|
| 171 | * The font renderer used for displaying and measuring text
|
| 172 | */
|
| 173 | public FontRenderer fontRendererObj;
|
| 174 | public FontRenderer standardGalacticFontRenderer;
|
| 175 |
|
| 176 | /**
|
| 177 | * The GuiScreen that's being displayed at the moment.
|
| 178 | */
|
| 179 | public GuiScreen currentScreen;
|
| 180 | public LoadingScreenRenderer loadingScreen;
|
| 181 | public EntityRenderer entityRenderer;
|
| 182 |
|
| 183 | /**
|
| 184 | * Mouse left click counter
|
| 185 | */
|
| 186 | private int leftClickCounter;
|
| 187 |
|
| 188 | /**
|
| 189 | * Display width
|
| 190 | */
|
| 191 | private int tempDisplayWidth;
|
| 192 |
|
| 193 | /**
|
| 194 | * Display height
|
| 195 | */
|
| 196 | private int tempDisplayHeight;
|
| 197 |
|
| 198 | /**
|
| 199 | * Instance of IntegratedServer.
|
| 200 | */
|
| 201 | private IntegratedServer theIntegratedServer;
|
| 202 |
|
| 203 | /**
|
| 204 | * Gui achievement
|
| 205 | */
|
| 206 | public GuiAchievement guiAchievement;
|
| 207 | public GuiIngame ingameGUI;
|
| 208 |
|
| 209 | /**
|
| 210 | * Skip render world
|
| 211 | */
|
| 212 | public boolean skipRenderWorld;
|
| 213 |
|
| 214 | /**
|
| 215 | * The ray trace hit that the mouse is over.
|
| 216 | */
|
| 217 | public MovingObjectPosition objectMouseOver;
|
| 218 |
|
| 219 | /**
|
| 220 | * The game settings that currently hold effect.
|
| 221 | */
|
| 222 | public GameSettings gameSettings;
|
| 223 |
|
| 224 | /**
|
| 225 | * Mouse helper instance.
|
| 226 | */
|
| 227 | public MouseHelper mouseHelper;
|
| 228 | public final File mcDataDir;
|
| 229 | private final File fileAssets;
|
| 230 | private final String launchedVersion;
|
| 231 | private final Proxy proxy;
|
| 232 | private ISaveFormat saveLoader;
|
| 233 |
|
| 234 | /**
|
| 235 | * This is set to fpsCounter every debug screen update, and is shown on the debug screen. It's also sent as part of
|
| 236 | * the usage snooping.
|
| 237 | */
|
| 238 | private static int debugFPS;
|
| 239 |
|
| 240 | /**
|
| 241 | * When you place a block, it's set to 6, decremented once per tick, when it's 0, you can place another block.
|
| 242 | */
|
| 243 | public int rightClickDelayTimer;
|
| 244 | private String serverName;
|
| 245 | private int serverPort;
|
| 246 |
|
| 247 | /**
|
| 248 | * Does the actual gameplay have focus. If so then mouse and keys will effect the player instead of menus.
|
| 249 | */
|
| 250 | public boolean inGameHasFocus;
|
| 251 | long systemTime = getSystemTime();
|
| 252 |
|
| 253 | /**
|
| 254 | * Join player counter
|
| 255 | */
|
| 256 | private int joinPlayerCounter;
|
| 257 | private final boolean jvm64bit;
|
| 258 | private final boolean isDemo;
|
| 259 | private NetworkManager myNetworkManager;
|
| 260 | private boolean integratedServerIsRunning;
|
| 261 |
|
| 262 | /**
|
| 263 | * The profiler instance
|
| 264 | */
|
| 265 | public final Profiler mcProfiler = new Profiler();
|
| 266 |
|
| 267 | /**
|
| 268 | * Keeps track of how long the debug crash keycombo (F3+C) has been pressed for, in order to crash after 10 seconds.
|
| 269 | */
|
| 270 | private long debugCrashKeyPressTime = -1L;
|
| 271 | private IReloadableResourceManager mcResourceManager;
|
| 272 | private final IMetadataSerializer metadataSerializer_ = new IMetadataSerializer();
|
| 273 | private final List defaultResourcePacks = Lists.newArrayList();
|
| 274 | private final DefaultResourcePack mcDefaultResourcePack;
|
| 275 | private ResourcePackRepository mcResourcePackRepository;
|
| 276 | private LanguageManager mcLanguageManager;
|
| 277 | private IStream stream;
|
| 278 | private Framebuffer framebufferMc;
|
| 279 | private TextureMap textureMapBlocks;
|
| 280 | private SoundHandler mcSoundHandler;
|
| 281 | private MusicTicker mcMusicTicker;
|
| 282 | private ResourceLocation mojangLogo;
|
| 283 | private final MinecraftSessionService sessionService;
|
| 284 | private SkinManager skinManager;
|
| 285 | private final Queue scheduledTasks = Queues.newArrayDeque();
|
| 286 | private long field_175615_aJ = 0L;
|
| 287 | private final Thread mcThread = Thread.currentThread();
|
| 288 | private ModelManager modelManager;
|
| 289 | private BlockRendererDispatcher field_175618_aM;
|
| 290 |
|
| 291 | /**
|
| 292 | * Set to true to keep the game loop running. Set to false by shutdown() to allow the game loop to exit cleanly.
|
| 293 | */
|
| 294 | volatile boolean running = true;
|
| 295 |
|
| 296 | /**
|
| 297 | * String that shows the debug information
|
| 298 | */
|
| 299 | public String debug = "";
|
| 300 | public boolean field_175613_B = false;
|
| 301 | public boolean field_175614_C = false;
|
| 302 | public boolean field_175611_D = false;
|
| 303 | public boolean field_175612_E = true;
|
| 304 |
|
| 305 | /**
|
| 306 | * Approximate time (in ms) of last update to debug string
|
| 307 | */
|
| 308 | long debugUpdateTime = getSystemTime();
|
| 309 |
|
| 310 | /**
|
| 311 | * holds the current fps
|
| 312 | */
|
| 313 | int fpsCounter;
|
| 314 | long prevFrameTime = -1L;
|
| 315 |
|
| 316 | /**
|
| 317 | * Profiler currently displayed in the debug screen pie chart
|
| 318 | */
|
| 319 | private String debugProfilerName = "root";
|
| 320 | private static final String __OBFID = "CL_00000631";
|
| 321 |
|
| 322 | public Minecraft(GameConfiguration p_i45547_1_) {
|
| 323 | theMinecraft = this;
|
| 324 | this.mcDataDir = p_i45547_1_.field_178744_c.field_178760_a;
|
| 325 | this.fileAssets = p_i45547_1_.field_178744_c.field_178759_c;
|
| 326 | this.fileResourcepacks = p_i45547_1_.field_178744_c.field_178758_b;
|
| 327 | this.launchedVersion = p_i45547_1_.field_178741_d.field_178755_b;
|
| 328 | this.twitchDetails = p_i45547_1_.field_178745_a.field_178750_b;
|
| 329 | this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(p_i45547_1_.field_178744_c.field_178759_c, p_i45547_1_.field_178744_c.field_178757_d)).func_152782_a());
|
| 330 | this.proxy = p_i45547_1_.field_178745_a.field_178751_c == null ? Proxy.NO_PROXY : p_i45547_1_.field_178745_a.field_178751_c;
|
| 331 | this.sessionService = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService();
|
| 332 | this.session = p_i45547_1_.field_178745_a.field_178752_a;
|
| 333 | logger.info("Setting user: " + this.session.getUsername());
|
| 334 | logger.info("(Session ID is " + this.session.getSessionID() + ")");
|
| 335 | this.isDemo = p_i45547_1_.field_178741_d.field_178756_a;
|
| 336 | this.displayWidth = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1;
|
| 337 | this.displayHeight = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1;
|
| 338 | this.tempDisplayWidth = p_i45547_1_.field_178743_b.field_178764_a;
|
| 339 | this.tempDisplayHeight = p_i45547_1_.field_178743_b.field_178762_b;
|
| 340 | this.fullscreen = p_i45547_1_.field_178743_b.field_178763_c;
|
| 341 | this.jvm64bit = isJvm64bit();
|
| 342 | this.theIntegratedServer = new IntegratedServer(this);
|
| 343 |
|
| 344 | if (p_i45547_1_.field_178742_e.field_178754_a != null) {
|
| 345 | this.serverName = p_i45547_1_.field_178742_e.field_178754_a;
|
| 346 | this.serverPort = p_i45547_1_.field_178742_e.field_178753_b;
|
| 347 | }
|
| 348 |
|
| 349 | ImageIO.setUseCache(false);
|
| 350 | Bootstrap.register();
|
| 351 | }
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 | public void run() {
|
| 358 | this.running = true;
|
| 359 | CrashReport var2;
|
| 360 |
|
| 361 | try {
|
| 362 | this.startGame();
|
| 363 | } catch (Throwable var11) {
|
| 364 | var2 = CrashReport.makeCrashReport(var11, "Initializing game");
|
| 365 | var2.makeCategory("Initialization");
|
| 366 | this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(var2));
|
| 367 | return;
|
| 368 | }
|
| 369 |
|
| 370 | while (true) {
|
| 371 | try {
|
| 372 | while (this.running) {
|
| 373 | if (!this.hasCrashed || this.crashReporter == null) {
|
| 374 | try {
|
| 375 | this.runGameLoop();
|
| 376 | } catch (OutOfMemoryError var10) {
|
| 377 | this.freeMemory();
|
| 378 | this.displayGuiScreen(new GuiMemoryErrorScreen());
|
| 379 |
|
| 380 | }
|
| 381 |
|
| 382 | continue;
|
| 383 | }
|
| 384 |
|
| 385 | this.displayCrashReport(this.crashReporter);
|
| 386 | return;
|
| 387 | }
|
| 388 | } catch (MinecraftError var12) {
|
| 389 | ;
|
| 390 | } catch (ReportedException var13) {
|
| 391 | this.addGraphicsAndWorldToCrashReport(var13.getCrashReport());
|
| 392 | this.freeMemory();
|
| 393 | logger.fatal("Reported exception thrown!", var13);
|
| 394 | this.displayCrashReport(var13.getCrashReport());
|
| 395 | } catch (Throwable var14) {
|
| 396 | var2 = this.addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", var14));
|
| 397 | this.freeMemory();
|
| 398 | logger.fatal("Unreported exception thrown!", var14);
|
| 399 | this.displayCrashReport(var2);
|
| 400 | } finally {
|
| 401 | this.shutdownMinecraftApplet();
|
| 402 | }
|
| 403 |
|
| 404 | return;
|
| 405 | }
|
| 406 | }
|
| 407 |
|
| 408 | /**
|
| 409 | * Starts the game: initializes the canvas, the title, the settings, etcetera.
|
| 410 | */
|
| 411 | private void startGame() throws LWJGLException, UnsupportedEncodingException, NoSuchAlgorithmException, MalformedURLException {
|
| 412 | this.gameSettings = new GameSettings(this, this.mcDataDir);
|
| 413 | this.defaultResourcePacks.add(this.mcDefaultResourcePack);
|
| 414 | this.startTimerHackThread();
|
| 415 |
|
| 416 | if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) {
|
| 417 | this.displayWidth = this.gameSettings.overrideWidth;
|
| 418 | this.displayHeight = this.gameSettings.overrideHeight;
|
| 419 | }
|
| 420 |
|
| 421 | logger.info("LWJGL Version: " + Sys.getVersion());
|
| 422 | this.func_175594_ao();
|
| 423 | this.func_175605_an();
|
| 424 | this.func_175609_am();
|
| 425 | OpenGlHelper.initializeTextures();
|
| 426 | this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true);
|
| 427 | this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F);
|
| 428 | this.func_175608_ak();
|
| 429 | this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, "server-resource-packs"), this.mcDefaultResourcePack, this.metadataSerializer_, this.gameSettings);
|
| 430 | this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
|
| 431 | this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
|
| 432 | this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
|
| 433 | this.refreshResources();
|
| 434 | this.renderEngine = new TextureManager(this.mcResourceManager);
|
| 435 | this.mcResourceManager.registerReloadListener(this.renderEngine);
|
| 436 | this.func_180510_a(this.renderEngine);
|
| 437 |
|
| 438 | this.func_175595_al();
|
| 439 | this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
|
| 440 | this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"));
|
| 441 | this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings);
|
| 442 | this.mcResourceManager.registerReloadListener(this.mcSoundHandler);
|
| 443 | this.mcMusicTicker = new MusicTicker(this);
|
| 444 | this.fontRendererObj = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false);
|
| 445 |
|
| 446 | if (this.gameSettings.language != null) {
|
| 447 | this.fontRendererObj.setUnicodeFlag(this.isUnicode());
|
| 448 | this.fontRendererObj.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional());
|
| 449 | }
|
| 450 |
|
| 451 | this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii_sga.png"), this.renderEngine, false);
|
| 452 | this.mcResourceManager.registerReloadListener(this.fontRendererObj);
|
| 453 | this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer);
|
| 454 | this.mcResourceManager.registerReloadListener(new GrassColorReloadListener());
|
| 455 | this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener());
|
| 456 | AchievementList.openInventory.setStatStringFormatter(new IStatStringFormat() {
|
| 457 | private static final String __OBFID = "CL_00000632";
|
| 458 |
|
| 459 | public String formatString(String p_74535_1_) {
|
| 460 | try {
|
| 461 | return String.format(p_74535_1_, new Object[]{GameSettings.getKeyDisplayString(Minecraft.this.gameSettings.keyBindInventory.getKeyCode())});
|
| 462 | } catch (Exception var3) {
|
| 463 | return "Error: " + var3.getLocalizedMessage();
|
| 464 | }
|
| 465 | }
|
| 466 | });
|
| 467 | this.mouseHelper = new MouseHelper();
|
| 468 | this.checkGLError("Pre startup");
|
| 469 | GlStateManager.func_179098_w();
|
| 470 | GlStateManager.shadeModel(7425);
|
| 471 | GlStateManager.clearDepth(1.0D);
|
| 472 | GlStateManager.enableDepth();
|
| 473 | GlStateManager.depthFunc(515);
|
| 474 | GlStateManager.enableAlpha();
|
| 475 | GlStateManager.alphaFunc(516, 0.1F);
|
| 476 | GlStateManager.cullFace(1029);
|
| 477 | GlStateManager.matrixMode(5889);
|
| 478 | GlStateManager.loadIdentity();
|
| 479 | GlStateManager.matrixMode(5888);
|
| 480 | this.checkGLError("Startup");
|
| 481 | this.textureMapBlocks = new TextureMap("textures");
|
| 482 | this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels);
|
| 483 | this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks);
|
| 484 | this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
| 485 | this.textureMapBlocks.func_174937_a(false, this.gameSettings.mipmapLevels > 0);
|
| 486 | this.modelManager = new ModelManager(this.textureMapBlocks);
|
| 487 | this.mcResourceManager.registerReloadListener(this.modelManager);
|
| 488 | this.renderItem = new RenderItem(this.renderEngine, this.modelManager);
|
| 489 | this.renderManager = new RenderManager(this.renderEngine, this.renderItem);
|
| 490 | this.itemRenderer = new ItemRenderer(this);
|
| 491 | this.mcResourceManager.registerReloadListener(this.renderItem);
|
| 492 | this.entityRenderer = new EntityRenderer(this, this.mcResourceManager);
|
| 493 | this.mcResourceManager.registerReloadListener(this.entityRenderer);
|
| 494 | this.field_175618_aM = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings);
|
| 495 | this.mcResourceManager.registerReloadListener(this.field_175618_aM);
|
| 496 | this.renderGlobal = new RenderGlobal(this);
|
| 497 | this.mcResourceManager.registerReloadListener(this.renderGlobal);
|
| 498 | this.guiAchievement = new GuiAchievement(this);
|
| 499 | GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight);
|
| 500 | this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
|
| 501 | this.checkGLError("Post startup");
|
| 502 | //TODO hook
|
| 503 | this.ingameGUI = new GameHud(this);
|
| 504 | Memeware.INSTANCE.init();
|
| 505 | if (this.serverName != null) {
|
| 506 | this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
|
| 507 | } else {
|
| 508 | this.displayGuiScreen(new GuiMainMenu());
|
| 509 | }
|
| 510 |
|
| 511 | this.renderEngine.deleteTexture(this.mojangLogo);
|
| 512 | this.mojangLogo = null;
|
| 513 | this.loadingScreen = new LoadingScreenRenderer(this);
|
| 514 |
|
| 515 | if (this.gameSettings.fullScreen && !this.fullscreen) {
|
| 516 | this.toggleFullscreen();
|
| 517 | }
|
| 518 |
|
| 519 | try {
|
| 520 | Display.setVSyncEnabled(this.gameSettings.enableVsync);
|
| 521 | } catch (OpenGLException var2) {
|
| 522 | this.gameSettings.enableVsync = false;
|
| 523 | this.gameSettings.saveOptions();
|
| 524 | }
|
| 525 |
|
| 526 | this.renderGlobal.func_174966_b();
|
| 527 | }
|
| 528 |
|
| 529 | private void func_175608_ak() {
|
| 530 | this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class);
|
| 531 | this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class);
|
| 532 | this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class);
|
| 533 | this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class);
|
| 534 | this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class);
|
| 535 | }
|
| 536 |
|
| 537 | private void func_175595_al() {
|
| 538 | try {
|
| 539 | this.stream = new TwitchStream(this, (Property) Iterables.getFirst(this.twitchDetails.get("twitch_access_token"), (Object) null));
|
| 540 | } catch (Throwable var2) {
|
| 541 | this.stream = new NullStream(var2);
|
| 542 | logger.error("Couldn\'t initialize twitch stream");
|
| 543 | }
|
| 544 | }
|
| 545 |
|
| 546 | private void func_175609_am() throws LWJGLException {
|
| 547 | Display.setResizable(true);
|
| 548 | Display.setTitle("Starting " + Memeware.INSTANCE.getClientName() + " " + Memeware.INSTANCE.getVersion());
|
| 549 |
|
| 550 | try {
|
| 551 | Display.create((new PixelFormat()).withDepthBits(24));
|
| 552 | } catch (LWJGLException var4) {
|
| 553 | logger.error("Couldn\'t set pixel format", var4);
|
| 554 |
|
| 555 | try {
|
| 556 | Thread.sleep(1000L);
|
| 557 | } catch (InterruptedException var3) {
|
| 558 | ;
|
| 559 | }
|
| 560 |
|
| 561 | if (this.fullscreen) {
|
| 562 | this.updateDisplayMode();
|
| 563 | }
|
| 564 |
|
| 565 | Display.create();
|
| 566 | }
|
| 567 | }
|
| 568 |
|
| 569 | private void func_175605_an() throws LWJGLException {
|
| 570 | if (this.fullscreen) {
|
| 571 | Display.setFullscreen(true);
|
| 572 | DisplayMode var1 = Display.getDisplayMode();
|
| 573 | this.displayWidth = Math.max(1, var1.getWidth());
|
| 574 | this.displayHeight = Math.max(1, var1.getHeight());
|
| 575 | } else {
|
| 576 | Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
|
| 577 | }
|
| 578 | }
|
| 579 |
|
| 580 | private void func_175594_ao() {
|
| 581 | Util.EnumOS var1 = Util.getOSType();
|
| 582 |
|
| 583 | if (var1 != Util.EnumOS.OSX) {
|
| 584 | InputStream var2 = null;
|
| 585 | InputStream var3 = null;
|
| 586 |
|
| 587 | try {
|
| 588 | var2 = this.mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_16x16.png"));
|
| 589 | var3 = this.mcDefaultResourcePack.func_152780_c(new ResourceLocation("icons/icon_32x32.png"));
|
| 590 |
|
| 591 | if (var2 != null && var3 != null) {
|
| 592 | Display.setIcon(new ByteBuffer[]{this.readImageToBuffer(var2), this.readImageToBuffer(var3)});
|
| 593 | }
|
| 594 | } catch (IOException var8) {
|
| 595 | logger.error("Couldn\'t set icon", var8);
|
| 596 | } finally {
|
| 597 | IOUtils.closeQuietly(var2);
|
| 598 | IOUtils.closeQuietly(var3);
|
| 599 | }
|
| 600 | }
|
| 601 | }
|
| 602 |
|
| 603 | private static boolean isJvm64bit() {
|
| 604 | String[] var0 = new String[]{"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"};
|
| 605 | String[] var1 = var0;
|
| 606 | int var2 = var0.length;
|
| 607 |
|
| 608 | for (int var3 = 0; var3 < var2; ++var3) {
|
| 609 | String var4 = var1[var3];
|
| 610 | String var5 = System.getProperty(var4);
|
| 611 |
|
| 612 | if (var5 != null && var5.contains("64")) {
|
| 613 | return true;
|
| 614 | }
|
| 615 | }
|
| 616 |
|
| 617 | return false;
|
| 618 | }
|
| 619 |
|
| 620 | public Framebuffer getFramebuffer() {
|
| 621 | return this.framebufferMc;
|
| 622 | }
|
| 623 |
|
| 624 | public String func_175600_c() {
|
| 625 | return this.launchedVersion;
|
| 626 | }
|
| 627 |
|
| 628 | private void startTimerHackThread() {
|
| 629 | Thread var1 = new Thread("Timer hack thread") {
|
| 630 | private static final String __OBFID = "CL_00000639";
|
| 631 |
|
| 632 | public void run() {
|
| 633 | while (Minecraft.this.running) {
|
| 634 | try {
|
| 635 | Thread.sleep(2147483647L);
|
| 636 | } catch (InterruptedException var2) {
|
| 637 | ;
|
| 638 | }
|
| 639 | }
|
| 640 | }
|
| 641 | };
|
| 642 | var1.setDaemon(true);
|
| 643 | var1.start();
|
| 644 | }
|
| 645 |
|
| 646 | public void crashed(CrashReport crash) {
|
| 647 | this.hasCrashed = true;
|
| 648 | this.crashReporter = crash;
|
| 649 | }
|
| 650 |
|
| 651 | /**
|
| 652 | * Wrapper around displayCrashReportInternal
|
| 653 | */
|
| 654 | public void displayCrashReport(CrashReport crashReportIn) {
|
| 655 | File var2 = new File(getMinecraft().mcDataDir, "crash-reports");
|
| 656 | File var3 = new File(var2, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
|
| 657 | Bootstrap.func_179870_a(crashReportIn.getCompleteReport());
|
| 658 |
|
| 659 | if (crashReportIn.getFile() != null) {
|
| 660 | Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile());
|
| 661 | System.exit(-1);
|
| 662 | } else if (crashReportIn.saveToFile(var3)) {
|
| 663 | Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + var3.getAbsolutePath());
|
| 664 | System.exit(-1);
|
| 665 | } else {
|
| 666 | Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
| 667 | System.exit(-2);
|
| 668 | }
|
| 669 | }
|
| 670 |
|
| 671 | public boolean isUnicode() {
|
| 672 | return this.mcLanguageManager.isCurrentLocaleUnicode() || this.gameSettings.forceUnicodeFont;
|
| 673 | }
|
| 674 |
|
| 675 | public void refreshResources() {
|
| 676 | ArrayList var1 = Lists.newArrayList(this.defaultResourcePacks);
|
| 677 | Iterator var2 = this.mcResourcePackRepository.getRepositoryEntries().iterator();
|
| 678 |
|
| 679 | while (var2.hasNext()) {
|
| 680 | ResourcePackRepository.Entry var3 = (ResourcePackRepository.Entry) var2.next();
|
| 681 | var1.add(var3.getResourcePack());
|
| 682 | }
|
| 683 |
|
| 684 | if (this.mcResourcePackRepository.getResourcePackInstance() != null) {
|
| 685 | var1.add(this.mcResourcePackRepository.getResourcePackInstance());
|
| 686 | }
|
| 687 |
|
| 688 | try {
|
| 689 | this.mcResourceManager.reloadResources(var1);
|
| 690 | } catch (RuntimeException var4) {
|
| 691 | logger.info("Caught error stitching, removing all assigned resourcepacks", var4);
|
| 692 | var1.clear();
|
| 693 | var1.addAll(this.defaultResourcePacks);
|
| 694 | this.mcResourcePackRepository.func_148527_a(Collections.emptyList());
|
| 695 | this.mcResourceManager.reloadResources(var1);
|
| 696 | this.gameSettings.resourcePacks.clear();
|
| 697 | this.gameSettings.saveOptions();
|
| 698 | }
|
| 699 |
|
| 700 | this.mcLanguageManager.parseLanguageMetadata(var1);
|
| 701 |
|
| 702 | if (this.renderGlobal != null) {
|
| 703 | this.renderGlobal.loadRenderers();
|
| 704 | }
|
| 705 | }
|
| 706 |
|
| 707 | private ByteBuffer readImageToBuffer(InputStream imageStream) throws IOException {
|
| 708 | BufferedImage var2 = ImageIO.read(imageStream);
|
| 709 | int[] var3 = var2.getRGB(0, 0, var2.getWidth(), var2.getHeight(), (int[]) null, 0, var2.getWidth());
|
| 710 | ByteBuffer var4 = ByteBuffer.allocate(4 * var3.length);
|
| 711 | int[] var5 = var3;
|
| 712 | int var6 = var3.length;
|
| 713 |
|
| 714 | for (int var7 = 0; var7 < var6; ++var7) {
|
| 715 | int var8 = var5[var7];
|
| 716 | var4.putInt(var8 << 8 | var8 >> 24 & 255);
|
| 717 | }
|
| 718 |
|
| 719 | var4.flip();
|
| 720 | return var4;
|
| 721 | }
|
| 722 |
|
| 723 | private void updateDisplayMode() throws LWJGLException {
|
| 724 | HashSet var1 = Sets.newHashSet();
|
| 725 | Collections.addAll(var1, Display.getAvailableDisplayModes());
|
| 726 | DisplayMode var2 = Display.getDesktopDisplayMode();
|
| 727 |
|
| 728 | if (!var1.contains(var2) && Util.getOSType() == Util.EnumOS.OSX) {
|
| 729 | Iterator var3 = macDisplayModes.iterator();
|
| 730 |
|
| 731 | while (var3.hasNext()) {
|
| 732 | DisplayMode var4 = (DisplayMode) var3.next();
|
| 733 | boolean var5 = true;
|
| 734 | Iterator var6 = var1.iterator();
|
| 735 | DisplayMode var7;
|
| 736 |
|
| 737 | while (var6.hasNext()) {
|
| 738 | var7 = (DisplayMode) var6.next();
|
| 739 |
|
| 740 | if (var7.getBitsPerPixel() == 32 && var7.getWidth() == var4.getWidth() && var7.getHeight() == var4.getHeight()) {
|
| 741 | var5 = false;
|
| 742 | break;
|
| 743 | }
|
| 744 | }
|
| 745 |
|
| 746 | if (!var5) {
|
| 747 | var6 = var1.iterator();
|
| 748 |
|
| 749 | while (var6.hasNext()) {
|
| 750 | var7 = (DisplayMode) var6.next();
|
| 751 |
|
| 752 | if (var7.getBitsPerPixel() == 32 && var7.getWidth() == var4.getWidth() / 2 && var7.getHeight() == var4.getHeight() / 2) {
|
| 753 | var2 = var7;
|
| 754 | break;
|
| 755 | }
|
| 756 | }
|
| 757 | }
|
| 758 | }
|
| 759 | }
|
| 760 |
|
| 761 | Display.setDisplayMode(var2);
|
| 762 | this.displayWidth = var2.getWidth();
|
| 763 | this.displayHeight = var2.getHeight();
|
| 764 | }
|
| 765 |
|
| 766 | private void func_180510_a(TextureManager p_180510_1_) {
|
| 767 | ScaledResolution var2 = new ScaledResolution(this, this.displayWidth, this.displayHeight);
|
| 768 | int var3 = var2.getScaleFactor();
|
| 769 | Framebuffer var4 = new Framebuffer(var2.getScaledWidth() * var3, var2.getScaledHeight() * var3, true);
|
| 770 | var4.bindFramebuffer(false);
|
| 771 | GlStateManager.matrixMode(5889);
|
| 772 | GlStateManager.loadIdentity();
|
| 773 | GlStateManager.ortho(0.0D, (double) var2.getScaledWidth(), (double) var2.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
|
| 774 | GlStateManager.matrixMode(5888);
|
| 775 | GlStateManager.loadIdentity();
|
| 776 | GlStateManager.translate(0.0F, 0.0F, -2000.0F);
|
| 777 | GlStateManager.disableLighting();
|
| 778 | GlStateManager.disableFog();
|
| 779 | GlStateManager.disableDepth();
|
| 780 | GlStateManager.func_179098_w();
|
| 781 | InputStream var5 = null;
|
| 782 |
|
| 783 | try {
|
| 784 | var5 = this.mcDefaultResourcePack.getInputStream(locationMojangPng);
|
| 785 | this.mojangLogo = p_180510_1_.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(var5)));
|
| 786 | p_180510_1_.bindTexture(this.mojangLogo);
|
| 787 | } catch (IOException var12) {
|
| 788 | logger.error("Unable to load logo: " + locationMojangPng, var12);
|
| 789 | } finally {
|
| 790 | IOUtils.closeQuietly(var5);
|
| 791 | }
|
| 792 |
|
| 793 | Tessellator var6 = Tessellator.getInstance();
|
| 794 | WorldRenderer var7 = var6.getWorldRenderer();
|
| 795 | var7.startDrawingQuads();
|
| 796 | var7.func_178991_c(16777215);
|
| 797 | var7.addVertexWithUV(0.0D, (double) this.displayHeight, 0.0D, 0.0D, 0.0D);
|
| 798 | var7.addVertexWithUV((double) this.displayWidth, (double) this.displayHeight, 0.0D, 0.0D, 0.0D);
|
| 799 | var7.addVertexWithUV((double) this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
|
| 800 | var7.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
| 801 | var6.draw();
|
| 802 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 803 | var7.func_178991_c(16777215);
|
| 804 | short var8 = 256;
|
| 805 | short var9 = 256;
|
| 806 | this.scaledTessellator((var2.getScaledWidth() - var8) / 2, (var2.getScaledHeight() - var9) / 2, 0, 0, var8, var9);
|
| 807 | GlStateManager.disableLighting();
|
| 808 | GlStateManager.disableFog();
|
| 809 | var4.unbindFramebuffer();
|
| 810 | var4.framebufferRender(var2.getScaledWidth() * var3, var2.getScaledHeight() * var3);
|
| 811 | GlStateManager.enableAlpha();
|
| 812 | GlStateManager.alphaFunc(516, 0.1F);
|
| 813 | this.func_175601_h();
|
| 814 | }
|
| 815 |
|
| 816 | /**
|
| 817 | * Loads Tessellator with a scaled resolution
|
| 818 | */
|
| 819 | public void scaledTessellator(int width, int height, int width2, int height2, int stdTextureWidth, int stdTextureHeight) {
|
| 820 | float var7 = 0.00390625F;
|
| 821 | float var8 = 0.00390625F;
|
| 822 | WorldRenderer var9 = Tessellator.getInstance().getWorldRenderer();
|
| 823 | var9.startDrawingQuads();
|
| 824 | var9.addVertexWithUV((double) (width + 0), (double) (height + stdTextureHeight), 0.0D, (double) ((float) (width2 + 0) * var7), (double) ((float) (height2 + stdTextureHeight) * var8));
|
| 825 | var9.addVertexWithUV((double) (width + stdTextureWidth), (double) (height + stdTextureHeight), 0.0D, (double) ((float) (width2 + stdTextureWidth) * var7), (double) ((float) (height2 + stdTextureHeight) * var8));
|
| 826 | var9.addVertexWithUV((double) (width + stdTextureWidth), (double) (height + 0), 0.0D, (double) ((float) (width2 + stdTextureWidth) * var7), (double) ((float) (height2 + 0) * var8));
|
| 827 | var9.addVertexWithUV((double) (width + 0), (double) (height + 0), 0.0D, (double) ((float) (width2 + 0) * var7), (double) ((float) (height2 + 0) * var8));
|
| 828 | Tessellator.getInstance().draw();
|
| 829 | }
|
| 830 |
|
| 831 | /**
|
| 832 | * Returns the save loader that is currently being used
|
| 833 | */
|
| 834 | public ISaveFormat getSaveLoader() {
|
| 835 | return this.saveLoader;
|
| 836 | }
|
| 837 |
|
| 838 | /**
|
| 839 | * Sets the argument GuiScreen as the main (topmost visible) screen.
|
| 840 | */
|
| 841 | public void displayGuiScreen(GuiScreen guiScreenIn) {
|
| 842 | if (this.currentScreen != null) {
|
| 843 | this.currentScreen.onGuiClosed();
|
| 844 | }
|
| 845 |
|
| 846 | if (guiScreenIn == null && this.theWorld == null) {
|
| 847 | guiScreenIn = new GuiMainMenu();
|
| 848 | } else if (guiScreenIn == null && this.thePlayer.getHealth() <= 0.0F) {
|
| 849 | guiScreenIn = new GuiGameOver();
|
| 850 | }
|
| 851 |
|
| 852 | if (guiScreenIn instanceof GuiMainMenu) {
|
| 853 | this.gameSettings.showDebugInfo = false;
|
| 854 | this.ingameGUI.getChatGUI().clearChatMessages();
|
| 855 | }
|
| 856 |
|
| 857 | this.currentScreen = (GuiScreen) guiScreenIn;
|
| 858 |
|
| 859 | if (guiScreenIn != null) {
|
| 860 | this.setIngameNotInFocus();
|
| 861 | ScaledResolution var2 = new ScaledResolution(this, this.displayWidth, this.displayHeight);
|
| 862 | int var3 = var2.getScaledWidth();
|
| 863 | int var4 = var2.getScaledHeight();
|
| 864 | ((GuiScreen) guiScreenIn).setWorldAndResolution(this, var3, var4);
|
| 865 | this.skipRenderWorld = false;
|
| 866 | } else {
|
| 867 | this.mcSoundHandler.resumeSounds();
|
| 868 | this.setIngameFocus();
|
| 869 | }
|
| 870 | }
|
| 871 |
|
| 872 | /**
|
| 873 | * Checks for an OpenGL error. If there is one, prints the error ID and error string.
|
| 874 | */
|
| 875 | private void checkGLError(String message) {
|
| 876 | if (this.field_175619_R) {
|
| 877 | int var2 = GL11.glGetError();
|
| 878 |
|
| 879 | if (var2 != 0) {
|
| 880 | String var3 = GLU.gluErrorString(var2);
|
| 881 | logger.error("########## GL ERROR ##########");
|
| 882 | logger.error("@ " + message);
|
| 883 | logger.error(var2 + ": " + var3);
|
| 884 | }
|
| 885 | }
|
| 886 | }
|
| 887 |
|
| 888 | /**
|
| 889 | * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the
|
| 890 | * application (or web page) is exited.
|
| 891 | */
|
| 892 | public void shutdownMinecraftApplet() {
|
| 893 | try {
|
| 894 | this.stream.shutdownStream();
|
| 895 | logger.info("Stopping!");
|
| 896 |
|
| 897 | try {
|
| 898 | this.loadWorld((WorldClient) null);
|
| 899 | } catch (Throwable var5) {
|
| 900 | ;
|
| 901 | }
|
| 902 |
|
| 903 | this.mcSoundHandler.unloadSounds();
|
| 904 | } finally {
|
| 905 | Display.destroy();
|
| 906 |
|
| 907 | if (!this.hasCrashed) {
|
| 908 | System.exit(0);
|
| 909 | }
|
| 910 | }
|
| 911 |
|
| 912 |
|
| 913 | }
|
| 914 |
|
| 915 | /**
|
| 916 | * Called repeatedly from run()
|
| 917 | */
|
| 918 | private void runGameLoop() throws IOException {
|
| 919 | this.mcProfiler.startSection("root");
|
| 920 |
|
| 921 | if (Display.isCreated() && Display.isCloseRequested()) {
|
| 922 | this.shutdown();
|
| 923 | }
|
| 924 |
|
| 925 | if (this.isGamePaused && this.theWorld != null) {
|
| 926 | float var1 = this.timer.renderPartialTicks;
|
| 927 | this.timer.updateTimer();
|
| 928 | this.timer.renderPartialTicks = var1;
|
| 929 | } else {
|
| 930 | this.timer.updateTimer();
|
| 931 | }
|
| 932 |
|
| 933 | this.mcProfiler.startSection("scheduledExecutables");
|
| 934 | Queue var6 = this.scheduledTasks;
|
| 935 |
|
| 936 | synchronized (this.scheduledTasks) {
|
| 937 | while (!this.scheduledTasks.isEmpty()) {
|
| 938 | ((FutureTask) this.scheduledTasks.poll()).run();
|
| 939 | }
|
| 940 | }
|
| 941 |
|
| 942 | this.mcProfiler.endSection();
|
| 943 | long var7 = System.nanoTime();
|
| 944 | this.mcProfiler.startSection("tick");
|
| 945 |
|
| 946 | for (int var3 = 0; var3 < this.timer.elapsedTicks; ++var3) {
|
| 947 | this.runTick();
|
| 948 | }
|
| 949 |
|
| 950 | this.mcProfiler.endStartSection("preRenderErrors");
|
| 951 | long var8 = System.nanoTime() - var7;
|
| 952 | this.checkGLError("Pre render");
|
| 953 | this.mcProfiler.endStartSection("sound");
|
| 954 | this.mcSoundHandler.setListener(this.thePlayer, this.timer.renderPartialTicks);
|
| 955 | this.mcProfiler.endSection();
|
| 956 | this.mcProfiler.startSection("render");
|
| 957 | GlStateManager.pushMatrix();
|
| 958 | GlStateManager.clear(16640);
|
| 959 | this.framebufferMc.bindFramebuffer(true);
|
| 960 | this.mcProfiler.startSection("display");
|
| 961 | GlStateManager.func_179098_w();
|
| 962 |
|
| 963 | if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) {
|
| 964 | this.gameSettings.thirdPersonView = 0;
|
| 965 | }
|
| 966 |
|
| 967 | this.mcProfiler.endSection();
|
| 968 |
|
| 969 | if (!this.skipRenderWorld) {
|
| 970 | this.mcProfiler.endStartSection("gameRenderer");
|
| 971 | this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
| 972 | this.mcProfiler.endSection();
|
| 973 | }
|
| 974 |
|
| 975 | this.mcProfiler.endSection();
|
| 976 |
|
| 977 | if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart && !this.gameSettings.hideGUI) {
|
| 978 | if (!this.mcProfiler.profilingEnabled) {
|
| 979 | this.mcProfiler.clearProfiling();
|
| 980 | }
|
| 981 |
|
| 982 | this.mcProfiler.profilingEnabled = true;
|
| 983 | this.displayDebugInfo(var8);
|
| 984 | } else {
|
| 985 | this.mcProfiler.profilingEnabled = false;
|
| 986 | this.prevFrameTime = System.nanoTime();
|
| 987 | }
|
| 988 |
|
| 989 | this.guiAchievement.updateAchievementWindow();
|
| 990 | this.framebufferMc.unbindFramebuffer();
|
| 991 | GlStateManager.popMatrix();
|
| 992 | GlStateManager.pushMatrix();
|
| 993 | this.framebufferMc.framebufferRender(this.displayWidth, this.displayHeight);
|
| 994 | GlStateManager.popMatrix();
|
| 995 | GlStateManager.pushMatrix();
|
| 996 | this.entityRenderer.func_152430_c(this.timer.renderPartialTicks);
|
| 997 | GlStateManager.popMatrix();
|
| 998 | this.mcProfiler.startSection("root");
|
| 999 | this.func_175601_h();
|
| 1000 | Thread.yield();
|
| 1001 | this.mcProfiler.startSection("stream");
|
| 1002 | this.mcProfiler.startSection("update");
|
| 1003 | this.stream.func_152935_j();
|
| 1004 | this.mcProfiler.endStartSection("submit");
|
| 1005 | this.stream.func_152922_k();
|
| 1006 | this.mcProfiler.endSection();
|
| 1007 | this.mcProfiler.endSection();
|
| 1008 | this.checkGLError("Post render");
|
| 1009 | ++this.fpsCounter;
|
| 1010 | this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic();
|
| 1011 |
|
| 1012 | while (getSystemTime() >= this.debugUpdateTime + 1000L) {
|
| 1013 | debugFPS = this.fpsCounter;
|
| 1014 | this.debug = String.format("%d fps (%d chunk update%s) T: %s%s%s%s%s", new Object[]{Integer.valueOf(debugFPS), Integer.valueOf(RenderChunk.field_178592_a), RenderChunk.field_178592_a != 1 ? "s" : "", (float) this.gameSettings.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() ? "inf" : Integer.valueOf(this.gameSettings.limitFramerate), this.gameSettings.enableVsync ? " vsync" : "", this.gameSettings.fancyGraphics ? "" : " fast", this.gameSettings.clouds ? " clouds" : "", OpenGlHelper.func_176075_f() ? " vbo" : ""});
|
| 1015 | RenderChunk.field_178592_a = 0;
|
| 1016 | this.debugUpdateTime += 1000L;
|
| 1017 | this.fpsCounter = 0;
|
| 1018 | this.usageSnooper.addMemoryStatsToSnooper();
|
| 1019 |
|
| 1020 | if (!this.usageSnooper.isSnooperRunning()) {
|
| 1021 | this.usageSnooper.startSnooper();
|
| 1022 | }
|
| 1023 | }
|
| 1024 |
|
| 1025 | if (this.isFramerateLimitBelowMax()) {
|
| 1026 | this.mcProfiler.startSection("fpslimit_wait");
|
| 1027 | Display.sync(this.getLimitFramerate());
|
| 1028 | this.mcProfiler.endSection();
|
| 1029 | }
|
| 1030 |
|
| 1031 | this.mcProfiler.endSection();
|
| 1032 | }
|
| 1033 |
|
| 1034 | public void func_175601_h() {
|
| 1035 | this.mcProfiler.startSection("display_update");
|
| 1036 | Display.update();
|
| 1037 | this.mcProfiler.endSection();
|
| 1038 | this.func_175604_i();
|
| 1039 | }
|
| 1040 |
|
| 1041 | protected void func_175604_i() {
|
| 1042 | if (!this.fullscreen && Display.wasResized()) {
|
| 1043 | int var1 = this.displayWidth;
|
| 1044 | int var2 = this.displayHeight;
|
| 1045 | this.displayWidth = Display.getWidth();
|
| 1046 | this.displayHeight = Display.getHeight();
|
| 1047 |
|
| 1048 | if (this.displayWidth != var1 || this.displayHeight != var2) {
|
| 1049 | if (this.displayWidth <= 0) {
|
| 1050 | this.displayWidth = 1;
|
| 1051 | }
|
| 1052 |
|
| 1053 | if (this.displayHeight <= 0) {
|
| 1054 | this.displayHeight = 1;
|
| 1055 | }
|
| 1056 |
|
| 1057 | this.resize(this.displayWidth, this.displayHeight);
|
| 1058 | }
|
| 1059 | }
|
| 1060 | }
|
| 1061 |
|
| 1062 | public int getLimitFramerate() {
|
| 1063 | return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
|
| 1064 | }
|
| 1065 |
|
| 1066 | public boolean isFramerateLimitBelowMax() {
|
| 1067 | return (float) this.getLimitFramerate() < GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
|
| 1068 | }
|
| 1069 |
|
| 1070 | public void freeMemory() {
|
| 1071 | try {
|
| 1072 | memoryReserve = new byte[0];
|
| 1073 | this.renderGlobal.deleteAllDisplayLists();
|
| 1074 | } catch (Throwable var3) {
|
| 1075 | ;
|
| 1076 | }
|
| 1077 |
|
| 1078 | try {
|
| 1079 |
|
| 1080 | this.loadWorld((WorldClient) null);
|
| 1081 | } catch (Throwable var2) {
|
| 1082 | ;
|
| 1083 | }
|
| 1084 |
|
| 1085 |
|
| 1086 | }
|
| 1087 |
|
| 1088 | /**
|
| 1089 | * Update debugProfilerName in response to number keys in debug screen
|
| 1090 | */
|
| 1091 | private void updateDebugProfilerName(int keyCount) {
|
| 1092 | List var2 = this.mcProfiler.getProfilingData(this.debugProfilerName);
|
| 1093 |
|
| 1094 | if (var2 != null && !var2.isEmpty()) {
|
| 1095 | Profiler.Result var3 = (Profiler.Result) var2.remove(0);
|
| 1096 |
|
| 1097 | if (keyCount == 0) {
|
| 1098 | if (var3.field_76331_c.length() > 0) {
|
| 1099 | int var4 = this.debugProfilerName.lastIndexOf(".");
|
| 1100 |
|
| 1101 | if (var4 >= 0) {
|
| 1102 | this.debugProfilerName = this.debugProfilerName.substring(0, var4);
|
| 1103 | }
|
| 1104 | }
|
| 1105 | } else {
|
| 1106 | --keyCount;
|
| 1107 |
|
| 1108 | if (keyCount < var2.size() && !((Profiler.Result) var2.get(keyCount)).field_76331_c.equals("unspecified")) {
|
| 1109 | if (this.debugProfilerName.length() > 0) {
|
| 1110 | this.debugProfilerName = this.debugProfilerName + ".";
|
| 1111 | }
|
| 1112 |
|
| 1113 | this.debugProfilerName = this.debugProfilerName + ((Profiler.Result) var2.get(keyCount)).field_76331_c;
|
| 1114 | }
|
| 1115 | }
|
| 1116 | }
|
| 1117 | }
|
| 1118 |
|
| 1119 | /**
|
| 1120 | * Parameter appears to be unused
|
| 1121 | */
|
| 1122 | private void displayDebugInfo(long elapsedTicksTime) {
|
| 1123 | if (this.mcProfiler.profilingEnabled) {
|
| 1124 | List var3 = this.mcProfiler.getProfilingData(this.debugProfilerName);
|
| 1125 | Profiler.Result var4 = (Profiler.Result) var3.remove(0);
|
| 1126 | GlStateManager.clear(256);
|
| 1127 | GlStateManager.matrixMode(5889);
|
| 1128 | GlStateManager.enableColorMaterial();
|
| 1129 | GlStateManager.loadIdentity();
|
| 1130 | GlStateManager.ortho(0.0D, (double) this.displayWidth, (double) this.displayHeight, 0.0D, 1000.0D, 3000.0D);
|
| 1131 | GlStateManager.matrixMode(5888);
|
| 1132 | GlStateManager.loadIdentity();
|
| 1133 | GlStateManager.translate(0.0F, 0.0F, -2000.0F);
|
| 1134 | GL11.glLineWidth(1.0F);
|
| 1135 | GlStateManager.func_179090_x();
|
| 1136 | Tessellator var5 = Tessellator.getInstance();
|
| 1137 | WorldRenderer var6 = var5.getWorldRenderer();
|
| 1138 | short var7 = 160;
|
| 1139 | int var8 = this.displayWidth - var7 - 10;
|
| 1140 | int var9 = this.displayHeight - var7 * 2;
|
| 1141 | GlStateManager.enableBlend();
|
| 1142 | var6.startDrawingQuads();
|
| 1143 | var6.func_178974_a(0, 200);
|
| 1144 | var6.addVertex((double) ((float) var8 - (float) var7 * 1.1F), (double) ((float) var9 - (float) var7 * 0.6F - 16.0F), 0.0D);
|
| 1145 | var6.addVertex((double) ((float) var8 - (float) var7 * 1.1F), (double) (var9 + var7 * 2), 0.0D);
|
| 1146 | var6.addVertex((double) ((float) var8 + (float) var7 * 1.1F), (double) (var9 + var7 * 2), 0.0D);
|
| 1147 | var6.addVertex((double) ((float) var8 + (float) var7 * 1.1F), (double) ((float) var9 - (float) var7 * 0.6F - 16.0F), 0.0D);
|
| 1148 | var5.draw();
|
| 1149 | GlStateManager.disableBlend();
|
| 1150 | double var10 = 0.0D;
|
| 1151 | int var14;
|
| 1152 |
|
| 1153 | for (int var12 = 0; var12 < var3.size(); ++var12) {
|
| 1154 | Profiler.Result var13 = (Profiler.Result) var3.get(var12);
|
| 1155 | var14 = MathHelper.floor_double(var13.field_76332_a / 4.0D) + 1;
|
| 1156 | var6.startDrawing(6);
|
| 1157 | var6.func_178991_c(var13.func_76329_a());
|
| 1158 | var6.addVertex((double) var8, (double) var9, 0.0D);
|
| 1159 | int var15;
|
| 1160 | float var16;
|
| 1161 | float var17;
|
| 1162 | float var18;
|
| 1163 |
|
| 1164 | for (var15 = var14; var15 >= 0; --var15) {
|
| 1165 | var16 = (float) ((var10 + var13.field_76332_a * (double) var15 / (double) var14) * Math.PI * 2.0D / 100.0D);
|
| 1166 | var17 = MathHelper.sin(var16) * (float) var7;
|
| 1167 | var18 = MathHelper.cos(var16) * (float) var7 * 0.5F;
|
| 1168 | var6.addVertex((double) ((float) var8 + var17), (double) ((float) var9 - var18), 0.0D);
|
| 1169 | }
|
| 1170 |
|
| 1171 | var5.draw();
|
| 1172 | var6.startDrawing(5);
|
| 1173 | var6.func_178991_c((var13.func_76329_a() & 16711422) >> 1);
|
| 1174 |
|
| 1175 | for (var15 = var14; var15 >= 0; --var15) {
|
| 1176 | var16 = (float) ((var10 + var13.field_76332_a * (double) var15 / (double) var14) * Math.PI * 2.0D / 100.0D);
|
| 1177 | var17 = MathHelper.sin(var16) * (float) var7;
|
| 1178 | var18 = MathHelper.cos(var16) * (float) var7 * 0.5F;
|
| 1179 | var6.addVertex((double) ((float) var8 + var17), (double) ((float) var9 - var18), 0.0D);
|
| 1180 | var6.addVertex((double) ((float) var8 + var17), (double) ((float) var9 - var18 + 10.0F), 0.0D);
|
| 1181 | }
|
| 1182 |
|
| 1183 | var5.draw();
|
| 1184 | var10 += var13.field_76332_a;
|
| 1185 | }
|
| 1186 |
|
| 1187 | DecimalFormat var19 = new DecimalFormat("##0.00");
|
| 1188 | GlStateManager.func_179098_w();
|
| 1189 | String var20 = "";
|
| 1190 |
|
| 1191 | if (!var4.field_76331_c.equals("unspecified")) {
|
| 1192 | var20 = var20 + "[0] ";
|
| 1193 | }
|
| 1194 |
|
| 1195 | if (var4.field_76331_c.length() == 0) {
|
| 1196 | var20 = var20 + "ROOT ";
|
| 1197 | } else {
|
| 1198 | var20 = var20 + var4.field_76331_c + " ";
|
| 1199 | }
|
| 1200 |
|
| 1201 | var14 = 16777215;
|
| 1202 | this.fontRendererObj.func_175063_a(var20, (float) (var8 - var7), (float) (var9 - var7 / 2 - 16), var14);
|
| 1203 | this.fontRendererObj.func_175063_a(var20 = var19.format(var4.field_76330_b) + "%", (float) (var8 + var7 - this.fontRendererObj.getStringWidth(var20)), (float) (var9 - var7 / 2 - 16), var14);
|
| 1204 |
|
| 1205 | for (int var21 = 0; var21 < var3.size(); ++var21) {
|
| 1206 | Profiler.Result var22 = (Profiler.Result) var3.get(var21);
|
| 1207 | String var23 = "";
|
| 1208 |
|
| 1209 | if (var22.field_76331_c.equals("unspecified")) {
|
| 1210 | var23 = var23 + "[?] ";
|
| 1211 | } else {
|
| 1212 | var23 = var23 + "[" + (var21 + 1) + "] ";
|
| 1213 | }
|
| 1214 |
|
| 1215 | var23 = var23 + var22.field_76331_c;
|
| 1216 | this.fontRendererObj.func_175063_a(var23, (float) (var8 - var7), (float) (var9 + var7 / 2 + var21 * 8 + 20), var22.func_76329_a());
|
| 1217 | this.fontRendererObj.func_175063_a(var23 = var19.format(var22.field_76332_a) + "%", (float) (var8 + var7 - 50 - this.fontRendererObj.getStringWidth(var23)), (float) (var9 + var7 / 2 + var21 * 8 + 20), var22.func_76329_a());
|
| 1218 | this.fontRendererObj.func_175063_a(var23 = var19.format(var22.field_76330_b) + "%", (float) (var8 + var7 - this.fontRendererObj.getStringWidth(var23)), (float) (var9 + var7 / 2 + var21 * 8 + 20), var22.func_76329_a());
|
| 1219 | }
|
| 1220 | }
|
| 1221 | }
|
| 1222 |
|
| 1223 | /**
|
| 1224 | * Called when the window is closing. Sets 'running' to false which allows the game loop to exit cleanly.
|
| 1225 | */
|
| 1226 | public void shutdown() {
|
| 1227 | this.running = false;
|
| 1228 | }
|
| 1229 |
|
| 1230 | /**
|
| 1231 | * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen
|
| 1232 | * currently displayed
|
| 1233 | */
|
| 1234 | public void setIngameFocus() {
|
| 1235 | if (Display.isActive()) {
|
| 1236 | if (!this.inGameHasFocus) {
|
| 1237 | this.inGameHasFocus = true;
|
| 1238 | this.mouseHelper.grabMouseCursor();
|
| 1239 | this.displayGuiScreen((GuiScreen) null);
|
| 1240 | this.leftClickCounter = 10000;
|
| 1241 | }
|
| 1242 | }
|
| 1243 | }
|
| 1244 |
|
| 1245 | /**
|
| 1246 | * Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor.
|
| 1247 | */
|
| 1248 | public void setIngameNotInFocus() {
|
| 1249 | if (this.inGameHasFocus) {
|
| 1250 | KeyBinding.unPressAllKeys();
|
| 1251 | this.inGameHasFocus = false;
|
| 1252 | this.mouseHelper.ungrabMouseCursor();
|
| 1253 | }
|
| 1254 | }
|
| 1255 |
|
| 1256 | /**
|
| 1257 | * Displays the ingame menu
|
| 1258 | */
|
| 1259 | public void displayInGameMenu() {
|
| 1260 | if (this.currentScreen == null) {
|
| 1261 | this.displayGuiScreen(new GuiIngameMenu());
|
| 1262 |
|
| 1263 | if (this.isSingleplayer() && !this.theIntegratedServer.getPublic()) {
|
| 1264 | this.mcSoundHandler.pauseSounds();
|
| 1265 | }
|
| 1266 | }
|
| 1267 | }
|
| 1268 |
|
| 1269 | private void sendClickBlockToController(boolean leftClick) {
|
| 1270 | if (!leftClick) {
|
| 1271 | this.leftClickCounter = 0;
|
| 1272 | }
|
| 1273 |
|
| 1274 | if (this.leftClickCounter <= 0 && !this.thePlayer.isUsingItem()) {
|
| 1275 | if (leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
| 1276 | BlockPos var2 = this.objectMouseOver.func_178782_a();
|
| 1277 |
|
| 1278 | if (this.theWorld.getBlockState(var2).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(var2, this.objectMouseOver.field_178784_b)) {
|
| 1279 | this.effectRenderer.func_180532_a(var2, this.objectMouseOver.field_178784_b);
|
| 1280 | this.thePlayer.swingItem();
|
| 1281 | }
|
| 1282 | } else {
|
| 1283 | this.playerController.resetBlockRemoving();
|
| 1284 | }
|
| 1285 | }
|
| 1286 | }
|
| 1287 |
|
| 1288 | private void clickMouse() {
|
| 1289 | if (this.leftClickCounter <= 0) {
|
| 1290 | this.thePlayer.swingItem();
|
| 1291 |
|
| 1292 | if (this.objectMouseOver == null) {
|
| 1293 | logger.error("Null returned as \'hitResult\', this shouldn\'t happen!");
|
| 1294 |
|
| 1295 | if (this.playerController.isNotCreative()) {
|
| 1296 | this.leftClickCounter = 10;
|
| 1297 | }
|
| 1298 | } else {
|
| 1299 | switch (Minecraft.SwitchEnumMinecartType.field_152390_a[this.objectMouseOver.typeOfHit.ordinal()]) {
|
| 1300 | case 1:
|
| 1301 | this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit);
|
| 1302 | break;
|
| 1303 |
|
| 1304 | case 2:
|
| 1305 | BlockPos var1 = this.objectMouseOver.func_178782_a();
|
| 1306 |
|
| 1307 | if (this.theWorld.getBlockState(var1).getBlock().getMaterial() != Material.air) {
|
| 1308 | this.playerController.func_180511_b(var1, this.objectMouseOver.field_178784_b);
|
| 1309 | break;
|
| 1310 | }
|
| 1311 |
|
| 1312 | case 3:
|
| 1313 | default:
|
| 1314 | if (this.playerController.isNotCreative()) {
|
| 1315 | this.leftClickCounter = 10;
|
| 1316 | }
|
| 1317 | }
|
| 1318 | }
|
| 1319 | }
|
| 1320 | }
|
| 1321 |
|
| 1322 | /**
|
| 1323 | * Called when user clicked he's mouse right button (place)
|
| 1324 | */
|
| 1325 | private void rightClickMouse() {
|
| 1326 | this.rightClickDelayTimer = 4;
|
| 1327 | boolean var1 = true;
|
| 1328 | ItemStack var2 = this.thePlayer.inventory.getCurrentItem();
|
| 1329 |
|
| 1330 | if (this.objectMouseOver == null) {
|
| 1331 | logger.warn("Null returned as \'hitResult\', this shouldn\'t happen!");
|
| 1332 | } else {
|
| 1333 | switch (Minecraft.SwitchEnumMinecartType.field_152390_a[this.objectMouseOver.typeOfHit.ordinal()]) {
|
| 1334 | case 1:
|
| 1335 | if (this.playerController.func_178894_a(this.thePlayer, this.objectMouseOver.entityHit, this.objectMouseOver)) {
|
| 1336 | var1 = false;
|
| 1337 | } else if (this.playerController.interactWithEntitySendPacket(this.thePlayer, this.objectMouseOver.entityHit)) {
|
| 1338 | var1 = false;
|
| 1339 | }
|
| 1340 |
|
| 1341 | break;
|
| 1342 |
|
| 1343 | case 2:
|
| 1344 | BlockPos var3 = this.objectMouseOver.func_178782_a();
|
| 1345 |
|
| 1346 | if (this.theWorld.getBlockState(var3).getBlock().getMaterial() != Material.air) {
|
| 1347 | int var4 = var2 != null ? var2.stackSize : 0;
|
| 1348 |
|
| 1349 | if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var2, var3, this.objectMouseOver.field_178784_b, this.objectMouseOver.hitVec)) {
|
| 1350 | var1 = false;
|
| 1351 | this.thePlayer.swingItem();
|
| 1352 | }
|
| 1353 |
|
| 1354 | if (var2 == null) {
|
| 1355 | return;
|
| 1356 | }
|
| 1357 |
|
| 1358 | if (var2.stackSize == 0) {
|
| 1359 | this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null;
|
| 1360 | } else if (var2.stackSize != var4 || this.playerController.isInCreativeMode()) {
|
| 1361 | this.entityRenderer.itemRenderer.resetEquippedProgress();
|
| 1362 | }
|
| 1363 | }
|
| 1364 | }
|
| 1365 | }
|
| 1366 |
|
| 1367 | if (var1) {
|
| 1368 | ItemStack var5 = this.thePlayer.inventory.getCurrentItem();
|
| 1369 |
|
| 1370 | if (var5 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var5)) {
|
| 1371 | this.entityRenderer.itemRenderer.resetEquippedProgress2();
|
| 1372 | }
|
| 1373 | }
|
| 1374 | }
|
| 1375 |
|
| 1376 | /**
|
| 1377 | * Toggles fullscreen mode.
|
| 1378 | */
|
| 1379 | public void toggleFullscreen() {
|
| 1380 | try {
|
| 1381 | this.fullscreen = !this.fullscreen;
|
| 1382 | this.gameSettings.fullScreen = this.fullscreen;
|
| 1383 |
|
| 1384 | if (this.fullscreen) {
|
| 1385 | this.updateDisplayMode();
|
| 1386 | this.displayWidth = Display.getDisplayMode().getWidth();
|
| 1387 | this.displayHeight = Display.getDisplayMode().getHeight();
|
| 1388 |
|
| 1389 | if (this.displayWidth <= 0) {
|
| 1390 | this.displayWidth = 1;
|
| 1391 | }
|
| 1392 |
|
| 1393 | if (this.displayHeight <= 0) {
|
| 1394 | this.displayHeight = 1;
|
| 1395 | }
|
| 1396 | } else {
|
| 1397 | Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight));
|
| 1398 | this.displayWidth = this.tempDisplayWidth;
|
| 1399 | this.displayHeight = this.tempDisplayHeight;
|
| 1400 |
|
| 1401 | if (this.displayWidth <= 0) {
|
| 1402 | this.displayWidth = 1;
|
| 1403 | }
|
| 1404 |
|
| 1405 | if (this.displayHeight <= 0) {
|
| 1406 | this.displayHeight = 1;
|
| 1407 | }
|
| 1408 | }
|
| 1409 |
|
| 1410 | if (this.currentScreen != null) {
|
| 1411 | this.resize(this.displayWidth, this.displayHeight);
|
| 1412 | } else {
|
| 1413 | this.updateFramebufferSize();
|
| 1414 | }
|
| 1415 |
|
| 1416 | Display.setFullscreen(this.fullscreen);
|
| 1417 | Display.setVSyncEnabled(this.gameSettings.enableVsync);
|
| 1418 | this.func_175601_h();
|
| 1419 | } catch (Exception var2) {
|
| 1420 | logger.error("Couldn\'t toggle fullscreen", var2);
|
| 1421 | }
|
| 1422 | }
|
| 1423 |
|
| 1424 | /**
|
| 1425 | * Called to resize the current screen.
|
| 1426 | */
|
| 1427 | private void resize(int width, int height) {
|
| 1428 | this.displayWidth = Math.max(1, width);
|
| 1429 | this.displayHeight = Math.max(1, height);
|
| 1430 |
|
| 1431 | if (this.currentScreen != null) {
|
| 1432 | ScaledResolution var3 = new ScaledResolution(this, width, height);
|
| 1433 | this.currentScreen.func_175273_b(this, var3.getScaledWidth(), var3.getScaledHeight());
|
| 1434 | }
|
| 1435 |
|
| 1436 | this.loadingScreen = new LoadingScreenRenderer(this);
|
| 1437 | this.updateFramebufferSize();
|
| 1438 | }
|
| 1439 |
|
| 1440 | private void updateFramebufferSize() {
|
| 1441 | this.framebufferMc.createBindFramebuffer(this.displayWidth, this.displayHeight);
|
| 1442 |
|
| 1443 | if (this.entityRenderer != null) {
|
| 1444 | this.entityRenderer.updateShaderGroupSize(this.displayWidth, this.displayHeight);
|
| 1445 | }
|
| 1446 | }
|
| 1447 |
|
| 1448 | /**
|
| 1449 | * Runs the current tick.
|
| 1450 | */
|
| 1451 | public void runTick() throws IOException {
|
| 1452 | if (this.rightClickDelayTimer > 0) {
|
| 1453 | --this.rightClickDelayTimer;
|
| 1454 | }
|
| 1455 |
|
| 1456 | this.mcProfiler.startSection("gui");
|
| 1457 |
|
| 1458 | if (!this.isGamePaused) {
|
| 1459 | this.ingameGUI.updateTick();
|
| 1460 | }
|
| 1461 |
|
| 1462 | this.mcProfiler.endSection();
|
| 1463 | this.entityRenderer.getMouseOver(1.0F);
|
| 1464 | this.mcProfiler.startSection("gameMode");
|
| 1465 |
|
| 1466 | if (!this.isGamePaused && this.theWorld != null) {
|
| 1467 | this.playerController.updateController();
|
| 1468 | }
|
| 1469 |
|
| 1470 | this.mcProfiler.endStartSection("textures");
|
| 1471 |
|
| 1472 | if (!this.isGamePaused) {
|
| 1473 | this.renderEngine.tick();
|
| 1474 | }
|
| 1475 |
|
| 1476 | if (this.currentScreen == null && this.thePlayer != null) {
|
| 1477 | if (this.thePlayer.getHealth() <= 0.0F) {
|
| 1478 | this.displayGuiScreen((GuiScreen) null);
|
| 1479 | } else if (this.thePlayer.isPlayerSleeping() && this.theWorld != null) {
|
| 1480 | this.displayGuiScreen(new GuiSleepMP());
|
| 1481 | }
|
| 1482 | } else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping()) {
|
| 1483 | this.displayGuiScreen((GuiScreen) null);
|
| 1484 | }
|
| 1485 |
|
| 1486 | if (this.currentScreen != null) {
|
| 1487 | this.leftClickCounter = 10000;
|
| 1488 | }
|
| 1489 |
|
| 1490 | CrashReport var2;
|
| 1491 | CrashReportCategory var3;
|
| 1492 |
|
| 1493 | if (this.currentScreen != null) {
|
| 1494 | try {
|
| 1495 | this.currentScreen.handleInput();
|
| 1496 | } catch (Throwable var7) {
|
| 1497 | var2 = CrashReport.makeCrashReport(var7, "Updating screen events");
|
| 1498 | var3 = var2.makeCategory("Affected screen");
|
| 1499 | var3.addCrashSectionCallable("Screen name", new Callable() {
|
| 1500 | private static final String __OBFID = "CL_00000640";
|
| 1501 |
|
| 1502 | public String call() {
|
| 1503 | return Minecraft.this.currentScreen.getClass().getCanonicalName();
|
| 1504 | }
|
| 1505 |
|
| 1506 | public Object call1() {
|
| 1507 | return this.call();
|
| 1508 | }
|
| 1509 | });
|
| 1510 | throw new ReportedException(var2);
|
| 1511 | }
|
| 1512 |
|
| 1513 | if (this.currentScreen != null) {
|
| 1514 | try {
|
| 1515 | this.currentScreen.updateScreen();
|
| 1516 | } catch (Throwable var6) {
|
| 1517 | var2 = CrashReport.makeCrashReport(var6, "Ticking screen");
|
| 1518 | var3 = var2.makeCategory("Affected screen");
|
| 1519 | var3.addCrashSectionCallable("Screen name", new Callable() {
|
| 1520 | private static final String __OBFID = "CL_00000642";
|
| 1521 |
|
| 1522 | public String call() {
|
| 1523 | return Minecraft.this.currentScreen.getClass().getCanonicalName();
|
| 1524 | }
|
| 1525 |
|
| 1526 | public Object call1() {
|
| 1527 | return this.call();
|
| 1528 | }
|
| 1529 | });
|
| 1530 | throw new ReportedException(var2);
|
| 1531 | }
|
| 1532 | }
|
| 1533 | }
|
| 1534 |
|
| 1535 | if (this.currentScreen == null || this.currentScreen.allowUserInput) {
|
| 1536 | this.mcProfiler.endStartSection("mouse");
|
| 1537 | int var1;
|
| 1538 |
|
| 1539 | while (Mouse.next()) {
|
| 1540 | var1 = Mouse.getEventButton();
|
| 1541 | KeyBinding.setKeyBindState(var1 - 100, Mouse.getEventButtonState());
|
| 1542 |
|
| 1543 | if (Mouse.getEventButtonState()) {
|
| 1544 | if (this.thePlayer.func_175149_v() && var1 == 2) {
|
| 1545 | this.ingameGUI.func_175187_g().func_175261_b();
|
| 1546 | } else {
|
| 1547 | KeyBinding.onTick(var1 - 100);
|
| 1548 | }
|
| 1549 | }
|
| 1550 |
|
| 1551 | long var10 = getSystemTime() - this.systemTime;
|
| 1552 |
|
| 1553 | if (var10 <= 200L) {
|
| 1554 | int var4 = Mouse.getEventDWheel();
|
| 1555 |
|
| 1556 | if (var4 != 0) {
|
| 1557 | if (this.thePlayer.func_175149_v()) {
|
| 1558 | var4 = var4 < 0 ? -1 : 1;
|
| 1559 |
|
| 1560 | if (this.ingameGUI.func_175187_g().func_175262_a()) {
|
| 1561 | this.ingameGUI.func_175187_g().func_175259_b(-var4);
|
| 1562 | } else {
|
| 1563 | float var5 = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float) var4 * 0.005F, 0.0F, 0.2F);
|
| 1564 | this.thePlayer.capabilities.setFlySpeed(var5);
|
| 1565 | }
|
| 1566 | } else {
|
| 1567 | this.thePlayer.inventory.changeCurrentItem(var4);
|
| 1568 | }
|
| 1569 | }
|
| 1570 |
|
| 1571 | if (this.currentScreen == null) {
|
| 1572 | if (!this.inGameHasFocus && Mouse.getEventButtonState()) {
|
| 1573 | this.setIngameFocus();
|
| 1574 | }
|
| 1575 | } else if (this.currentScreen != null) {
|
| 1576 | this.currentScreen.handleMouseInput();
|
| 1577 | }
|
| 1578 | }
|
| 1579 | }
|
| 1580 |
|
| 1581 | if (this.leftClickCounter > 0) {
|
| 1582 | --this.leftClickCounter;
|
| 1583 | }
|
| 1584 |
|
| 1585 | this.mcProfiler.endStartSection("keyboard");
|
| 1586 |
|
| 1587 | while (Keyboard.next()) {
|
| 1588 | var1 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
|
| 1589 | KeyBinding.setKeyBindState(var1, Keyboard.getEventKeyState());
|
| 1590 |
|
| 1591 | if (Keyboard.getEventKeyState()) {
|
| 1592 | Memeware.INSTANCE.handleKeyPress(var1);
|
| 1593 | KeyBinding.onTick(var1);
|
| 1594 | }
|
| 1595 |
|
| 1596 | if (this.debugCrashKeyPressTime > 0L) {
|
| 1597 | if (getSystemTime() - this.debugCrashKeyPressTime >= 6000L) {
|
| 1598 | throw new ReportedException(new CrashReport("Manually triggered debug crash", new Throwable()));
|
| 1599 | }
|
| 1600 |
|
| 1601 | if (!Keyboard.isKeyDown(46) || !Keyboard.isKeyDown(61)) {
|
| 1602 | this.debugCrashKeyPressTime = -1L;
|
| 1603 | }
|
| 1604 | } else if (Keyboard.isKeyDown(46) && Keyboard.isKeyDown(61)) {
|
| 1605 | this.debugCrashKeyPressTime = getSystemTime();
|
| 1606 | }
|
| 1607 |
|
| 1608 | this.dispatchKeypresses();
|
| 1609 |
|
| 1610 | if (Keyboard.getEventKeyState()) {
|
| 1611 | if (var1 == 62 && this.entityRenderer != null) {
|
| 1612 | this.entityRenderer.func_175071_c();
|
| 1613 | }
|
| 1614 |
|
| 1615 | if (this.currentScreen != null) {
|
| 1616 | this.currentScreen.handleKeyboardInput();
|
| 1617 | } else {
|
| 1618 | if (var1 == 1) {
|
| 1619 | this.displayInGameMenu();
|
| 1620 | }
|
| 1621 |
|
| 1622 | if (var1 == 32 && Keyboard.isKeyDown(61) && this.ingameGUI != null) {
|
| 1623 | this.ingameGUI.getChatGUI().clearChatMessages();
|
| 1624 | }
|
| 1625 |
|
| 1626 | if (var1 == 31 && Keyboard.isKeyDown(61)) {
|
| 1627 | this.refreshResources();
|
| 1628 | }
|
| 1629 |
|
| 1630 | if (var1 == 17 && Keyboard.isKeyDown(61)) {
|
| 1631 | ;
|
| 1632 | }
|
| 1633 |
|
| 1634 | if (var1 == 18 && Keyboard.isKeyDown(61)) {
|
| 1635 | ;
|
| 1636 | }
|
| 1637 |
|
| 1638 | if (var1 == 47 && Keyboard.isKeyDown(61)) {
|
| 1639 | ;
|
| 1640 | }
|
| 1641 |
|
| 1642 | if (var1 == 38 && Keyboard.isKeyDown(61)) {
|
| 1643 | ;
|
| 1644 | }
|
| 1645 |
|
| 1646 | if (var1 == 22 && Keyboard.isKeyDown(61)) {
|
| 1647 | ;
|
| 1648 | }
|
| 1649 |
|
| 1650 | if (var1 == 20 && Keyboard.isKeyDown(61)) {
|
| 1651 | this.refreshResources();
|
| 1652 | }
|
| 1653 |
|
| 1654 | if (var1 == 33 && Keyboard.isKeyDown(61)) {
|
| 1655 | boolean var11 = Keyboard.isKeyDown(42) | Keyboard.isKeyDown(54);
|
| 1656 | this.gameSettings.setOptionValue(GameSettings.Options.RENDER_DISTANCE, var11 ? -1 : 1);
|
| 1657 | }
|
| 1658 |
|
| 1659 | if (var1 == 30 && Keyboard.isKeyDown(61)) {
|
| 1660 | this.renderGlobal.loadRenderers();
|
| 1661 | }
|
| 1662 |
|
| 1663 | if (var1 == 35 && Keyboard.isKeyDown(61)) {
|
| 1664 | this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips;
|
| 1665 | this.gameSettings.saveOptions();
|
| 1666 | }
|
| 1667 |
|
| 1668 | if (var1 == 48 && Keyboard.isKeyDown(61)) {
|
| 1669 | this.renderManager.func_178629_b(!this.renderManager.func_178634_b());
|
| 1670 | }
|
| 1671 |
|
| 1672 | if (var1 == 25 && Keyboard.isKeyDown(61)) {
|
| 1673 | this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus;
|
| 1674 | this.gameSettings.saveOptions();
|
| 1675 | }
|
| 1676 |
|
| 1677 | if (var1 == 59) {
|
| 1678 | this.gameSettings.hideGUI = !this.gameSettings.hideGUI;
|
| 1679 | }
|
| 1680 |
|
| 1681 | if (var1 == 61) {
|
| 1682 | this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo;
|
| 1683 | this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown();
|
| 1684 | }
|
| 1685 |
|
| 1686 | if (this.gameSettings.keyBindTogglePerspective.isPressed()) {
|
| 1687 | ++this.gameSettings.thirdPersonView;
|
| 1688 |
|
| 1689 | if (this.gameSettings.thirdPersonView > 2) {
|
| 1690 | this.gameSettings.thirdPersonView = 0;
|
| 1691 | }
|
| 1692 |
|
| 1693 | if (this.gameSettings.thirdPersonView == 0) {
|
| 1694 | this.entityRenderer.func_175066_a(this.func_175606_aa());
|
| 1695 | } else if (this.gameSettings.thirdPersonView == 1) {
|
| 1696 | this.entityRenderer.func_175066_a((Entity) null);
|
| 1697 | }
|
| 1698 | }
|
| 1699 |
|
| 1700 | if (this.gameSettings.keyBindSmoothCamera.isPressed()) {
|
| 1701 | this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera;
|
| 1702 | }
|
| 1703 | }
|
| 1704 |
|
| 1705 | if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) {
|
| 1706 | if (var1 == 11) {
|
| 1707 | this.updateDebugProfilerName(0);
|
| 1708 | }
|
| 1709 |
|
| 1710 | for (int var12 = 0; var12 < 9; ++var12) {
|
| 1711 | if (var1 == 2 + var12) {
|
| 1712 | this.updateDebugProfilerName(var12 + 1);
|
| 1713 | }
|
| 1714 | }
|
| 1715 | }
|
| 1716 | }
|
| 1717 | }
|
| 1718 |
|
| 1719 | for (var1 = 0; var1 < 9; ++var1) {
|
| 1720 | if (this.gameSettings.keyBindsHotbar[var1].isPressed()) {
|
| 1721 | if (this.thePlayer.func_175149_v()) {
|
| 1722 | this.ingameGUI.func_175187_g().func_175260_a(var1);
|
| 1723 | } else {
|
| 1724 | this.thePlayer.inventory.currentItem = var1;
|
| 1725 | }
|
| 1726 | }
|
| 1727 | }
|
| 1728 |
|
| 1729 | boolean var9 = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN;
|
| 1730 |
|
| 1731 | while (this.gameSettings.keyBindInventory.isPressed()) {
|
| 1732 | if (this.playerController.isRidingHorse()) {
|
| 1733 | this.thePlayer.func_175163_u();
|
| 1734 | } else {
|
| 1735 | this.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
|
| 1736 | this.displayGuiScreen(new GuiInventory(this.thePlayer));
|
| 1737 | }
|
| 1738 | }
|
| 1739 |
|
| 1740 | while (this.gameSettings.keyBindDrop.isPressed()) {
|
| 1741 | if (!this.thePlayer.func_175149_v()) {
|
| 1742 | this.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown());
|
| 1743 | }
|
| 1744 | }
|
| 1745 |
|
| 1746 | while (this.gameSettings.keyBindChat.isPressed() && var9) {
|
| 1747 | this.displayGuiScreen(new GuiChat());
|
| 1748 | }
|
| 1749 |
|
| 1750 | if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed() && var9) {
|
| 1751 | this.displayGuiScreen(new GuiChat("/"));
|
| 1752 | }
|
| 1753 |
|
| 1754 | if (this.thePlayer.isUsingItem()) {
|
| 1755 | if (!this.gameSettings.keyBindUseItem.getIsKeyPressed()) {
|
| 1756 | this.playerController.onStoppedUsingItem(this.thePlayer);
|
| 1757 | }
|
| 1758 |
|
| 1759 | label435:
|
| 1760 |
|
| 1761 | while (true) {
|
| 1762 | if (!this.gameSettings.keyBindAttack.isPressed()) {
|
| 1763 | while (this.gameSettings.keyBindUseItem.isPressed()) {
|
| 1764 | ;
|
| 1765 | }
|
| 1766 |
|
| 1767 | while (true) {
|
| 1768 | if (this.gameSettings.keyBindPickBlock.isPressed()) {
|
| 1769 | continue;
|
| 1770 | }
|
| 1771 |
|
| 1772 | break label435;
|
| 1773 | }
|
| 1774 | }
|
| 1775 | }
|
| 1776 | } else {
|
| 1777 | while (this.gameSettings.keyBindAttack.isPressed()) {
|
| 1778 | this.clickMouse();
|
| 1779 | }
|
| 1780 |
|
| 1781 | while (this.gameSettings.keyBindUseItem.isPressed()) {
|
| 1782 | this.rightClickMouse();
|
| 1783 | }
|
| 1784 |
|
| 1785 | while (this.gameSettings.keyBindPickBlock.isPressed()) {
|
| 1786 | this.middleClickMouse();
|
| 1787 | }
|
| 1788 | }
|
| 1789 |
|
| 1790 | if (this.gameSettings.keyBindUseItem.getIsKeyPressed() && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem()) {
|
| 1791 | this.rightClickMouse();
|
| 1792 | }
|
| 1793 |
|
| 1794 | this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.getIsKeyPressed() && this.inGameHasFocus);
|
| 1795 | }
|
| 1796 |
|
| 1797 | if (this.theWorld != null) {
|
| 1798 | if (this.thePlayer != null) {
|
| 1799 | ++this.joinPlayerCounter;
|
| 1800 |
|
| 1801 | if (this.joinPlayerCounter == 30) {
|
| 1802 | this.joinPlayerCounter = 0;
|
| 1803 | this.theWorld.joinEntityInSurroundings(this.thePlayer);
|
| 1804 | }
|
| 1805 | }
|
| 1806 |
|
| 1807 | this.mcProfiler.endStartSection("gameRenderer");
|
| 1808 |
|
| 1809 | if (!this.isGamePaused) {
|
| 1810 | this.entityRenderer.updateRenderer();
|
| 1811 | }
|
| 1812 |
|
| 1813 | this.mcProfiler.endStartSection("levelRenderer");
|
| 1814 |
|
| 1815 | if (!this.isGamePaused) {
|
| 1816 | this.renderGlobal.updateClouds();
|
| 1817 | }
|
| 1818 |
|
| 1819 | this.mcProfiler.endStartSection("level");
|
| 1820 |
|
| 1821 | if (!this.isGamePaused) {
|
| 1822 | if (this.theWorld.func_175658_ac() > 0) {
|
| 1823 | this.theWorld.setLastLightningBolt(this.theWorld.func_175658_ac() - 1);
|
| 1824 | }
|
| 1825 |
|
| 1826 | this.theWorld.updateEntities();
|
| 1827 | }
|
| 1828 | }
|
| 1829 |
|
| 1830 | if (!this.isGamePaused) {
|
| 1831 | this.mcMusicTicker.update();
|
| 1832 | this.mcSoundHandler.update();
|
| 1833 | }
|
| 1834 |
|
| 1835 | if (this.theWorld != null) {
|
| 1836 | if (!this.isGamePaused) {
|
| 1837 | this.theWorld.setAllowedSpawnTypes(this.theWorld.getDifficulty() != EnumDifficulty.PEACEFUL, true);
|
| 1838 |
|
| 1839 | try {
|
| 1840 | this.theWorld.tick();
|
| 1841 | } catch (Throwable var8) {
|
| 1842 | var2 = CrashReport.makeCrashReport(var8, "Exception in world tick");
|
| 1843 |
|
| 1844 | if (this.theWorld == null) {
|
| 1845 | var3 = var2.makeCategory("Affected level");
|
| 1846 | var3.addCrashSection("Problem", "Level is null!");
|
| 1847 | } else {
|
| 1848 | this.theWorld.addWorldInfoToCrashReport(var2);
|
| 1849 | }
|
| 1850 |
|
| 1851 | throw new ReportedException(var2);
|
| 1852 | }
|
| 1853 | }
|
| 1854 |
|
| 1855 | this.mcProfiler.endStartSection("animateTick");
|
| 1856 |
|
| 1857 | if (!this.isGamePaused && this.theWorld != null) {
|
| 1858 | this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ));
|
| 1859 | }
|
| 1860 |
|
| 1861 | this.mcProfiler.endStartSection("particles");
|
| 1862 |
|
| 1863 | if (!this.isGamePaused) {
|
| 1864 | this.effectRenderer.updateEffects();
|
| 1865 | }
|
| 1866 | } else if (this.myNetworkManager != null) {
|
| 1867 | this.mcProfiler.endStartSection("pendingConnection");
|
| 1868 | this.myNetworkManager.processReceivedPackets();
|
| 1869 | }
|
| 1870 |
|
| 1871 | this.mcProfiler.endSection();
|
| 1872 | this.systemTime = getSystemTime();
|
| 1873 | }
|
| 1874 |
|
| 1875 | /**
|
| 1876 | * Arguments: World foldername, World ingame name, WorldSettings
|
| 1877 | */
|
| 1878 | public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) {
|
| 1879 | this.loadWorld((WorldClient) null);
|
| 1880 |
|
| 1881 | ISaveHandler var4 = this.saveLoader.getSaveLoader(folderName, false);
|
| 1882 | WorldInfo var5 = var4.loadWorldInfo();
|
| 1883 |
|
| 1884 | if (var5 == null && worldSettingsIn != null) {
|
| 1885 | var5 = new WorldInfo(worldSettingsIn, folderName);
|
| 1886 | var4.saveWorldInfo(var5);
|
| 1887 | }
|
| 1888 |
|
| 1889 | if (worldSettingsIn == null) {
|
| 1890 | worldSettingsIn = new WorldSettings(var5);
|
| 1891 | }
|
| 1892 |
|
| 1893 | try {
|
| 1894 | this.theIntegratedServer = new IntegratedServer(this, folderName, worldName, worldSettingsIn);
|
| 1895 | this.theIntegratedServer.startServerThread();
|
| 1896 | this.integratedServerIsRunning = true;
|
| 1897 | } catch (Throwable var10) {
|
| 1898 | CrashReport var7 = CrashReport.makeCrashReport(var10, "Starting integrated server");
|
| 1899 | CrashReportCategory var8 = var7.makeCategory("Starting integrated server");
|
| 1900 | var8.addCrashSection("Level ID", folderName);
|
| 1901 | var8.addCrashSection("Level Name", worldName);
|
| 1902 | throw new ReportedException(var7);
|
| 1903 | }
|
| 1904 |
|
| 1905 | this.loadingScreen.displaySavingString(I18n.format("menu.loadingLevel", new Object[0]));
|
| 1906 |
|
| 1907 | while (!this.theIntegratedServer.serverIsInRunLoop()) {
|
| 1908 | String var6 = this.theIntegratedServer.getUserMessage();
|
| 1909 |
|
| 1910 | if (var6 != null) {
|
| 1911 | this.loadingScreen.displayLoadingString(I18n.format(var6, new Object[0]));
|
| 1912 | } else {
|
| 1913 | this.loadingScreen.displayLoadingString("");
|
| 1914 | }
|
| 1915 |
|
| 1916 | try {
|
| 1917 | Thread.sleep(200L);
|
| 1918 | } catch (InterruptedException var9) {
|
| 1919 | ;
|
| 1920 | }
|
| 1921 | }
|
| 1922 |
|
| 1923 | this.displayGuiScreen((GuiScreen) null);
|
| 1924 | SocketAddress var11 = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint();
|
| 1925 | NetworkManager var12 = NetworkManager.provideLocalClient(var11);
|
| 1926 | var12.setNetHandler(new NetHandlerLoginClient(var12, this, (GuiScreen) null));
|
| 1927 | var12.sendPacket(new C00Handshake(47, var11.toString(), 0, EnumConnectionState.LOGIN));
|
| 1928 | var12.sendPacket(new C00PacketLoginStart(this.getSession().getProfile()));
|
| 1929 | this.myNetworkManager = var12;
|
| 1930 | }
|
| 1931 |
|
| 1932 | /**
|
| 1933 | * unloads the current world first
|
| 1934 | */
|
| 1935 | public void loadWorld(WorldClient worldClientIn) {
|
| 1936 | this.loadWorld(worldClientIn, "");
|
| 1937 | }
|
| 1938 |
|
| 1939 | /**
|
| 1940 | * par2Str is displayed on the loading screen to the user unloads the current world first
|
| 1941 | */
|
| 1942 | public void loadWorld(WorldClient worldClientIn, String loadingMessage) {
|
| 1943 | if (worldClientIn == null) {
|
| 1944 | NetHandlerPlayClient var3 = this.getNetHandler();
|
| 1945 |
|
| 1946 | if (var3 != null) {
|
| 1947 | var3.cleanup();
|
| 1948 | }
|
| 1949 |
|
| 1950 | if (this.theIntegratedServer != null && this.theIntegratedServer.func_175578_N()) {
|
| 1951 | this.theIntegratedServer.initiateShutdown();
|
| 1952 | this.theIntegratedServer.func_175592_a();
|
| 1953 | }
|
| 1954 |
|
| 1955 | this.theIntegratedServer = null;
|
| 1956 | this.guiAchievement.clearAchievements();
|
| 1957 | this.entityRenderer.getMapItemRenderer().func_148249_a();
|
| 1958 | }
|
| 1959 |
|
| 1960 | this.field_175622_Z = null;
|
| 1961 | this.myNetworkManager = null;
|
| 1962 |
|
| 1963 | if (this.loadingScreen != null) {
|
| 1964 | this.loadingScreen.resetProgressAndMessage(loadingMessage);
|
| 1965 | this.loadingScreen.displayLoadingString("");
|
| 1966 | }
|
| 1967 |
|
| 1968 | if (worldClientIn == null && this.theWorld != null) {
|
| 1969 | if (this.mcResourcePackRepository.getResourcePackInstance() != null) {
|
| 1970 | this.mcResourcePackRepository.func_148529_f();
|
| 1971 | this.func_175603_A();
|
| 1972 | }
|
| 1973 |
|
| 1974 | this.setServerData((ServerData) null);
|
| 1975 | this.integratedServerIsRunning = false;
|
| 1976 | }
|
| 1977 |
|
| 1978 | this.mcSoundHandler.stopSounds();
|
| 1979 | this.theWorld = worldClientIn;
|
| 1980 |
|
| 1981 | if (worldClientIn != null) {
|
| 1982 | if (this.renderGlobal != null) {
|
| 1983 | this.renderGlobal.setWorldAndLoadRenderers(worldClientIn);
|
| 1984 | }
|
| 1985 |
|
| 1986 | if (this.effectRenderer != null) {
|
| 1987 | this.effectRenderer.clearEffects(worldClientIn);
|
| 1988 | }
|
| 1989 |
|
| 1990 | if (this.thePlayer == null) {
|
| 1991 | this.thePlayer = this.playerController.func_178892_a(worldClientIn, new StatFileWriter());
|
| 1992 | this.playerController.flipPlayer(this.thePlayer);
|
| 1993 | }
|
| 1994 |
|
| 1995 | this.thePlayer.preparePlayerToSpawn();
|
| 1996 | worldClientIn.spawnEntityInWorld(this.thePlayer);
|
| 1997 | this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
|
| 1998 | this.playerController.setPlayerCapabilities(this.thePlayer);
|
| 1999 | this.field_175622_Z = this.thePlayer;
|
| 2000 | } else {
|
| 2001 | this.saveLoader.flushCache();
|
| 2002 | this.thePlayer = null;
|
| 2003 | }
|
| 2004 |
|
| 2005 |
|
| 2006 | this.systemTime = 0L;
|
| 2007 | }
|
| 2008 |
|
| 2009 | public void setDimensionAndSpawnPlayer(int dimension) {
|
| 2010 | this.theWorld.setInitialSpawnLocation();
|
| 2011 | this.theWorld.removeAllEntities();
|
| 2012 | int var2 = 0;
|
| 2013 | String var3 = null;
|
| 2014 |
|
| 2015 | if (this.thePlayer != null) {
|
| 2016 | var2 = this.thePlayer.getEntityId();
|
| 2017 | this.theWorld.removeEntity(this.thePlayer);
|
| 2018 | var3 = this.thePlayer.getClientBrand();
|
| 2019 | }
|
| 2020 |
|
| 2021 | this.field_175622_Z = null;
|
| 2022 | EntityPlayerSP var4 = this.thePlayer;
|
| 2023 | this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter());
|
| 2024 | this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(var4.getDataWatcher().getAllWatched());
|
| 2025 | this.thePlayer.dimension = dimension;
|
| 2026 | this.field_175622_Z = this.thePlayer;
|
| 2027 | this.thePlayer.preparePlayerToSpawn();
|
| 2028 | this.thePlayer.func_175158_f(var3);
|
| 2029 | this.theWorld.spawnEntityInWorld(this.thePlayer);
|
| 2030 | this.playerController.flipPlayer(this.thePlayer);
|
| 2031 | this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings);
|
| 2032 | this.thePlayer.setEntityId(var2);
|
| 2033 | this.playerController.setPlayerCapabilities(this.thePlayer);
|
| 2034 | this.thePlayer.func_175150_k(var4.func_175140_cp());
|
| 2035 |
|
| 2036 | if (this.currentScreen instanceof GuiGameOver) {
|
| 2037 | this.displayGuiScreen((GuiScreen) null);
|
| 2038 | }
|
| 2039 | }
|
| 2040 |
|
| 2041 | /**
|
| 2042 | * Gets whether this is a demo or not.
|
| 2043 | */
|
| 2044 | public final boolean isDemo() {
|
| 2045 | return this.isDemo;
|
| 2046 | }
|
| 2047 |
|
| 2048 | public NetHandlerPlayClient getNetHandler() {
|
| 2049 | return this.thePlayer != null ? this.thePlayer.sendQueue : null;
|
| 2050 | }
|
| 2051 |
|
| 2052 | public static boolean isGuiEnabled() {
|
| 2053 | return theMinecraft == null || !theMinecraft.gameSettings.hideGUI;
|
| 2054 | }
|
| 2055 |
|
| 2056 | public static boolean isFancyGraphicsEnabled() {
|
| 2057 | return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics;
|
| 2058 | }
|
| 2059 |
|
| 2060 | /**
|
| 2061 | * Returns if ambient occlusion is enabled
|
| 2062 | */
|
| 2063 | public static boolean isAmbientOcclusionEnabled() {
|
| 2064 | return theMinecraft != null && theMinecraft.gameSettings.ambientOcclusion != 0;
|
| 2065 | }
|
| 2066 |
|
| 2067 | /**
|
| 2068 | * Called when user clicked he's mouse middle button (pick block)
|
| 2069 | */
|
| 2070 | private void middleClickMouse() {
|
| 2071 | if (this.objectMouseOver != null) {
|
| 2072 | boolean var1 = this.thePlayer.capabilities.isCreativeMode;
|
| 2073 | int var3 = 0;
|
| 2074 | boolean var4 = false;
|
| 2075 | TileEntity var5 = null;
|
| 2076 | Object var2;
|
| 2077 |
|
| 2078 | if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
| 2079 | BlockPos var6 = this.objectMouseOver.func_178782_a();
|
| 2080 | Block var7 = this.theWorld.getBlockState(var6).getBlock();
|
| 2081 |
|
| 2082 | if (var7.getMaterial() == Material.air) {
|
| 2083 | return;
|
| 2084 | }
|
| 2085 |
|
| 2086 | var2 = var7.getItem(this.theWorld, var6);
|
| 2087 |
|
| 2088 | if (var2 == null) {
|
| 2089 | return;
|
| 2090 | }
|
| 2091 |
|
| 2092 | if (var1 && GuiScreen.isCtrlKeyDown()) {
|
| 2093 | var5 = this.theWorld.getTileEntity(var6);
|
| 2094 | }
|
| 2095 |
|
| 2096 | Block var8 = var2 instanceof ItemBlock && !var7.isFlowerPot() ? Block.getBlockFromItem((Item) var2) : var7;
|
| 2097 | var3 = var8.getDamageValue(this.theWorld, var6);
|
| 2098 | var4 = ((Item) var2).getHasSubtypes();
|
| 2099 | } else {
|
| 2100 | if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !var1) {
|
| 2101 | return;
|
| 2102 | }
|
| 2103 |
|
| 2104 | if (this.objectMouseOver.entityHit instanceof EntityPainting) {
|
| 2105 | var2 = Items.painting;
|
| 2106 | } else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) {
|
| 2107 | var2 = Items.lead;
|
| 2108 | } else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) {
|
| 2109 | EntityItemFrame var11 = (EntityItemFrame) this.objectMouseOver.entityHit;
|
| 2110 | ItemStack var14 = var11.getDisplayedItem();
|
| 2111 |
|
| 2112 | if (var14 == null) {
|
| 2113 | var2 = Items.item_frame;
|
| 2114 | } else {
|
| 2115 | var2 = var14.getItem();
|
| 2116 | var3 = var14.getMetadata();
|
| 2117 | var4 = true;
|
| 2118 | }
|
| 2119 | } else if (this.objectMouseOver.entityHit instanceof EntityMinecart) {
|
| 2120 | EntityMinecart var12 = (EntityMinecart) this.objectMouseOver.entityHit;
|
| 2121 |
|
| 2122 | switch (Minecraft.SwitchEnumMinecartType.field_178901_b[var12.func_180456_s().ordinal()]) {
|
| 2123 | case 1:
|
| 2124 | var2 = Items.furnace_minecart;
|
| 2125 | break;
|
| 2126 |
|
| 2127 | case 2:
|
| 2128 | var2 = Items.chest_minecart;
|
| 2129 | break;
|
| 2130 |
|
| 2131 | case 3:
|
| 2132 | var2 = Items.tnt_minecart;
|
| 2133 | break;
|
| 2134 |
|
| 2135 | case 4:
|
| 2136 | var2 = Items.hopper_minecart;
|
| 2137 | break;
|
| 2138 |
|
| 2139 | case 5:
|
| 2140 | var2 = Items.command_block_minecart;
|
| 2141 | break;
|
| 2142 |
|
| 2143 | default:
|
| 2144 | var2 = Items.minecart;
|
| 2145 | }
|
| 2146 | } else if (this.objectMouseOver.entityHit instanceof EntityBoat) {
|
| 2147 | var2 = Items.boat;
|
| 2148 | } else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) {
|
| 2149 | var2 = Items.armor_stand;
|
| 2150 | } else {
|
| 2151 | var2 = Items.spawn_egg;
|
| 2152 | var3 = EntityList.getEntityID(this.objectMouseOver.entityHit);
|
| 2153 | var4 = true;
|
| 2154 |
|
| 2155 | if (!EntityList.entityEggs.containsKey(Integer.valueOf(var3))) {
|
| 2156 | return;
|
| 2157 | }
|
| 2158 | }
|
| 2159 | }
|
| 2160 |
|
| 2161 | InventoryPlayer var13 = this.thePlayer.inventory;
|
| 2162 |
|
| 2163 | if (var5 == null) {
|
| 2164 | var13.setCurrentItem((Item) var2, var3, var4, var1);
|
| 2165 | } else {
|
| 2166 | NBTTagCompound var15 = new NBTTagCompound();
|
| 2167 | var5.writeToNBT(var15);
|
| 2168 | ItemStack var17 = new ItemStack((Item) var2, 1, var3);
|
| 2169 | var17.setTagInfo("BlockEntityTag", var15);
|
| 2170 | NBTTagCompound var9 = new NBTTagCompound();
|
| 2171 | NBTTagList var10 = new NBTTagList();
|
| 2172 | var10.appendTag(new NBTTagString("(+NBT)"));
|
| 2173 | var9.setTag("Lore", var10);
|
| 2174 | var17.setTagInfo("display", var9);
|
| 2175 | var13.setInventorySlotContents(var13.currentItem, var17);
|
| 2176 | }
|
| 2177 |
|
| 2178 | if (var1) {
|
| 2179 | int var16 = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + var13.currentItem;
|
| 2180 | this.playerController.sendSlotPacket(var13.getStackInSlot(var13.currentItem), var16);
|
| 2181 | }
|
| 2182 | }
|
| 2183 | }
|
| 2184 |
|
| 2185 | /**
|
| 2186 | * adds core server Info (GL version , Texture pack, isModded, type), and the worldInfo to the crash report
|
| 2187 | */
|
| 2188 | public CrashReport addGraphicsAndWorldToCrashReport(CrashReport theCrash) {
|
| 2189 | theCrash.getCategory().addCrashSectionCallable("Launched Version", new Callable() {
|
| 2190 | private static final String __OBFID = "CL_00000643";
|
| 2191 |
|
| 2192 | public String call() {
|
| 2193 | return Minecraft.this.launchedVersion;
|
| 2194 | }
|
| 2195 |
|
| 2196 | public Object call1() {
|
| 2197 | return this.call();
|
| 2198 | }
|
| 2199 | });
|
| 2200 | theCrash.getCategory().addCrashSectionCallable("LWJGL", new Callable() {
|
| 2201 | private static final String __OBFID = "CL_00000644";
|
| 2202 |
|
| 2203 | public String call() {
|
| 2204 | return Sys.getVersion();
|
| 2205 | }
|
| 2206 |
|
| 2207 | public Object call1() {
|
| 2208 | return this.call();
|
| 2209 | }
|
| 2210 | });
|
| 2211 | theCrash.getCategory().addCrashSectionCallable("OpenGL", new Callable() {
|
| 2212 | private static final String __OBFID = "CL_00000645";
|
| 2213 |
|
| 2214 | public String call() {
|
| 2215 | return GL11.glGetString(GL11.GL_RENDERER) + " GL version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR);
|
| 2216 | }
|
| 2217 |
|
| 2218 | public Object call1() {
|
| 2219 | return this.call();
|
| 2220 | }
|
| 2221 | });
|
| 2222 | theCrash.getCategory().addCrashSectionCallable("GL Caps", new Callable() {
|
| 2223 | private static final String __OBFID = "CL_00000646";
|
| 2224 |
|
| 2225 | public String call() {
|
| 2226 | return OpenGlHelper.func_153172_c();
|
| 2227 | }
|
| 2228 |
|
| 2229 | public Object call1() {
|
| 2230 | return this.call();
|
| 2231 | }
|
| 2232 | });
|
| 2233 | theCrash.getCategory().addCrashSectionCallable("Using VBOs", new Callable() {
|
| 2234 | private static final String __OBFID = "CL_00000647";
|
| 2235 |
|
| 2236 | public String call() {
|
| 2237 | return Minecraft.this.gameSettings.field_178881_t ? "Yes" : "No";
|
| 2238 | }
|
| 2239 |
|
| 2240 | public Object call1() {
|
| 2241 | return this.call();
|
| 2242 | }
|
| 2243 | });
|
| 2244 | theCrash.getCategory().addCrashSectionCallable("Is Modded", new Callable() {
|
| 2245 | private static final String __OBFID = "CL_00000633";
|
| 2246 |
|
| 2247 | public String call() {
|
| 2248 | String var1 = ClientBrandRetriever.getClientModName();
|
| 2249 | 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.");
|
| 2250 | }
|
| 2251 |
|
| 2252 | public Object call1() {
|
| 2253 | return this.call();
|
| 2254 | }
|
| 2255 | });
|
| 2256 | theCrash.getCategory().addCrashSectionCallable("Type", new Callable() {
|
| 2257 | private static final String __OBFID = "CL_00000634";
|
| 2258 |
|
| 2259 | public String call() {
|
| 2260 | return "Client (map_client.txt)";
|
| 2261 | }
|
| 2262 |
|
| 2263 | public Object call1() {
|
| 2264 | return this.call();
|
| 2265 | }
|
| 2266 | });
|
| 2267 | theCrash.getCategory().addCrashSectionCallable("Resource Packs", new Callable() {
|
| 2268 | private static final String __OBFID = "CL_00000635";
|
| 2269 |
|
| 2270 | public String call() {
|
| 2271 | return Minecraft.this.gameSettings.resourcePacks.toString();
|
| 2272 | }
|
| 2273 |
|
| 2274 | public Object call1() {
|
| 2275 | return this.call();
|
| 2276 | }
|
| 2277 | });
|
| 2278 | theCrash.getCategory().addCrashSectionCallable("Current Language", new Callable() {
|
| 2279 | private static final String __OBFID = "CL_00000636";
|
| 2280 |
|
| 2281 | public String call() {
|
| 2282 | return Minecraft.this.mcLanguageManager.getCurrentLanguage().toString();
|
| 2283 | }
|
| 2284 |
|
| 2285 | public Object call1() {
|
| 2286 | return this.call();
|
| 2287 | }
|
| 2288 | });
|
| 2289 | theCrash.getCategory().addCrashSectionCallable("Profiler Position", new Callable() {
|
| 2290 | private static final String __OBFID = "CL_00000637";
|
| 2291 |
|
| 2292 | public String call1() {
|
| 2293 | return Minecraft.this.mcProfiler.profilingEnabled ? Minecraft.this.mcProfiler.getNameOfLastSection() : "N/A (disabled)";
|
| 2294 | }
|
| 2295 |
|
| 2296 | public Object call() {
|
| 2297 | return this.call1();
|
| 2298 | }
|
| 2299 | });
|
| 2300 |
|
| 2301 | if (this.theWorld != null) {
|
| 2302 | this.theWorld.addWorldInfoToCrashReport(theCrash);
|
| 2303 | }
|
| 2304 |
|
| 2305 | return theCrash;
|
| 2306 | }
|
| 2307 |
|
| 2308 | /**
|
| 2309 | * Return the singleton Minecraft instance for the game
|
| 2310 | */
|
| 2311 | public static Minecraft getMinecraft() {
|
| 2312 | return theMinecraft;
|
| 2313 | }
|
| 2314 |
|
| 2315 | public ListenableFuture func_175603_A() {
|
| 2316 | return this.addScheduledTask(new Runnable() {
|
| 2317 | private static final String __OBFID = "CL_00001853";
|
| 2318 |
|
| 2319 | public void run() {
|
| 2320 | Minecraft.this.refreshResources();
|
| 2321 | }
|
| 2322 | });
|
| 2323 | }
|
| 2324 |
|
| 2325 | public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) {
|
| 2326 | playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS));
|
| 2327 | playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync));
|
| 2328 | playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency()));
|
| 2329 | playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed");
|
| 2330 | playerSnooper.addClientStat("run_time", Long.valueOf((MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
|
| 2331 | String var2 = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big";
|
| 2332 | playerSnooper.addClientStat("endianness", var2);
|
| 2333 | playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size()));
|
| 2334 | int var3 = 0;
|
| 2335 | Iterator var4 = this.mcResourcePackRepository.getRepositoryEntries().iterator();
|
| 2336 |
|
| 2337 | while (var4.hasNext()) {
|
| 2338 | ResourcePackRepository.Entry var5 = (ResourcePackRepository.Entry) var4.next();
|
| 2339 | playerSnooper.addClientStat("resource_pack[" + var3++ + "]", var5.getResourcePackName());
|
| 2340 | }
|
| 2341 |
|
| 2342 | if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null) {
|
| 2343 | playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID());
|
| 2344 | }
|
| 2345 | }
|
| 2346 |
|
| 2347 | public void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper) {
|
| 2348 | playerSnooper.addStatToSnooper("opengl_version", GL11.glGetString(GL11.GL_VERSION));
|
| 2349 | playerSnooper.addStatToSnooper("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR));
|
| 2350 | playerSnooper.addStatToSnooper("client_brand", ClientBrandRetriever.getClientModName());
|
| 2351 | playerSnooper.addStatToSnooper("launched_version", this.launchedVersion);
|
| 2352 | ContextCapabilities var2 = GLContext.getCapabilities();
|
| 2353 | playerSnooper.addStatToSnooper("gl_caps[ARB_arrays_of_arrays]", Boolean.valueOf(var2.GL_ARB_arrays_of_arrays));
|
| 2354 | playerSnooper.addStatToSnooper("gl_caps[ARB_base_instance]", Boolean.valueOf(var2.GL_ARB_base_instance));
|
| 2355 | playerSnooper.addStatToSnooper("gl_caps[ARB_blend_func_extended]", Boolean.valueOf(var2.GL_ARB_blend_func_extended));
|
| 2356 | playerSnooper.addStatToSnooper("gl_caps[ARB_clear_buffer_object]", Boolean.valueOf(var2.GL_ARB_clear_buffer_object));
|
| 2357 | playerSnooper.addStatToSnooper("gl_caps[ARB_color_buffer_float]", Boolean.valueOf(var2.GL_ARB_color_buffer_float));
|
| 2358 | playerSnooper.addStatToSnooper("gl_caps[ARB_compatibility]", Boolean.valueOf(var2.GL_ARB_compatibility));
|
| 2359 | playerSnooper.addStatToSnooper("gl_caps[ARB_compressed_texture_pixel_storage]", Boolean.valueOf(var2.GL_ARB_compressed_texture_pixel_storage));
|
| 2360 | playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(var2.GL_ARB_compute_shader));
|
| 2361 | playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(var2.GL_ARB_copy_buffer));
|
| 2362 | playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(var2.GL_ARB_copy_image));
|
| 2363 | playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(var2.GL_ARB_depth_buffer_float));
|
| 2364 | playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(var2.GL_ARB_compute_shader));
|
| 2365 | playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(var2.GL_ARB_copy_buffer));
|
| 2366 | playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(var2.GL_ARB_copy_image));
|
| 2367 | playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(var2.GL_ARB_depth_buffer_float));
|
| 2368 | playerSnooper.addStatToSnooper("gl_caps[ARB_depth_clamp]", Boolean.valueOf(var2.GL_ARB_depth_clamp));
|
| 2369 | playerSnooper.addStatToSnooper("gl_caps[ARB_depth_texture]", Boolean.valueOf(var2.GL_ARB_depth_texture));
|
| 2370 | playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers]", Boolean.valueOf(var2.GL_ARB_draw_buffers));
|
| 2371 | playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers_blend]", Boolean.valueOf(var2.GL_ARB_draw_buffers_blend));
|
| 2372 | playerSnooper.addStatToSnooper("gl_caps[ARB_draw_elements_base_vertex]", Boolean.valueOf(var2.GL_ARB_draw_elements_base_vertex));
|
| 2373 | playerSnooper.addStatToSnooper("gl_caps[ARB_draw_indirect]", Boolean.valueOf(var2.GL_ARB_draw_indirect));
|
| 2374 | playerSnooper.addStatToSnooper("gl_caps[ARB_draw_instanced]", Boolean.valueOf(var2.GL_ARB_draw_instanced));
|
| 2375 | playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_attrib_location]", Boolean.valueOf(var2.GL_ARB_explicit_attrib_location));
|
| 2376 | playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_uniform_location]", Boolean.valueOf(var2.GL_ARB_explicit_uniform_location));
|
| 2377 | playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_layer_viewport]", Boolean.valueOf(var2.GL_ARB_fragment_layer_viewport));
|
| 2378 | playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program]", Boolean.valueOf(var2.GL_ARB_fragment_program));
|
| 2379 | playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_shader]", Boolean.valueOf(var2.GL_ARB_fragment_shader));
|
| 2380 | playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program_shadow]", Boolean.valueOf(var2.GL_ARB_fragment_program_shadow));
|
| 2381 | playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(var2.GL_ARB_framebuffer_object));
|
| 2382 | playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_sRGB]", Boolean.valueOf(var2.GL_ARB_framebuffer_sRGB));
|
| 2383 | playerSnooper.addStatToSnooper("gl_caps[ARB_geometry_shader4]", Boolean.valueOf(var2.GL_ARB_geometry_shader4));
|
| 2384 | playerSnooper.addStatToSnooper("gl_caps[ARB_gpu_shader5]", Boolean.valueOf(var2.GL_ARB_gpu_shader5));
|
| 2385 | playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_pixel]", Boolean.valueOf(var2.GL_ARB_half_float_pixel));
|
| 2386 | playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_vertex]", Boolean.valueOf(var2.GL_ARB_half_float_vertex));
|
| 2387 | playerSnooper.addStatToSnooper("gl_caps[ARB_instanced_arrays]", Boolean.valueOf(var2.GL_ARB_instanced_arrays));
|
| 2388 | playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_alignment]", Boolean.valueOf(var2.GL_ARB_map_buffer_alignment));
|
| 2389 | playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_range]", Boolean.valueOf(var2.GL_ARB_map_buffer_range));
|
| 2390 | playerSnooper.addStatToSnooper("gl_caps[ARB_multisample]", Boolean.valueOf(var2.GL_ARB_multisample));
|
| 2391 | playerSnooper.addStatToSnooper("gl_caps[ARB_multitexture]", Boolean.valueOf(var2.GL_ARB_multitexture));
|
| 2392 | playerSnooper.addStatToSnooper("gl_caps[ARB_occlusion_query2]", Boolean.valueOf(var2.GL_ARB_occlusion_query2));
|
| 2393 | playerSnooper.addStatToSnooper("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(var2.GL_ARB_pixel_buffer_object));
|
| 2394 | playerSnooper.addStatToSnooper("gl_caps[ARB_seamless_cube_map]", Boolean.valueOf(var2.GL_ARB_seamless_cube_map));
|
| 2395 | playerSnooper.addStatToSnooper("gl_caps[ARB_shader_objects]", Boolean.valueOf(var2.GL_ARB_shader_objects));
|
| 2396 | playerSnooper.addStatToSnooper("gl_caps[ARB_shader_stencil_export]", Boolean.valueOf(var2.GL_ARB_shader_stencil_export));
|
| 2397 | playerSnooper.addStatToSnooper("gl_caps[ARB_shader_texture_lod]", Boolean.valueOf(var2.GL_ARB_shader_texture_lod));
|
| 2398 | playerSnooper.addStatToSnooper("gl_caps[ARB_shadow]", Boolean.valueOf(var2.GL_ARB_shadow));
|
| 2399 | playerSnooper.addStatToSnooper("gl_caps[ARB_shadow_ambient]", Boolean.valueOf(var2.GL_ARB_shadow_ambient));
|
| 2400 | playerSnooper.addStatToSnooper("gl_caps[ARB_stencil_texturing]", Boolean.valueOf(var2.GL_ARB_stencil_texturing));
|
| 2401 | playerSnooper.addStatToSnooper("gl_caps[ARB_sync]", Boolean.valueOf(var2.GL_ARB_sync));
|
| 2402 | playerSnooper.addStatToSnooper("gl_caps[ARB_tessellation_shader]", Boolean.valueOf(var2.GL_ARB_tessellation_shader));
|
| 2403 | playerSnooper.addStatToSnooper("gl_caps[ARB_texture_border_clamp]", Boolean.valueOf(var2.GL_ARB_texture_border_clamp));
|
| 2404 | playerSnooper.addStatToSnooper("gl_caps[ARB_texture_buffer_object]", Boolean.valueOf(var2.GL_ARB_texture_buffer_object));
|
| 2405 | playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(var2.GL_ARB_texture_cube_map));
|
| 2406 | playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map_array]", Boolean.valueOf(var2.GL_ARB_texture_cube_map_array));
|
| 2407 | playerSnooper.addStatToSnooper("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(var2.GL_ARB_texture_non_power_of_two));
|
| 2408 | playerSnooper.addStatToSnooper("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(var2.GL_ARB_uniform_buffer_object));
|
| 2409 | playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_blend]", Boolean.valueOf(var2.GL_ARB_vertex_blend));
|
| 2410 | playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(var2.GL_ARB_vertex_buffer_object));
|
| 2411 | playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_program]", Boolean.valueOf(var2.GL_ARB_vertex_program));
|
| 2412 | playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_shader]", Boolean.valueOf(var2.GL_ARB_vertex_shader));
|
| 2413 | playerSnooper.addStatToSnooper("gl_caps[EXT_bindable_uniform]", Boolean.valueOf(var2.GL_EXT_bindable_uniform));
|
| 2414 | playerSnooper.addStatToSnooper("gl_caps[EXT_blend_equation_separate]", Boolean.valueOf(var2.GL_EXT_blend_equation_separate));
|
| 2415 | playerSnooper.addStatToSnooper("gl_caps[EXT_blend_func_separate]", Boolean.valueOf(var2.GL_EXT_blend_func_separate));
|
| 2416 | playerSnooper.addStatToSnooper("gl_caps[EXT_blend_minmax]", Boolean.valueOf(var2.GL_EXT_blend_minmax));
|
| 2417 | playerSnooper.addStatToSnooper("gl_caps[EXT_blend_subtract]", Boolean.valueOf(var2.GL_EXT_blend_subtract));
|
| 2418 | playerSnooper.addStatToSnooper("gl_caps[EXT_draw_instanced]", Boolean.valueOf(var2.GL_EXT_draw_instanced));
|
| 2419 | playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_multisample]", Boolean.valueOf(var2.GL_EXT_framebuffer_multisample));
|
| 2420 | playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_object]", Boolean.valueOf(var2.GL_EXT_framebuffer_object));
|
| 2421 | playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_sRGB]", Boolean.valueOf(var2.GL_EXT_framebuffer_sRGB));
|
| 2422 | playerSnooper.addStatToSnooper("gl_caps[EXT_geometry_shader4]", Boolean.valueOf(var2.GL_EXT_geometry_shader4));
|
| 2423 | playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_program_parameters]", Boolean.valueOf(var2.GL_EXT_gpu_program_parameters));
|
| 2424 | playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_shader4]", Boolean.valueOf(var2.GL_EXT_gpu_shader4));
|
| 2425 | playerSnooper.addStatToSnooper("gl_caps[EXT_multi_draw_arrays]", Boolean.valueOf(var2.GL_EXT_multi_draw_arrays));
|
| 2426 | playerSnooper.addStatToSnooper("gl_caps[EXT_packed_depth_stencil]", Boolean.valueOf(var2.GL_EXT_packed_depth_stencil));
|
| 2427 | playerSnooper.addStatToSnooper("gl_caps[EXT_paletted_texture]", Boolean.valueOf(var2.GL_EXT_paletted_texture));
|
| 2428 | playerSnooper.addStatToSnooper("gl_caps[EXT_rescale_normal]", Boolean.valueOf(var2.GL_EXT_rescale_normal));
|
| 2429 | playerSnooper.addStatToSnooper("gl_caps[EXT_separate_shader_objects]", Boolean.valueOf(var2.GL_EXT_separate_shader_objects));
|
| 2430 | playerSnooper.addStatToSnooper("gl_caps[EXT_shader_image_load_store]", Boolean.valueOf(var2.GL_EXT_shader_image_load_store));
|
| 2431 | playerSnooper.addStatToSnooper("gl_caps[EXT_shadow_funcs]", Boolean.valueOf(var2.GL_EXT_shadow_funcs));
|
| 2432 | playerSnooper.addStatToSnooper("gl_caps[EXT_shared_texture_palette]", Boolean.valueOf(var2.GL_EXT_shared_texture_palette));
|
| 2433 | playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_clear_tag]", Boolean.valueOf(var2.GL_EXT_stencil_clear_tag));
|
| 2434 | playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_two_side]", Boolean.valueOf(var2.GL_EXT_stencil_two_side));
|
| 2435 | playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_wrap]", Boolean.valueOf(var2.GL_EXT_stencil_wrap));
|
| 2436 | playerSnooper.addStatToSnooper("gl_caps[EXT_texture_3d]", Boolean.valueOf(var2.GL_EXT_texture_3d));
|
| 2437 | playerSnooper.addStatToSnooper("gl_caps[EXT_texture_array]", Boolean.valueOf(var2.GL_EXT_texture_array));
|
| 2438 | playerSnooper.addStatToSnooper("gl_caps[EXT_texture_buffer_object]", Boolean.valueOf(var2.GL_EXT_texture_buffer_object));
|
| 2439 | playerSnooper.addStatToSnooper("gl_caps[EXT_texture_integer]", Boolean.valueOf(var2.GL_EXT_texture_integer));
|
| 2440 | playerSnooper.addStatToSnooper("gl_caps[EXT_texture_lod_bias]", Boolean.valueOf(var2.GL_EXT_texture_lod_bias));
|
| 2441 | playerSnooper.addStatToSnooper("gl_caps[EXT_texture_sRGB]", Boolean.valueOf(var2.GL_EXT_texture_sRGB));
|
| 2442 | playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_shader]", Boolean.valueOf(var2.GL_EXT_vertex_shader));
|
| 2443 | playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_weighting]", Boolean.valueOf(var2.GL_EXT_vertex_weighting));
|
| 2444 | playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS)));
|
| 2445 | GL11.glGetError();
|
| 2446 | playerSnooper.addStatToSnooper("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS)));
|
| 2447 | GL11.glGetError();
|
| 2448 | playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_attribs]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_ATTRIBS)));
|
| 2449 | GL11.glGetError();
|
| 2450 | playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)));
|
| 2451 | GL11.glGetError();
|
| 2452 | playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)));
|
| 2453 | GL11.glGetError();
|
| 2454 | playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(35071)));
|
| 2455 | GL11.glGetError();
|
| 2456 | playerSnooper.addStatToSnooper("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize()));
|
| 2457 | }
|
| 2458 |
|
| 2459 | /**
|
| 2460 | * Used in the usage snooper.
|
| 2461 | */
|
| 2462 | public static int getGLMaximumTextureSize() {
|
| 2463 | for (int var0 = 16384; var0 > 0; var0 >>= 1) {
|
| 2464 | GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, var0, var0, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
|
| 2465 | int var1 = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
| 2466 |
|
| 2467 | if (var1 != 0) {
|
| 2468 | return var0;
|
| 2469 | }
|
| 2470 | }
|
| 2471 |
|
| 2472 | return -1;
|
| 2473 | }
|
| 2474 |
|
| 2475 | /**
|
| 2476 | * Returns whether snooping is enabled or not.
|
| 2477 | */
|
| 2478 | public boolean isSnooperEnabled() {
|
| 2479 | return this.gameSettings.snooperEnabled;
|
| 2480 | }
|
| 2481 |
|
| 2482 | /**
|
| 2483 | * Set the current ServerData instance.
|
| 2484 | */
|
| 2485 | public void setServerData(ServerData serverDataIn) {
|
| 2486 | this.currentServerData = serverDataIn;
|
| 2487 | }
|
| 2488 |
|
| 2489 | public ServerData getCurrentServerData() {
|
| 2490 | return this.currentServerData;
|
| 2491 | }
|
| 2492 |
|
| 2493 | public boolean isIntegratedServerRunning() {
|
| 2494 | return this.integratedServerIsRunning;
|
| 2495 | }
|
| 2496 |
|
| 2497 | /**
|
| 2498 | * Returns true if there is only one player playing, and the current server is the integrated one.
|
| 2499 | */
|
| 2500 | public boolean isSingleplayer() {
|
| 2501 | return this.integratedServerIsRunning && this.theIntegratedServer != null;
|
| 2502 | }
|
| 2503 |
|
| 2504 | /**
|
| 2505 | * Returns the currently running integrated server
|
| 2506 | */
|
| 2507 | public IntegratedServer getIntegratedServer() {
|
| 2508 | return this.theIntegratedServer;
|
| 2509 | }
|
| 2510 |
|
| 2511 | public static void stopIntegratedServer() {
|
| 2512 | if (theMinecraft != null) {
|
| 2513 | IntegratedServer var0 = theMinecraft.getIntegratedServer();
|
| 2514 |
|
| 2515 | if (var0 != null) {
|
| 2516 | var0.stopServer();
|
| 2517 | }
|
| 2518 | }
|
| 2519 | }
|
| 2520 |
|
| 2521 | /**
|
| 2522 | * Returns the PlayerUsageSnooper instance.
|
| 2523 | */
|
| 2524 | public PlayerUsageSnooper getPlayerUsageSnooper() {
|
| 2525 | return this.usageSnooper;
|
| 2526 | }
|
| 2527 |
|
| 2528 | /**
|
| 2529 | * Gets the system time in milliseconds.
|
| 2530 | */
|
| 2531 | public static long getSystemTime() {
|
| 2532 | return Sys.getTime() * 1000L / Sys.getTimerResolution();
|
| 2533 | }
|
| 2534 |
|
| 2535 | /**
|
| 2536 | * Returns whether we're in full screen or not.
|
| 2537 | */
|
| 2538 | public boolean isFullScreen() {
|
| 2539 | return this.fullscreen;
|
| 2540 | }
|
| 2541 |
|
| 2542 | public Session getSession() {
|
| 2543 | return this.session;
|
| 2544 | }
|
| 2545 |
|
| 2546 | public PropertyMap func_180509_L() {
|
| 2547 | return this.twitchDetails;
|
| 2548 | }
|
| 2549 |
|
| 2550 | public Proxy getProxy() {
|
| 2551 | return this.proxy;
|
| 2552 | }
|
| 2553 |
|
| 2554 | public TextureManager getTextureManager() {
|
| 2555 | return this.renderEngine;
|
| 2556 | }
|
| 2557 |
|
| 2558 | public IResourceManager getResourceManager() {
|
| 2559 | return this.mcResourceManager;
|
| 2560 | }
|
| 2561 |
|
| 2562 | public ResourcePackRepository getResourcePackRepository() {
|
| 2563 | return this.mcResourcePackRepository;
|
| 2564 | }
|
| 2565 |
|
| 2566 | public LanguageManager getLanguageManager() {
|
| 2567 | return this.mcLanguageManager;
|
| 2568 | }
|
| 2569 |
|
| 2570 | public TextureMap getTextureMapBlocks() {
|
| 2571 | return this.textureMapBlocks;
|
| 2572 | }
|
| 2573 |
|
| 2574 | public boolean isJava64bit() {
|
| 2575 | return this.jvm64bit;
|
| 2576 | }
|
| 2577 |
|
| 2578 | public boolean isGamePaused() {
|
| 2579 | return this.isGamePaused;
|
| 2580 | }
|
| 2581 |
|
| 2582 | public SoundHandler getSoundHandler() {
|
| 2583 | return this.mcSoundHandler;
|
| 2584 | }
|
| 2585 |
|
| 2586 | public MusicTicker.MusicType getAmbientMusicType() {
|
| 2587 | 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);
|
| 2588 | }
|
| 2589 |
|
| 2590 | public IStream getTwitchStream() {
|
| 2591 | return this.stream;
|
| 2592 | }
|
| 2593 |
|
| 2594 | public void dispatchKeypresses() {
|
| 2595 | int var1 = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey();
|
| 2596 |
|
| 2597 | if (var1 != 0 && !Keyboard.isRepeatEvent()) {
|
| 2598 | if (!(this.currentScreen instanceof GuiControls) || ((GuiControls) this.currentScreen).time <= getSystemTime() - 20L) {
|
| 2599 | if (Keyboard.getEventKeyState()) {
|
| 2600 | if (var1 == this.gameSettings.keyBindStreamStartStop.getKeyCode()) {
|
| 2601 | if (this.getTwitchStream().func_152934_n()) {
|
| 2602 | this.getTwitchStream().func_152914_u();
|
| 2603 | } else if (this.getTwitchStream().func_152924_m()) {
|
| 2604 | this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() {
|
| 2605 | private static final String __OBFID = "CL_00001852";
|
| 2606 |
|
| 2607 | public void confirmClicked(boolean result, int id) {
|
| 2608 | if (result) {
|
| 2609 | Minecraft.this.getTwitchStream().func_152930_t();
|
| 2610 | }
|
| 2611 |
|
| 2612 | Minecraft.this.displayGuiScreen((GuiScreen) null);
|
| 2613 | }
|
| 2614 | }, I18n.format("stream.confirm_start", new Object[0]), "", 0));
|
| 2615 | } else if (this.getTwitchStream().func_152928_D() && this.getTwitchStream().func_152936_l()) {
|
| 2616 | if (this.theWorld != null) {
|
| 2617 | this.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Not ready to start streaming yet!"));
|
| 2618 | }
|
| 2619 | } else {
|
| 2620 | GuiStreamUnavailable.func_152321_a(this.currentScreen);
|
| 2621 | }
|
| 2622 | } else if (var1 == this.gameSettings.keyBindStreamPauseUnpause.getKeyCode()) {
|
| 2623 | if (this.getTwitchStream().func_152934_n()) {
|
| 2624 | if (this.getTwitchStream().isPaused()) {
|
| 2625 | this.getTwitchStream().func_152933_r();
|
| 2626 | } else {
|
| 2627 | this.getTwitchStream().func_152916_q();
|
| 2628 | }
|
| 2629 | }
|
| 2630 | } else if (var1 == this.gameSettings.keyBindStreamCommercials.getKeyCode()) {
|
| 2631 | if (this.getTwitchStream().func_152934_n()) {
|
| 2632 | this.getTwitchStream().func_152931_p();
|
| 2633 | }
|
| 2634 | } else if (var1 == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) {
|
| 2635 | this.stream.func_152910_a(true);
|
| 2636 | } else if (var1 == this.gameSettings.keyBindFullscreen.getKeyCode()) {
|
| 2637 | this.toggleFullscreen();
|
| 2638 | } else if (var1 == this.gameSettings.keyBindScreenshot.getKeyCode()) {
|
| 2639 | this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc));
|
| 2640 | }
|
| 2641 | } else if (var1 == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) {
|
| 2642 | this.stream.func_152910_a(false);
|
| 2643 | }
|
| 2644 | }
|
| 2645 | }
|
| 2646 | }
|
| 2647 |
|
| 2648 | public MinecraftSessionService getSessionService() {
|
| 2649 | return this.sessionService;
|
| 2650 | }
|
| 2651 |
|
| 2652 | public SkinManager getSkinManager() {
|
| 2653 | return this.skinManager;
|
| 2654 | }
|
| 2655 |
|
| 2656 | public Entity func_175606_aa() {
|
| 2657 | return this.field_175622_Z;
|
| 2658 | }
|
| 2659 |
|
| 2660 | public void func_175607_a(Entity p_175607_1_) {
|
| 2661 | this.field_175622_Z = p_175607_1_;
|
| 2662 | this.entityRenderer.func_175066_a(p_175607_1_);
|
| 2663 | }
|
| 2664 |
|
| 2665 | public ListenableFuture addScheduledTask(Callable callableToSchedule) {
|
| 2666 | Validate.notNull(callableToSchedule);
|
| 2667 |
|
| 2668 | if (!this.isCallingFromMinecraftThread()) {
|
| 2669 | ListenableFutureTask var2 = ListenableFutureTask.create(callableToSchedule);
|
| 2670 | Queue var3 = this.scheduledTasks;
|
| 2671 |
|
| 2672 | synchronized (this.scheduledTasks) {
|
| 2673 | this.scheduledTasks.add(var2);
|
| 2674 | return var2;
|
| 2675 | }
|
| 2676 | } else {
|
| 2677 | try {
|
| 2678 | return Futures.immediateFuture(callableToSchedule.call());
|
| 2679 | } catch (Exception var6) {
|
| 2680 | return Futures.immediateFailedCheckedFuture(var6);
|
| 2681 | }
|
| 2682 | }
|
| 2683 | }
|
| 2684 |
|
| 2685 | public ListenableFuture addScheduledTask(Runnable runnableToSchedule) {
|
| 2686 | Validate.notNull(runnableToSchedule);
|
| 2687 | return this.addScheduledTask(Executors.callable(runnableToSchedule));
|
| 2688 | }
|
| 2689 |
|
| 2690 | public boolean isCallingFromMinecraftThread() {
|
| 2691 | return Thread.currentThread() == this.mcThread;
|
| 2692 | }
|
| 2693 |
|
| 2694 | public BlockRendererDispatcher getBlockRendererDispatcher() {
|
| 2695 | return this.field_175618_aM;
|
| 2696 | }
|
| 2697 |
|
| 2698 | public RenderManager getRenderManager() {
|
| 2699 | return this.renderManager;
|
| 2700 | }
|
| 2701 |
|
| 2702 | public RenderItem getRenderItem() {
|
| 2703 | return this.renderItem;
|
| 2704 | }
|
| 2705 |
|
| 2706 | public ItemRenderer getItemRenderer() {
|
| 2707 | return this.itemRenderer;
|
| 2708 | }
|
| 2709 |
|
| 2710 | public static int func_175610_ah() {
|
| 2711 | return debugFPS;
|
| 2712 | }
|
| 2713 |
|
| 2714 | public static Map func_175596_ai() {
|
| 2715 | HashMap var0 = Maps.newHashMap();
|
| 2716 | var0.put("X-Minecraft-Username", getMinecraft().getSession().getUsername());
|
| 2717 | var0.put("X-Minecraft-UUID", getMinecraft().getSession().getPlayerID());
|
| 2718 | var0.put("X-Minecraft-Version", "1.8");
|
| 2719 | return var0;
|
| 2720 | }
|
| 2721 |
|
| 2722 | static final class SwitchEnumMinecartType {
|
| 2723 | static final int[] field_152390_a;
|
| 2724 |
|
| 2725 | static final int[] field_178901_b = new int[EntityMinecart.EnumMinecartType.values().length];
|
| 2726 | private static final String __OBFID = "CL_00001959";
|
| 2727 |
|
| 2728 | static {
|
| 2729 | try {
|
| 2730 | field_178901_b[EntityMinecart.EnumMinecartType.FURNACE.ordinal()] = 1;
|
| 2731 | } catch (NoSuchFieldError var8) {
|
| 2732 | ;
|
| 2733 | }
|
| 2734 |
|
| 2735 | try {
|
| 2736 | field_178901_b[EntityMinecart.EnumMinecartType.CHEST.ordinal()] = 2;
|
| 2737 | } catch (NoSuchFieldError var7) {
|
| 2738 | ;
|
| 2739 | }
|
| 2740 |
|
| 2741 | try {
|
| 2742 | field_178901_b[EntityMinecart.EnumMinecartType.TNT.ordinal()] = 3;
|
| 2743 | } catch (NoSuchFieldError var6) {
|
| 2744 | ;
|
| 2745 | }
|
| 2746 |
|
| 2747 | try {
|
| 2748 | field_178901_b[EntityMinecart.EnumMinecartType.HOPPER.ordinal()] = 4;
|
| 2749 | } catch (NoSuchFieldError var5) {
|
| 2750 | ;
|
| 2751 | }
|
| 2752 |
|
| 2753 | try {
|
| 2754 | field_178901_b[EntityMinecart.EnumMinecartType.COMMAND_BLOCK.ordinal()] = 5;
|
| 2755 | } catch (NoSuchFieldError var4) {
|
| 2756 | ;
|
| 2757 | }
|
| 2758 |
|
| 2759 | field_152390_a = new int[MovingObjectPosition.MovingObjectType.values().length];
|
| 2760 |
|
| 2761 | try {
|
| 2762 | field_152390_a[MovingObjectPosition.MovingObjectType.ENTITY.ordinal()] = 1;
|
| 2763 | } catch (NoSuchFieldError var3) {
|
| 2764 | ;
|
| 2765 | }
|
| 2766 |
|
| 2767 | try {
|
| 2768 | field_152390_a[MovingObjectPosition.MovingObjectType.BLOCK.ordinal()] = 2;
|
| 2769 | } catch (NoSuchFieldError var2) {
|
| 2770 | ;
|
| 2771 | }
|
| 2772 |
|
| 2773 | try {
|
| 2774 | field_152390_a[MovingObjectPosition.MovingObjectType.MISS.ordinal()] = 3;
|
| 2775 | } catch (NoSuchFieldError var1) {
|
| 2776 | ;
|
| 2777 | }
|
| 2778 | }
|
| 2779 | }
|
| 2780 | }
|