Nekoware v1 private FastPlace module 2 files, 2800 lines

Nekoware v1 private FastPlace: Full Source Analysis

Nekoware v1's FastPlace is a byte-for-byte port of the Memeware 7.3 module: one @Handler-flagged Consumer on the lwjeb bus that writes mc.rightClickDelayTimer = 0 on every UpdateEvent.

me/nekoWare/client/module/misc/FastPlace.java · GitHub source ↗

Published 2026-08-12 · Updated 2026-08-12

Packets This Module Uses

Analysis

Overview

Nekoware v1's FastPlace is a byte-for-byte port of the Memeware 7.3 module: one @Handler-flagged Consumer on the lwjeb bus that writes mc.rightClickDelayTimer = 0 on every UpdateEvent. Vanilla's gate sets the timer to 4 at the top of rightClickMouse(), decrements it once per tick, and only fires the held-use branch while it reads exactly 0, so the module collapses the 4-tick action cooldown and lifts right-click placement from 5 actions per second toward the 20/s tick ceiling. The only differences from the Memeware original are the package name, the module display name ('FastPlace' without a space) and the Category.MISC registration line; the mechanism, the timing profile and the server-visible fingerprint (a denser C08 placement stream) are identical.

Architecture

The module is a constructor plus one public Consumer field. The constructor registers the module as 'FastPlace' under Category.MISC with key 0, and eventConsumer0 is marked with the lwjeb @Handler marker so the bus invokes its accept() on every UpdateEvent. The lambda body is a single assignment: mc.rightClickDelayTimer = 0. There are no settings, no onEnable/onDisable, no mode system and no other handlers, so the module has exactly one behavior and it is always on while toggled.

The vanilla gate

The same Minecraft.java touchpoints as the Memeware original apply in this fork: rightClickMouse() writes rightClickDelayTimer = 4 at line 1327, the run-tick loop decrements at lines 1453-1454, and the held-use branch at line 1791 requires the timer to be exactly 0 and the player not already using an item. The module's per-tick write lands between the decrement and the poll, so the cooldown never accumulates and each tick is eligible for a right-click action. The isUsingItem guard still prevents double-fire inside an active use animation, which means the gain is exactly the elimination of the 4-tick inter-action wait.

Server-side effect

As with the Memeware parent, the observable effect is a placement-rate change, not a packet-content change: sustained right clicks collapse from one C08PacketPlayerBlockPlacement every 200ms to one per tick (sub-50ms scatter at full CPS), and the same cadence applies to item use. Because the payloads are vanilla-faithful, the module is only detectable through timing statistics, which is what makes the placement-rate family of checks (NCP's FastPlace window, short-term tick counters) the relevant countering surface rather than any payload validation.

source FastPlace.java (module logic)

FastPlace.java19 lines · JavaOriginal ↗
1
package me.nekoWare.client.module.misc;
2
3
import me.hippo.api.lwjeb.annotation.Handler;
4
import me.nekoWare.client.event.events.UpdateEvent;
5
import me.nekoWare.client.module.Module;
6
7
import java.util.function.Consumer;
8
9
public class FastPlace extends Module {
10
11
    public FastPlace() {
12
        super("FastPlace", 0, Category.MISC);
13
    }
14
15
    @Handler
16
    public Consumer<UpdateEvent> eventConsumer0 = (event) -> {
17
        mc.rightClickDelayTimer = 0;
18
    };
19
}

What this file does

The complete module: the constructor registers 'FastPlace' under Category.MISC, and the single @Handler-flagged Consumer field executes mc.rightClickDelayTimer = 0 on every UpdateEvent. Apart from the package name and the registration strings it is textually identical to me/memewaredevs/client/module/misc/FastPlace.java, which makes it a direct port rather than an independent implementation.

source Minecraft.java (the timer being zeroed)

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

What this file does

The three rightClickDelayTimer touchpoints of this fork: the write of 4 in rightClickMouse (line 1327), the per-tick decrement (lines 1453-1454) and the held-use gate at line 1791 that requires the timer to read exactly 0. The module's assignment defeats that gate by running between the decrement and the poll, so the field never carries a cooldown while the module is toggled.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat FastPlace (placement-rate window)

FastPlace.java103 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.blockplace;
16
17
import org.bukkit.block.Block;
18
import org.bukkit.entity.Player;
19
20
import fr.neatmonster.nocheatplus.checks.Check;
21
import fr.neatmonster.nocheatplus.checks.CheckType;
22
import fr.neatmonster.nocheatplus.players.IPlayerData;
23
import fr.neatmonster.nocheatplus.utilities.TickTask;
24
25
/**
26
 * A check used to verify if the player isn't placing blocks too quickly.
27
 */
28
public class FastPlace extends Check {
29
30
    /**
31
     * Instantiates a new fast place check.
32
     */
33
    public FastPlace() {
34
        super(CheckType.BLOCKPLACE_FASTPLACE);
35
    }
36
37
    /**
38
     * Checks a player.
39
     * 
40
     * @param player
41
     *            the player
42
     * @param block
43
     *            the block
44
     * @param tick
45
     * @param data
46
     * @param cc
47
     * @param pData
48
     * @return true, if successful
49
     */
50
    public boolean check(final Player player, final Block block, final int tick, final BlockPlaceData data, 
51
                         final BlockPlaceConfig cc, final IPlayerData pData) {
52
53
        data.fastPlaceBuckets.add(System.currentTimeMillis(), 1f);
54
        final boolean lag = pData.getCurrentWorldData().shouldAdjustToLag(type);
55
        // Full period frequency.
56
        final float fullScore = data.fastPlaceBuckets.score(1f);
57
58
        // Short term limit.
59
        if (tick < data.fastPlaceShortTermTick) {
60
            // TickTask got reset.
61
            data.fastPlaceShortTermTick = tick;
62
            data.fastPlaceShortTermCount = 1;
63
        }
64
        else if (tick - data.fastPlaceShortTermTick < cc.fastPlaceShortTermTicks) {
65
            // Account for server side lag.
66
            if (!lag || TickTask.getLag(50L * (tick - data.fastPlaceShortTermTick), true) < 1.2f) {
67
                // Within range, add.
68
                data.fastPlaceShortTermCount ++;
69
            }
70
            else {
71
                // Too much lag, reset.
72
                data.fastPlaceShortTermTick = tick;
73
                data.fastPlaceShortTermCount = 1;
74
            }
75
        }
76
        else { 
77
            data.fastPlaceShortTermTick = tick;
78
            data.fastPlaceShortTermCount = 1;
79
        }
80
81
        // Find out if one of both are violations:
82
        final float fullViolation;
83
        if (fullScore > cc.fastPlaceLimit) {
84
            // Account for server side lag.
85
            fullViolation = lag ? fullScore / TickTask.getLag(data.fastPlaceBuckets.bucketDuration() * data.fastPlaceBuckets.numberOfBuckets(), true) - cc.fastPlaceLimit
86
                                : fullScore - cc.fastPlaceLimit;
87
        }
88
        else fullViolation = 0;
89
        final float shortTermViolation = data.fastPlaceShortTermCount - cc.fastPlaceShortTermLimit; 
90
        final float violation = Math.max(fullViolation, shortTermViolation);
91
        boolean cancel = false;
92
93
        if (violation > 0.0) {
94
            final double change = (double) violation;
95
            data.fastPlaceVL += change;
96
            cancel = executeActions(player, data.fastPlaceVL, change, cc.fastPlaceActions).willCancel();
97
        }
98
        else if (data.fastPlaceVL > 0D && fullScore < cc.fastPlaceLimit * .75) {
99
            data.fastPlaceVL *= 0.95;
100
        }
101
        return cancel;
102
    }
103
}

How it counteracts this module

NCP's blockplace FastPlace scores each real placement into an ActionFrequency(2, 1000) window (BlockPlaceData line 53) and a short-term tick counter: fullScore = fastPlaceBuckets.score(1f) against cc.fastPlaceLimit (default 15/s, DefaultConfig line 184), plus a fastPlaceShortTermLimit (6) placements in fastPlaceShortTermTicks (10) ticks (lines 59-89). Vanilla's 200ms cooldown keeps a legit player at 5 placements/s, far under both bounds, while this module's zeroed timer pushes sustained placement toward 20/s and exceeds the window limit, triggering the configured cancel actions from vl>5. Because the check only fires from the Bukkit BlockPlaceEvent path, the item-use C08s (facing 255, air position) that the same gate accelerates are never scored by it.

anticheat Direction (facing validation)

Direction.java52 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.blockplace;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.actions.ActionList;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
import fr.neatmonster.nocheatplus.checks.generic.block.AbstractBlockDirectionCheck;
22
23
/**
24
 * The Direction check will find out if a player tried to interact with
25
 * something that's not in their field of view.
26
 */
27
public class Direction extends AbstractBlockDirectionCheck<BlockPlaceData, BlockPlaceConfig> {
28
29
    /**
30
     * Instantiates a new direction check.
31
     */
32
    public Direction() {
33
        super(CheckType.BLOCKPLACE_DIRECTION);
34
    }
35
36
    @Override
37
    protected double addVL(Player player, double distance, BlockPlaceData data, BlockPlaceConfig cc) {
38
        data.directionVL += distance;
39
        return data.directionVL;
40
    }
41
42
    @Override
43
    protected ActionList getActions(BlockPlaceConfig cc) {
44
        return cc.directionActions;
45
    }
46
47
    @Override
48
    protected void cooldown(Player player, BlockPlaceData data, BlockPlaceConfig cc) {
49
        data.directionVL *= 0.9D;
50
    }
51
52
}

How it counteracts this module

Direction extends AbstractBlockDirectionCheck and accumulates blockplace VL from the angular gap between the placement's claimed facing and the player's actual look direction, with a per-hit cooldown. The module sends honest facings, so standing-still fast place is invisible to it; its value is as the companion to the rate check, because a placement stream that chases a moving cursor (strafing placements) makes the look updates trail the placement packets and the sustained mismatch accumulates. A fixed-position placement spam defeats the direction check entirely, which is why the rate window remains the primary counter.

anticheat BlockPlace packet listener (soup auto-heal only)

PacketListener.java215 lines · Java
1
package me.vrekt.arc.listener.packet;
2
3
import com.comphenix.packetwrapper.WrapperPlayClientBlockPlace;
4
import com.comphenix.packetwrapper.WrapperPlayClientFlying;
5
import com.comphenix.packetwrapper.WrapperPlayClientHeldItemSlot;
6
import com.comphenix.packetwrapper.WrapperPlayClientPosition;
7
import com.comphenix.packetwrapper.WrapperPlayClientPositionLook;
8
import com.comphenix.packetwrapper.WrapperPlayClientUseEntity;
9
import com.comphenix.protocol.PacketType;
10
import com.comphenix.protocol.ProtocolLibrary;
11
import com.comphenix.protocol.ProtocolManager;
12
import com.comphenix.protocol.events.ListenerPriority;
13
import com.comphenix.protocol.events.PacketAdapter;
14
import com.comphenix.protocol.events.PacketEvent;
15
import com.comphenix.protocol.wrappers.EnumWrappers;
16
import me.vrekt.arc.Arc;
17
import me.vrekt.arc.check.CheckType;
18
import me.vrekt.arc.check.combat.KillAura;
19
import me.vrekt.arc.check.inventory.AutoHeal;
20
import me.vrekt.arc.check.moving.MorePackets;
21
import me.vrekt.arc.data.combat.FightData;
22
import me.vrekt.arc.data.inventory.InventoryData;
23
import me.vrekt.arc.data.moving.MovingData;
24
import me.vrekt.arc.listener.ACheckListener;
25
import org.bukkit.Material;
26
import org.bukkit.entity.Player;
27
import org.bukkit.inventory.ItemStack;
28
import org.bukkit.plugin.Plugin;
29
30
public class PacketListener implements ACheckListener {
31
    private final MorePackets MORE_PACKETS = (MorePackets) Arc.getCheckManager().getCheck(CheckType.MOREPACKETS);
32
    private final KillAura KILL_AURA = (KillAura) Arc.getCheckManager().getCheck(CheckType.KILLAURA);
33
    private final AutoHeal AUTO_HEAL = (AutoHeal) CHECK_MANAGER.getCheck(CheckType.AUTOHEAL);
34
35
    private boolean listening = false;
36
37
    /**
38
     * Stop listening.
39
     */
40
    public void stopListening() {
41
        ProtocolLibrary.getProtocolManager().removePacketListeners(Arc.getPlugin());
42
    }
43
44
    public void startListening(Plugin plugin, ProtocolManager manager) {
45
        listening = true;
46
47
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.FLYING) {
48
            @Override
49
            public void onPacketReceiving(PacketEvent event) {
50
                Player player = event.getPlayer();
51
                MovingData data = MovingData.getData(player);
52
53
                if (data.cancelMovingPackets()) {
54
                    event.setCancelled(true);
55
                }
56
57
                // Update ground info.
58
                WrapperPlayClientFlying flying = new WrapperPlayClientFlying(event.getPacket());
59
                data.setFlyingClientOnGround(flying.getOnGround());
60
61
                // Update packet info.
62
                data.setFlyingPackets(data.getFlyingPackets() + 1);
63
                boolean cancel = updateAndCheck(player, data);
64
                if (cancel) {
65
                    event.setCancelled(true);
66
                }
67
68
            }
69
        });
70
71
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.POSITION,
72
                PacketType.Play.Client.POSITION_LOOK) {
73
            @Override
74
            public void onPacketReceiving(PacketEvent event) {
75
                Player player = event.getPlayer();
76
                MovingData data = MovingData.getData(player);
77
78
                if (data.cancelMovingPackets()) {
79
                    event.setCancelled(true);
80
                }
81
82
                // Update ground info.
83
                if (event.getPacket().getType().equals(PacketType.Play.Client.POSITION)) {
84
                    WrapperPlayClientPosition position = new WrapperPlayClientPosition(event.getPacket());
85
                    data.setPositionClientOnGround(position.getOnGround());
86
                } else {
87
                    WrapperPlayClientPositionLook position = new WrapperPlayClientPositionLook(event.getPacket());
88
                    data.setPositionClientOnGround(position.getOnGround());
89
                }
90
91
                // Update packet info.
92
                data.setPositionPackets(data.getPositionPackets() + 1);
93
                boolean cancel = updateAndCheck(player, data);
94
                if (cancel) {
95
                    event.setCancelled(true);
96
                }
97
            }
98
        });
99
100
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.USE_ENTITY) {
101
            @Override
102
            public void onPacketReceiving(PacketEvent event) {
103
                Player player = event.getPlayer();
104
                FightData data = FightData.getData(player);
105
                data.setTotalAttacks(data.getTotalAttacks() + 1);
106
107
            }
108
        });
109
110
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.ARM_ANIMATION) {
111
            @Override
112
            public void onPacketReceiving(PacketEvent event) {
113
                Player player = event.getPlayer();
114
                FightData data = FightData.getData(player);
115
                data.setLastArmSwing(System.currentTimeMillis());
116
            }
117
        });
118
119
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.HELD_ITEM_SLOT) {
120
            @Override
121
            public void onPacketReceiving(PacketEvent event) {
122
                Player player = event.getPlayer();
123
                InventoryData data = InventoryData.getData(player);
124
                WrapperPlayClientHeldItemSlot itemSlotChange = new WrapperPlayClientHeldItemSlot(event.getPacket());
125
                int slot = itemSlotChange.getSlot();
126
                ItemStack item = player.getInventory().getItem(slot);
127
                if (item != null && item.getType() == Material.MUSHROOM_SOUP) {
128
                    data.setLastItemSwitch(System.currentTimeMillis());
129
                }
130
131
            }
132
        });
133
134
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.BLOCK_PLACE) {
135
            @Override
136
            public void onPacketReceiving(PacketEvent event) {
137
                Player player = event.getPlayer();
138
                InventoryData data = InventoryData.getData(player);
139
                WrapperPlayClientBlockPlace blockPlace = new WrapperPlayClientBlockPlace(event.getPacket());
140
                ItemStack item = blockPlace.getHeldItem();
141
142
                if (item != null && item.getType() == Material.MUSHROOM_SOUP) {
143
                    AUTO_HEAL.check(data, player);
144
                }
145
            }
146
        });
147
148
        manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.USE_ENTITY) {
149
            @Override
150
            public void onPacketReceiving(PacketEvent event) {
151
                Player player = event.getPlayer();
152
                FightData data = FightData.getData(player);
153
                WrapperPlayClientUseEntity useEntity = new WrapperPlayClientUseEntity(event.getPacket());
154
                if (useEntity.getType() == EnumWrappers.EntityUseAction.ATTACK) {
155
                    // we attacked, lets update our data and check.
156
                    data.setAttackPackets(data.getAttackPackets() + 1);
157
                    boolean canCheckKillAura = Arc.getCheckManager().canCheckPlayer(player, CheckType.KILLAURA);
158
                    if (canCheckKillAura) {
159
                        boolean failed = KILL_AURA.checkFrequency(data, player);
160
                        if (failed) {
161
                            event.setCancelled(true);
162
                        }
163
                    }
164
                }
165
            }
166
        });
167
168
    }
169
170
    /**
171
     * Checks MorePackets and updates/resets data.
172
     *
173
     * @param player the player
174
     * @param data   the MovingData
175
     * @return true if we should cancel.
176
     */
177
    private boolean updateAndCheck(Player player, MovingData data) {
178
        if (data.getLastPacketUpdate() == 0) {
179
            data.setLastPacketUpdate(System.currentTimeMillis());
180
            return false;
181
        }
182
183
        boolean canCheckMorePackets = Arc.getCheckManager().canCheckPlayer(player, CheckType.MOREPACKETS);
184
185
        // if we cant check reset data and return.
186
        if (!canCheckMorePackets) {
187
            data.setLastPacketUpdate(System.currentTimeMillis());
188
            data.setPositionPackets(0);
189
            data.setFlyingPackets(0);
190
191
            data.setCancelMovingPackets(false);
192
            return false;
193
        }
194
195
        long timeElapsed = System.currentTimeMillis() - data.getLastPacketUpdate();
196
        if (timeElapsed >= 1000) {
197
            data.setCancelMovingPackets(false);
198
            // its been a second lets check.
199
            boolean check = MORE_PACKETS.check(player, data);
200
201
            data.setPositionPackets(0);
202
            data.setFlyingPackets(0);
203
            data.setLastPacketUpdate(System.currentTimeMillis());
204
            return check;
205
        }
206
        return false;
207
    }
208
209
    /**
210
     * @return if we are listening for packets.
211
     */
212
    public boolean isListening() {
213
        return listening;
214
    }
215
}

How it counteracts this module

Arc v2's BLOCK_PLACE packet adapter (lines 134-142) only inspects the held item and reacts when it is MUSHROOM_SOUP, feeding the AUTO_HEAL check; the tree contains no placement-rate, direction or placement-reach validation. The accelerated C08 stream from this module therefore passes Arc v2's block-place layer untouched, and any real pressure on Arc v2 comes from the movement layer (MorePackets max-packets 30/s, Flight) rather than from a placement check. This is a gap entry: the AC's block-place surface does not counter the module.

← Back to Analysis Hub