Sigma 4.11 NoRotate module 2 files, 1879 lines

Sigma 4.11 NoRotate: Full Source Analysis

Sigma 4.11's NoRotate is a receive-side packet mutator that stops the server from rotating the player.

info/sigmaclient/module/impl/player/NoRotate.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

Sigma 4.11's NoRotate is a receive-side packet mutator that stops the server from rotating the player. It registers for EventPacket and, when an incoming S08PacketPlayerPosLook arrives, overwrites the packet's yaw and pitch with the client's current rotationYaw and rotationPitch before the packet is processed. The fork's NetworkManager fires the event in channelRead0 before packet.processPacket, so the mutation lands before NetHandlerPlayClient.handlePlayerPosLook runs: setPositionAndRotation then applies the server's position but the client's own angles, the camera never snaps, and the client's reply C06 echoes its own rotation unchanged. Position teleports still apply in full; only the rotation half of the S08 is discarded. The module sends no packets of its own and is invisible on the wire except for the C06 echo that disagrees with the S08 rotation the server just sent.

Interception point

NetworkManager.channelRead0 fires EventPacket with the outgoing flag false (line 151) before processPacket dispatches to the handler, and sendPacket fires it with true (line 207). NoRotate's isIncoming() guard therefore selects exactly the receive path, and the instanceof selects the S08. The rewrite happens in place on the single EventPacket instance, so when handlePlayerPosLook (NetHandlerPlayClient line 599) later reads packetIn.getYaw() and getPitch(), it reads the client's own angles, applies them via setPositionAndRotation (line 634), and echoes C06PacketPlayerPosLook with rotationYaw/rotationPitch (line 635) - which are the client's angles, because the rewrite already happened. The X_ROT/Y_ROT relative-flag accumulation (lines 626-632) is applied to the already-rewritten values, so relative teleports are handled consistently too.

What survives and what does not

Only the rotation is discarded. The x, y, z fields (and the X/Y/Z relative flags that add onto the current position) pass through untouched, so teleport-based position corrections, anti-phase set-backs and server-side position resyncs all still take effect; the module only cancels the visual and reported rotation change. The client's own rotation is what the C06 echo carries, which is what makes the module visible to a server that compares the rotation in the S08 it sent against the rotation in the subsequent C06: vanilla clients echo the S08 angles, a NoRotate client echoes its own.

Wire fingerprint

The module adds no packets. The observable is the C06 reply to each S08: the yaw and pitch fields carry the client's pre-teleport rotation instead of the teleport's angles, and the client's subsequent look updates continue from that rotation. Servers that enforce a teleport-rotation convergence window would see the gap; none of the anticheats in this reference set do, because none of them model S08 rotation compliance.

source NoRotate.java

NoRotate.java29 lines · JavaOriginal ↗
1
package info.sigmaclient.module.impl.player;
2
3
import info.sigmaclient.event.Event;
4
import info.sigmaclient.event.RegisterEvent;
5
import info.sigmaclient.event.impl.EventPacket;
6
import info.sigmaclient.module.Module;
7
import info.sigmaclient.module.data.ModuleData;
8
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
9
10
public class NoRotate extends Module {
11
12
    public NoRotate(ModuleData data) {
13
        super(data);
14
        // TODO Auto-generated constructor stub
15
    }
16
17
    @Override
18
    @RegisterEvent(events = {EventPacket.class})
19
    public void onEvent(Event event) {
20
        if (event instanceof EventPacket) {
21
            EventPacket ep = (EventPacket) event;
22
            if (ep.isIncoming() && (ep.getPacket() instanceof S08PacketPlayerPosLook)) {
23
                S08PacketPlayerPosLook pac = (S08PacketPlayerPosLook) ep.getPacket();
24
                pac.yaw = mc.thePlayer.rotationYaw;
25
                pac.pitch = mc.thePlayer.rotationPitch;
26
            }
27
        }
28
    }
29
}

What this file does

The module is this file alone. The handler registers for EventPacket, and on every incoming packet that is an S08PacketPlayerPosLook it assigns mc.thePlayer.rotationYaw to pac.yaw and mc.thePlayer.rotationPitch to pac.pitch. That is the entire mechanism: the packet object the event carries is the same object processPacket will hand to handlePlayerPosLook, so mutating its fields is equivalent to rewriting the packet before the handler reads it. The module never cancels the event, so the S08 continues to the handler and the position teleport is honored; only the rotation values are swapped. There is no setting, no onEnable/onDisable logic beyond the default, and no outgoing-packet access. The file's correctness depends entirely on the fork's channelRead0 firing the event before processPacket, which NetworkManager guarantees at line 151-152.

source NetHandlerPlayClient.java (S08 application path)

NetHandlerPlayClient.java1850 lines · JavaOriginal ↗
1
package net.minecraft.client.network;
2
3
import com.google.common.collect.Maps;
4
import com.google.common.util.concurrent.FutureCallback;
5
import com.google.common.util.concurrent.Futures;
6
import com.mojang.authlib.GameProfile;
7
8
import info.sigmaclient.Client;
9
import io.netty.buffer.Unpooled;
10
import info.sigmaclient.gui.screen.impl.mainmenu.ClientMainMenu;
11
import info.sigmaclient.util.misc.ChatUtil;
12
13
import java.io.File;
14
import java.io.IOException;
15
import java.util.Collection;
16
import java.util.Iterator;
17
import java.util.List;
18
import java.util.Map;
19
import java.util.Random;
20
import java.util.UUID;
21
import java.util.Map.Entry;
22
23
import net.minecraft.block.Block;
24
import net.minecraft.client.ClientBrandRetriever;
25
import net.minecraft.client.Minecraft;
26
import net.minecraft.client.audio.GuardianSound;
27
import net.minecraft.client.entity.EntityOtherPlayerMP;
28
import net.minecraft.client.entity.EntityPlayerSP;
29
import net.minecraft.client.gui.GuiChat;
30
import net.minecraft.client.gui.GuiDisconnected;
31
import net.minecraft.client.gui.GuiDownloadTerrain;
32
import net.minecraft.client.gui.GuiMerchant;
33
import net.minecraft.client.gui.GuiMultiplayer;
34
import net.minecraft.client.gui.GuiScreen;
35
import net.minecraft.client.gui.GuiScreenBook;
36
import net.minecraft.client.gui.GuiScreenDemo;
37
import net.minecraft.client.gui.GuiScreenRealmsProxy;
38
import net.minecraft.client.gui.GuiWinGame;
39
import net.minecraft.client.gui.GuiYesNo;
40
import net.minecraft.client.gui.GuiYesNoCallback;
41
import net.minecraft.client.gui.IProgressMeter;
42
import net.minecraft.client.gui.inventory.GuiContainerCreative;
43
import net.minecraft.client.multiplayer.PlayerControllerMP;
44
import net.minecraft.client.multiplayer.ServerData;
45
import net.minecraft.client.multiplayer.ServerList;
46
import net.minecraft.client.multiplayer.WorldClient;
47
import net.minecraft.client.particle.EntityPickupFX;
48
import net.minecraft.client.player.inventory.ContainerLocalMenu;
49
import net.minecraft.client.player.inventory.LocalBlockIntercommunication;
50
import net.minecraft.client.resources.I18n;
51
import net.minecraft.client.settings.GameSettings;
52
import net.minecraft.client.stream.MetadataAchievement;
53
import net.minecraft.client.stream.MetadataCombat;
54
import net.minecraft.client.stream.MetadataPlayerDeath;
55
import net.minecraft.creativetab.CreativeTabs;
56
import net.minecraft.entity.Entity;
57
import net.minecraft.entity.EntityLeashKnot;
58
import net.minecraft.entity.EntityList;
59
import net.minecraft.entity.EntityLiving;
60
import net.minecraft.entity.EntityLivingBase;
61
import net.minecraft.entity.IMerchant;
62
import net.minecraft.entity.NpcMerchant;
63
import net.minecraft.entity.ai.attributes.AttributeModifier;
64
import net.minecraft.entity.ai.attributes.BaseAttributeMap;
65
import net.minecraft.entity.ai.attributes.IAttribute;
66
import net.minecraft.entity.ai.attributes.IAttributeInstance;
67
import net.minecraft.entity.ai.attributes.RangedAttribute;
68
import net.minecraft.entity.effect.EntityLightningBolt;
69
import net.minecraft.entity.item.EntityArmorStand;
70
import net.minecraft.entity.item.EntityBoat;
71
import net.minecraft.entity.item.EntityEnderCrystal;
72
import net.minecraft.entity.item.EntityEnderEye;
73
import net.minecraft.entity.item.EntityEnderPearl;
74
import net.minecraft.entity.item.EntityExpBottle;
75
import net.minecraft.entity.item.EntityFallingBlock;
76
import net.minecraft.entity.item.EntityFireworkRocket;
77
import net.minecraft.entity.item.EntityItem;
78
import net.minecraft.entity.item.EntityItemFrame;
79
import net.minecraft.entity.item.EntityMinecart;
80
import net.minecraft.entity.item.EntityPainting;
81
import net.minecraft.entity.item.EntityTNTPrimed;
82
import net.minecraft.entity.item.EntityXPOrb;
83
import net.minecraft.entity.monster.EntityGuardian;
84
import net.minecraft.entity.passive.EntityHorse;
85
import net.minecraft.entity.player.EntityPlayer;
86
import net.minecraft.entity.player.InventoryPlayer;
87
import net.minecraft.entity.projectile.EntityArrow;
88
import net.minecraft.entity.projectile.EntityEgg;
89
import net.minecraft.entity.projectile.EntityFishHook;
90
import net.minecraft.entity.projectile.EntityLargeFireball;
91
import net.minecraft.entity.projectile.EntityPotion;
92
import net.minecraft.entity.projectile.EntitySmallFireball;
93
import net.minecraft.entity.projectile.EntitySnowball;
94
import net.minecraft.entity.projectile.EntityWitherSkull;
95
import net.minecraft.init.Items;
96
import net.minecraft.inventory.AnimalChest;
97
import net.minecraft.inventory.Container;
98
import net.minecraft.inventory.InventoryBasic;
99
import net.minecraft.item.Item;
100
import net.minecraft.item.ItemMap;
101
import net.minecraft.item.ItemStack;
102
import net.minecraft.network.NetworkManager;
103
import net.minecraft.network.Packet;
104
import net.minecraft.network.PacketBuffer;
105
import net.minecraft.network.PacketThreadUtil;
106
import net.minecraft.network.play.INetHandlerPlayClient;
107
import net.minecraft.network.play.client.C00PacketKeepAlive;
108
import net.minecraft.network.play.client.C03PacketPlayer;
109
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
110
import net.minecraft.network.play.client.C17PacketCustomPayload;
111
import net.minecraft.network.play.client.C19PacketResourcePackStatus;
112
import net.minecraft.network.play.server.S00PacketKeepAlive;
113
import net.minecraft.network.play.server.S01PacketJoinGame;
114
import net.minecraft.network.play.server.S02PacketChat;
115
import net.minecraft.network.play.server.S03PacketTimeUpdate;
116
import net.minecraft.network.play.server.S04PacketEntityEquipment;
117
import net.minecraft.network.play.server.S05PacketSpawnPosition;
118
import net.minecraft.network.play.server.S06PacketUpdateHealth;
119
import net.minecraft.network.play.server.S07PacketRespawn;
120
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
121
import net.minecraft.network.play.server.S09PacketHeldItemChange;
122
import net.minecraft.network.play.server.S0APacketUseBed;
123
import net.minecraft.network.play.server.S0BPacketAnimation;
124
import net.minecraft.network.play.server.S0CPacketSpawnPlayer;
125
import net.minecraft.network.play.server.S0DPacketCollectItem;
126
import net.minecraft.network.play.server.S0EPacketSpawnObject;
127
import net.minecraft.network.play.server.S0FPacketSpawnMob;
128
import net.minecraft.network.play.server.S10PacketSpawnPainting;
129
import net.minecraft.network.play.server.S11PacketSpawnExperienceOrb;
130
import net.minecraft.network.play.server.S12PacketEntityVelocity;
131
import net.minecraft.network.play.server.S13PacketDestroyEntities;
132
import net.minecraft.network.play.server.S14PacketEntity;
133
import net.minecraft.network.play.server.S18PacketEntityTeleport;
134
import net.minecraft.network.play.server.S19PacketEntityHeadLook;
135
import net.minecraft.network.play.server.S19PacketEntityStatus;
136
import net.minecraft.network.play.server.S1BPacketEntityAttach;
137
import net.minecraft.network.play.server.S1CPacketEntityMetadata;
138
import net.minecraft.network.play.server.S1DPacketEntityEffect;
139
import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect;
140
import net.minecraft.network.play.server.S1FPacketSetExperience;
141
import net.minecraft.network.play.server.S20PacketEntityProperties;
142
import net.minecraft.network.play.server.S21PacketChunkData;
143
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
144
import net.minecraft.network.play.server.S23PacketBlockChange;
145
import net.minecraft.network.play.server.S24PacketBlockAction;
146
import net.minecraft.network.play.server.S25PacketBlockBreakAnim;
147
import net.minecraft.network.play.server.S26PacketMapChunkBulk;
148
import net.minecraft.network.play.server.S27PacketExplosion;
149
import net.minecraft.network.play.server.S28PacketEffect;
150
import net.minecraft.network.play.server.S29PacketSoundEffect;
151
import net.minecraft.network.play.server.S2APacketParticles;
152
import net.minecraft.network.play.server.S2BPacketChangeGameState;
153
import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity;
154
import net.minecraft.network.play.server.S2DPacketOpenWindow;
155
import net.minecraft.network.play.server.S2EPacketCloseWindow;
156
import net.minecraft.network.play.server.S2FPacketSetSlot;
157
import net.minecraft.network.play.server.S30PacketWindowItems;
158
import net.minecraft.network.play.server.S31PacketWindowProperty;
159
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
160
import net.minecraft.network.play.server.S33PacketUpdateSign;
161
import net.minecraft.network.play.server.S34PacketMaps;
162
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
163
import net.minecraft.network.play.server.S36PacketSignEditorOpen;
164
import net.minecraft.network.play.server.S37PacketStatistics;
165
import net.minecraft.network.play.server.S38PacketPlayerListItem;
166
import net.minecraft.network.play.server.S39PacketPlayerAbilities;
167
import net.minecraft.network.play.server.S3APacketTabComplete;
168
import net.minecraft.network.play.server.S3BPacketScoreboardObjective;
169
import net.minecraft.network.play.server.S3CPacketUpdateScore;
170
import net.minecraft.network.play.server.S3DPacketDisplayScoreboard;
171
import net.minecraft.network.play.server.S3EPacketTeams;
172
import net.minecraft.network.play.server.S3FPacketCustomPayload;
173
import net.minecraft.network.play.server.S40PacketDisconnect;
174
import net.minecraft.network.play.server.S41PacketServerDifficulty;
175
import net.minecraft.network.play.server.S42PacketCombatEvent;
176
import net.minecraft.network.play.server.S43PacketCamera;
177
import net.minecraft.network.play.server.S44PacketWorldBorder;
178
import net.minecraft.network.play.server.S45PacketTitle;
179
import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
180
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
181
import net.minecraft.network.play.server.S48PacketResourcePackSend;
182
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
183
import net.minecraft.potion.PotionEffect;
184
import net.minecraft.realms.DisconnectedRealmsScreen;
185
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
186
import net.minecraft.scoreboard.Score;
187
import net.minecraft.scoreboard.ScoreObjective;
188
import net.minecraft.scoreboard.ScorePlayerTeam;
189
import net.minecraft.scoreboard.Scoreboard;
190
import net.minecraft.scoreboard.Team;
191
import net.minecraft.stats.Achievement;
192
import net.minecraft.stats.AchievementList;
193
import net.minecraft.stats.StatBase;
194
import net.minecraft.tileentity.TileEntity;
195
import net.minecraft.tileentity.TileEntityBanner;
196
import net.minecraft.tileentity.TileEntityBeacon;
197
import net.minecraft.tileentity.TileEntityCommandBlock;
198
import net.minecraft.tileentity.TileEntityFlowerPot;
199
import net.minecraft.tileentity.TileEntityMobSpawner;
200
import net.minecraft.tileentity.TileEntitySign;
201
import net.minecraft.tileentity.TileEntitySkull;
202
import net.minecraft.util.BlockPos;
203
import net.minecraft.util.ChatComponentTranslation;
204
import net.minecraft.util.EnumChatFormatting;
205
import net.minecraft.util.EnumFacing;
206
import net.minecraft.util.EnumParticleTypes;
207
import net.minecraft.util.IChatComponent;
208
import net.minecraft.util.MathHelper;
209
import net.minecraft.util.StringUtils;
210
import net.minecraft.village.MerchantRecipeList;
211
import net.minecraft.world.Explosion;
212
import net.minecraft.world.WorldProviderSurface;
213
import net.minecraft.world.WorldSettings;
214
import net.minecraft.world.chunk.Chunk;
215
import net.minecraft.world.storage.MapData;
216
217
import org.apache.logging.log4j.LogManager;
218
import org.apache.logging.log4j.Logger;
219
220
public class NetHandlerPlayClient implements INetHandlerPlayClient {
221
    private static final Logger logger = LogManager.getLogger();
222
223
    /**
224
     * The NetworkManager instance used to communicate with the server (used only by handlePlayerPosLook to update
225
     * positioning and handleJoinGame to inform the server of the client distribution/mods)
226
     */
227
    private final NetworkManager netManager;
228
    private final GameProfile field_175107_d;
229
230
    /**
231
     * Seems to be either null (integrated server) or an instance of either GuiMultiplayer (when connecting to a server)
232
     * or GuiScreenReamlsTOS (when connecting to MCO server)
233
     */
234
    private final GuiScreen guiScreenServer;
235
236
    /**
237
     * Reference to the Minecraft instance, which many handler methods operate on
238
     */
239
    private Minecraft gameController;
240
241
    /**
242
     * Reference to the current ClientWorld instance, which many handler methods operate on
243
     */
244
    private WorldClient clientWorldController;
245
246
    /**
247
     * True if the client has finished downloading terrain and may spawn. Set upon receipt of S08PacketPlayerPosLook,
248
     * reset upon respawning
249
     */
250
    private boolean doneLoadingTerrain;
251
252
    /**
253
     * A mapping from player names to their respective GuiPlayerInfo (specifies the clients response time to the server)
254
     */
255
    private final Map playerInfoMap = Maps.newHashMap();
256
    public int currentServerMaxPlayers = 20;
257
    private boolean field_147308_k = false;
258
259
    /**
260
     * Just an ordinary random number generator, used to randomize audio pitch of item/orb pickup and randomize both
261
     * particlespawn offset and velocity
262
     */
263
    private final Random avRandomizer = new Random();
264
    private static final String __OBFID = "CL_00000878";
265
266
    public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager p_i46300_3_, GameProfile p_i46300_4_) {
267
        this.gameController = mcIn;
268
        this.guiScreenServer = p_i46300_2_;
269
        this.netManager = p_i46300_3_;
270
        this.field_175107_d = p_i46300_4_;
271
    }
272
273
    /**
274
     * Clears the WorldClient instance associated with this NetHandlerPlayClient
275
     */
276
    public void cleanup() {
277
        this.clientWorldController = null;
278
    }
279
280
    /**
281
     * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
282
     * WorldClient and sets the player initial dimension
283
     */
284
    public void handleJoinGame(S01PacketJoinGame packetIn) {
285
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
286
        this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
287
        this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.func_149198_e(), false, packetIn.func_149195_d(), packetIn.func_149196_i()), packetIn.func_149194_f(), packetIn.func_149192_g(), this.gameController.mcProfiler);
288
        this.gameController.gameSettings.difficulty = packetIn.func_149192_g();
289
        this.gameController.loadWorld(this.clientWorldController);
290
        this.gameController.thePlayer.dimension = packetIn.func_149194_f();
291
        this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
292
        this.gameController.thePlayer.setEntityId(packetIn.func_149197_c());
293
        this.currentServerMaxPlayers = packetIn.func_149193_h();
294
        this.gameController.thePlayer.func_175150_k(packetIn.func_179744_h());
295
        this.gameController.playerController.setGameType(packetIn.func_149198_e());
296
        this.gameController.gameSettings.sendSettingsToServer();
297
        this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
298
    }
299
300
    /**
301
     * Spawns an instance of the objecttype indicated by the packet and sets its position and momentum
302
     */
303
    public void handleSpawnObject(S0EPacketSpawnObject packetIn) {
304
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
305
        double var2 = (double) packetIn.func_148997_d() / 32.0D;
306
        double var4 = (double) packetIn.func_148998_e() / 32.0D;
307
        double var6 = (double) packetIn.func_148994_f() / 32.0D;
308
        Object var8 = null;
309
310
        if (packetIn.func_148993_l() == 10) {
311
            var8 = EntityMinecart.func_180458_a(this.clientWorldController, var2, var4, var6, EntityMinecart.EnumMinecartType.func_180038_a(packetIn.func_149009_m()));
312
        } else if (packetIn.func_148993_l() == 90) {
313
            Entity var9 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
314
315
            if (var9 instanceof EntityPlayer) {
316
                var8 = new EntityFishHook(this.clientWorldController, var2, var4, var6, (EntityPlayer) var9);
317
            }
318
319
            packetIn.func_149002_g(0);
320
        } else if (packetIn.func_148993_l() == 60) {
321
            var8 = new EntityArrow(this.clientWorldController, var2, var4, var6);
322
        } else if (packetIn.func_148993_l() == 61) {
323
            var8 = new EntitySnowball(this.clientWorldController, var2, var4, var6);
324
        } else if (packetIn.func_148993_l() == 71) {
325
            var8 = new EntityItemFrame(this.clientWorldController, new BlockPos(MathHelper.floor_double(var2), MathHelper.floor_double(var4), MathHelper.floor_double(var6)), EnumFacing.getHorizontal(packetIn.func_149009_m()));
326
            packetIn.func_149002_g(0);
327
        } else if (packetIn.func_148993_l() == 77) {
328
            var8 = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(var2), MathHelper.floor_double(var4), MathHelper.floor_double(var6)));
329
            packetIn.func_149002_g(0);
330
        } else if (packetIn.func_148993_l() == 65) {
331
            var8 = new EntityEnderPearl(this.clientWorldController, var2, var4, var6);
332
        } else if (packetIn.func_148993_l() == 72) {
333
            var8 = new EntityEnderEye(this.clientWorldController, var2, var4, var6);
334
        } else if (packetIn.func_148993_l() == 76) {
335
            var8 = new EntityFireworkRocket(this.clientWorldController, var2, var4, var6, (ItemStack) null);
336
        } else if (packetIn.func_148993_l() == 63) {
337
            var8 = new EntityLargeFireball(this.clientWorldController, var2, var4, var6, (double) packetIn.func_149010_g() / 8000.0D, (double) packetIn.func_149004_h() / 8000.0D, (double) packetIn.func_148999_i() / 8000.0D);
338
            packetIn.func_149002_g(0);
339
        } else if (packetIn.func_148993_l() == 64) {
340
            var8 = new EntitySmallFireball(this.clientWorldController, var2, var4, var6, (double) packetIn.func_149010_g() / 8000.0D, (double) packetIn.func_149004_h() / 8000.0D, (double) packetIn.func_148999_i() / 8000.0D);
341
            packetIn.func_149002_g(0);
342
        } else if (packetIn.func_148993_l() == 66) {
343
            var8 = new EntityWitherSkull(this.clientWorldController, var2, var4, var6, (double) packetIn.func_149010_g() / 8000.0D, (double) packetIn.func_149004_h() / 8000.0D, (double) packetIn.func_148999_i() / 8000.0D);
344
            packetIn.func_149002_g(0);
345
        } else if (packetIn.func_148993_l() == 62) {
346
            var8 = new EntityEgg(this.clientWorldController, var2, var4, var6);
347
        } else if (packetIn.func_148993_l() == 73) {
348
            var8 = new EntityPotion(this.clientWorldController, var2, var4, var6, packetIn.func_149009_m());
349
            packetIn.func_149002_g(0);
350
        } else if (packetIn.func_148993_l() == 75) {
351
            var8 = new EntityExpBottle(this.clientWorldController, var2, var4, var6);
352
            packetIn.func_149002_g(0);
353
        } else if (packetIn.func_148993_l() == 1) {
354
            var8 = new EntityBoat(this.clientWorldController, var2, var4, var6);
355
        } else if (packetIn.func_148993_l() == 50) {
356
            var8 = new EntityTNTPrimed(this.clientWorldController, var2, var4, var6, (EntityLivingBase) null);
357
        } else if (packetIn.func_148993_l() == 78) {
358
            var8 = new EntityArmorStand(this.clientWorldController, var2, var4, var6);
359
        } else if (packetIn.func_148993_l() == 51) {
360
            var8 = new EntityEnderCrystal(this.clientWorldController, var2, var4, var6);
361
        } else if (packetIn.func_148993_l() == 2) {
362
            var8 = new EntityItem(this.clientWorldController, var2, var4, var6);
363
        } else if (packetIn.func_148993_l() == 70) {
364
            var8 = new EntityFallingBlock(this.clientWorldController, var2, var4, var6, Block.getStateById(packetIn.func_149009_m() & 65535));
365
            packetIn.func_149002_g(0);
366
        }
367
368
        if (var8 != null) {
369
            ((Entity) var8).serverPosX = packetIn.func_148997_d();
370
            ((Entity) var8).serverPosY = packetIn.func_148998_e();
371
            ((Entity) var8).serverPosZ = packetIn.func_148994_f();
372
            ((Entity) var8).rotationPitch = (float) (packetIn.func_149008_j() * 360) / 256.0F;
373
            ((Entity) var8).rotationYaw = (float) (packetIn.func_149006_k() * 360) / 256.0F;
374
            Entity[] var12 = ((Entity) var8).getParts();
375
376
            if (var12 != null) {
377
                int var10 = packetIn.func_149001_c() - ((Entity) var8).getEntityId();
378
379
                for (int var11 = 0; var11 < var12.length; ++var11) {
380
                    var12[var11].setEntityId(var12[var11].getEntityId() + var10);
381
                }
382
            }
383
384
            ((Entity) var8).setEntityId(packetIn.func_149001_c());
385
            this.clientWorldController.addEntityToWorld(packetIn.func_149001_c(), (Entity) var8);
386
387
            if (packetIn.func_149009_m() > 0) {
388
                if (packetIn.func_148993_l() == 60) {
389
                    Entity var13 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
390
391
                    if (var13 instanceof EntityLivingBase && var8 instanceof EntityArrow) {
392
                        ((EntityArrow) var8).shootingEntity = var13;
393
                    }
394
                }
395
396
                ((Entity) var8).setVelocity((double) packetIn.func_149010_g() / 8000.0D, (double) packetIn.func_149004_h() / 8000.0D, (double) packetIn.func_148999_i() / 8000.0D);
397
            }
398
        }
399
    }
400
401
    /**
402
     * Spawns an experience orb and sets its value (amount of XP)
403
     */
404
    public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) {
405
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
406
        EntityXPOrb var2 = new EntityXPOrb(this.clientWorldController, (double) packetIn.func_148984_d(), (double) packetIn.func_148983_e(), (double) packetIn.func_148982_f(), packetIn.func_148986_g());
407
        var2.serverPosX = packetIn.func_148984_d();
408
        var2.serverPosY = packetIn.func_148983_e();
409
        var2.serverPosZ = packetIn.func_148982_f();
410
        var2.rotationYaw = 0.0F;
411
        var2.rotationPitch = 0.0F;
412
        var2.setEntityId(packetIn.func_148985_c());
413
        this.clientWorldController.addEntityToWorld(packetIn.func_148985_c(), var2);
414
    }
415
416
    /**
417
     * Handles globally visible entities. Used in vanilla for lightning bolts
418
     */
419
    public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) {
420
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
421
        double var2 = (double) packetIn.func_149051_d() / 32.0D;
422
        double var4 = (double) packetIn.func_149050_e() / 32.0D;
423
        double var6 = (double) packetIn.func_149049_f() / 32.0D;
424
        EntityLightningBolt var8 = null;
425
426
        if (packetIn.func_149053_g() == 1) {
427
            var8 = new EntityLightningBolt(this.clientWorldController, var2, var4, var6);
428
        }
429
430
        if (var8 != null) {
431
            var8.serverPosX = packetIn.func_149051_d();
432
            var8.serverPosY = packetIn.func_149050_e();
433
            var8.serverPosZ = packetIn.func_149049_f();
434
            var8.rotationYaw = 0.0F;
435
            var8.rotationPitch = 0.0F;
436
            var8.setEntityId(packetIn.func_149052_c());
437
            this.clientWorldController.addWeatherEffect(var8);
438
        }
439
    }
440
441
    /**
442
     * Handles the spawning of a painting object
443
     */
444
    public void handleSpawnPainting(S10PacketSpawnPainting packetIn) {
445
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
446
        EntityPainting var2 = new EntityPainting(this.clientWorldController, packetIn.func_179837_b(), packetIn.func_179836_c(), packetIn.func_148961_h());
447
        this.clientWorldController.addEntityToWorld(packetIn.func_148965_c(), var2);
448
    }
449
450
    /**
451
     * Sets the velocity of the specified entity to the specified value
452
     */
453
    public void handleEntityVelocity(S12PacketEntityVelocity packetIn) {
454
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
455
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.getEntityID());
456
457
        if (var2 != null) {
458
            var2.setVelocity((double) packetIn.getX() / 8000.0D, (double) packetIn.getY() / 8000.0D, (double) packetIn.getZ() / 8000.0D);
459
        }
460
    }
461
462
    /**
463
     * Invoked when the server registers new proximate objects in your watchlist or when objects in your watchlist have
464
     * changed -> Registers any changes locally
465
     */
466
    public void handleEntityMetadata(S1CPacketEntityMetadata packetIn) {
467
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
468
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149375_d());
469
470
        if (var2 != null && packetIn.func_149376_c() != null) {
471
            var2.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c());
472
        }
473
    }
474
475
    /**
476
     * Handles the creation of a nearby player entity, sets the position and held item
477
     */
478
    public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) {
479
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
480
        double var2 = (double) packetIn.func_148942_f() / 32.0D;
481
        double var4 = (double) packetIn.func_148949_g() / 32.0D;
482
        double var6 = (double) packetIn.func_148946_h() / 32.0D;
483
        float var8 = (float) (packetIn.func_148941_i() * 360) / 256.0F;
484
        float var9 = (float) (packetIn.func_148945_j() * 360) / 256.0F;
485
        EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.gameController.theWorld, this.func_175102_a(packetIn.func_179819_c()).getGameProfile());
486
        var10.prevPosX = var10.lastTickPosX = (double) (var10.serverPosX = packetIn.func_148942_f());
487
        var10.prevPosY = var10.lastTickPosY = (double) (var10.serverPosY = packetIn.func_148949_g());
488
        var10.prevPosZ = var10.lastTickPosZ = (double) (var10.serverPosZ = packetIn.func_148946_h());
489
        int var11 = packetIn.func_148947_k();
490
491
        if (var11 == 0) {
492
            var10.inventory.mainInventory[var10.inventory.currentItem] = null;
493
        } else {
494
            var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(Item.getItemById(var11), 1, 0);
495
        }
496
497
        var10.setPositionAndRotation(var2, var4, var6, var8, var9);
498
        this.clientWorldController.addEntityToWorld(packetIn.func_148943_d(), var10);
499
        List var12 = packetIn.func_148944_c();
500
501
        if (var12 != null) {
502
            var10.getDataWatcher().updateWatchedObjectsFromList(var12);
503
        }
504
    }
505
506
    /**
507
     * Updates an entity's position and rotation as specified by the packet
508
     */
509
    public void handleEntityTeleport(S18PacketEntityTeleport packetIn) {
510
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
511
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149451_c());
512
513
        if (var2 != null) {
514
            var2.serverPosX = packetIn.func_149449_d();
515
            var2.serverPosY = packetIn.func_149448_e();
516
            var2.serverPosZ = packetIn.func_149446_f();
517
            double var3 = (double) var2.serverPosX / 32.0D;
518
            double var5 = (double) var2.serverPosY / 32.0D + 0.015625D;
519
            double var7 = (double) var2.serverPosZ / 32.0D;
520
            float var9 = (float) (packetIn.func_149450_g() * 360) / 256.0F;
521
            float var10 = (float) (packetIn.func_149447_h() * 360) / 256.0F;
522
523
            if (Math.abs(var2.posX - var3) < 0.03125D && Math.abs(var2.posY - var5) < 0.015625D && Math.abs(var2.posZ - var7) < 0.03125D) {
524
                var2.func_180426_a(var2.posX, var2.posY, var2.posZ, var9, var10, 3, true);
525
            } else {
526
                var2.func_180426_a(var3, var5, var7, var9, var10, 3, true);
527
            }
528
529
            var2.onGround = packetIn.func_179697_g();
530
        }
531
    }
532
533
    /**
534
     * Updates which hotbar slot of the player is currently selected
535
     */
536
    public void handleHeldItemChange(S09PacketHeldItemChange packetIn) {
537
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
538
539
        if (packetIn.func_149385_c() >= 0 && packetIn.func_149385_c() < InventoryPlayer.getHotbarSize()) {
540
            this.gameController.thePlayer.inventory.currentItem = packetIn.func_149385_c();
541
        }
542
    }
543
544
    /**
545
     * Updates the specified entity's position by the specified relative moment and absolute rotation. Note that
546
     * subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs.
547
     * rotation or both).
548
     */
549
    public void handleEntityMovement(S14PacketEntity packetIn) {
550
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
551
        Entity var2 = packetIn.func_149065_a(this.clientWorldController);
552
553
        if (var2 != null) {
554
            var2.serverPosX += packetIn.func_149062_c();
555
            var2.serverPosY += packetIn.func_149061_d();
556
            var2.serverPosZ += packetIn.func_149064_e();
557
            double var3 = (double) var2.serverPosX / 32.0D;
558
            double var5 = (double) var2.serverPosY / 32.0D;
559
            double var7 = (double) var2.serverPosZ / 32.0D;
560
            float var9 = packetIn.func_149060_h() ? (float) (packetIn.func_149066_f() * 360) / 256.0F : var2.rotationYaw;
561
            float var10 = packetIn.func_149060_h() ? (float) (packetIn.func_149063_g() * 360) / 256.0F : var2.rotationPitch;
562
            var2.func_180426_a(var3, var5, var7, var9, var10, 3, false);
563
            var2.onGround = packetIn.func_179742_g();
564
        }
565
    }
566
567
    /**
568
     * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the
569
     * rotation of the entity itself
570
     */
571
    public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn) {
572
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
573
        Entity var2 = packetIn.func_149381_a(this.clientWorldController);
574
575
        if (var2 != null) {
576
            float var3 = (float) (packetIn.func_149380_c() * 360) / 256.0F;
577
            var2.setRotationYawHead(var3);
578
        }
579
    }
580
581
    /**
582
     * Locally eliminates the entities. Invoked by the server when the items are in fact destroyed, or the player is no
583
     * longer registered as required to monitor them. The latter  happens when distance between the player and item
584
     * increases beyond a certain treshold (typically the viewing distance)
585
     */
586
    public void handleDestroyEntities(S13PacketDestroyEntities packetIn) {
587
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
588
589
        for (int var2 = 0; var2 < packetIn.func_149098_c().length; ++var2) {
590
            this.clientWorldController.removeEntityFromWorld(packetIn.func_149098_c()[var2]);
591
        }
592
    }
593
594
    /**
595
     * Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning,
596
     * mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the
597
     * player positioning
598
     */
599
    public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn) {
600
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
601
        EntityPlayerSP var2 = this.gameController.thePlayer;
602
        double var3 = packetIn.getX();
603
        double var5 = packetIn.getY();
604
        double var7 = packetIn.getZ();
605
        float var9 = packetIn.getYaw();
606
        float var10 = packetIn.getPitch();
607
608
        if (packetIn.getSet().contains(S08PacketPlayerPosLook.EnumFlags.X)) {
609
            var3 += var2.posX;
610
        } else {
611
            var2.motionX = 0.0D;
612
        }
613
614
        if (packetIn.getSet().contains(S08PacketPlayerPosLook.EnumFlags.Y)) {
615
            var5 += var2.posY;
616
        } else {
617
            var2.motionY = 0.0D;
618
        }
619
620
        if (packetIn.getSet().contains(S08PacketPlayerPosLook.EnumFlags.Z)) {
621
            var7 += var2.posZ;
622
        } else {
623
            var2.motionZ = 0.0D;
624
        }
625
626
        if (packetIn.getSet().contains(S08PacketPlayerPosLook.EnumFlags.X_ROT)) {
627
            var10 += var2.rotationPitch;
628
        }
629
630
        if (packetIn.getSet().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) {
631
            var9 += var2.rotationYaw;
632
        }
633
634
        var2.setPositionAndRotation(var3, var5, var7, var9, var10);
635
        this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(var2.posX, var2.getEntityBoundingBox().minY, var2.posZ, var2.rotationYaw, var2.rotationPitch, false));
636
637
        if (!this.doneLoadingTerrain) {
638
            this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
639
            this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
640
            this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
641
            this.doneLoadingTerrain = true;
642
            this.gameController.displayGuiScreen((GuiScreen) null);
643
        }
644
    }
645
646
    /**
647
     * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block
648
     * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends
649
     * S21PacketChunkData
650
     */
651
    public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) {
652
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
653
        S22PacketMultiBlockChange.BlockUpdateData[] var2 = packetIn.func_179844_a();
654
        int var3 = var2.length;
655
656
        for (int var4 = 0; var4 < var3; ++var4) {
657
            S22PacketMultiBlockChange.BlockUpdateData var5 = var2[var4];
658
            this.clientWorldController.func_180503_b(var5.func_180090_a(), var5.func_180088_c());
659
        }
660
    }
661
662
    /**
663
     * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation
664
     */
665
    public void handleChunkData(S21PacketChunkData packetIn) {
666
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
667
668
        if (packetIn.func_149274_i()) {
669
            if (packetIn.func_149276_g() == 0) {
670
                this.clientWorldController.doPreChunk(packetIn.func_149273_e(), packetIn.func_149271_f(), false);
671
                return;
672
            }
673
674
            this.clientWorldController.doPreChunk(packetIn.func_149273_e(), packetIn.func_149271_f(), true);
675
        }
676
677
        this.clientWorldController.invalidateBlockReceiveRegion(packetIn.func_149273_e() << 4, 0, packetIn.func_149271_f() << 4, (packetIn.func_149273_e() << 4) + 15, 256, (packetIn.func_149271_f() << 4) + 15);
678
        Chunk var2 = this.clientWorldController.getChunkFromChunkCoords(packetIn.func_149273_e(), packetIn.func_149271_f());
679
        var2.func_177439_a(packetIn.func_149272_d(), packetIn.func_149276_g(), packetIn.func_149274_i());
680
        this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.func_149273_e() << 4, 0, packetIn.func_149271_f() << 4, (packetIn.func_149273_e() << 4) + 15, 256, (packetIn.func_149271_f() << 4) + 15);
681
682
        if (!packetIn.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) {
683
            var2.resetRelightChecks();
684
        }
685
    }
686
687
    /**
688
     * Updates the block and metadata and generates a blockupdate (and notify the clients)
689
     */
690
    public void handleBlockChange(S23PacketBlockChange packetIn) {
691
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
692
        this.clientWorldController.func_180503_b(packetIn.func_179827_b(), packetIn.func_180728_a());
693
    }
694
695
    /**
696
     * Closes the network channel
697
     */
698
    public void handleDisconnect(S40PacketDisconnect packetIn) {
699
        this.netManager.closeChannel(packetIn.func_149165_c());
700
    }
701
702
    /**
703
     * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
704
     */
705
    public void onDisconnect(IChatComponent reason) {
706
    	String ip = Minecraft.getMinecraft().getCurrentServerData().serverIP;
707
        this.gameController.loadWorld((WorldClient) null);
708
709
        if (this.guiScreenServer != null) {
710
            if (this.guiScreenServer instanceof GuiScreenRealmsProxy) {
711
                this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy) this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy());
712
            } else {
713
            	GuiDisconnected gui = new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason);
714
            	gui.setIp(ip);
715
                this.gameController.displayGuiScreen(gui);
716
            }
717
        } else {
718
        	GuiDisconnected gui = new GuiDisconnected(new GuiMultiplayer(new ClientMainMenu()), "disconnect.lost", reason);
719
        	gui.setIp(ip);
720
            this.gameController.displayGuiScreen(gui);
721
        }
722
    }
723
724
    public void addToSendQueue(Packet p_147297_1_) {
725
        this.netManager.sendPacket(p_147297_1_);
726
    }
727
728
    public void handleCollectItem(S0DPacketCollectItem packetIn) {
729
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
730
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149354_c());
731
        Object var3 = (EntityLivingBase) this.clientWorldController.getEntityByID(packetIn.func_149353_d());
732
733
        if (var3 == null) {
734
            var3 = this.gameController.thePlayer;
735
        }
736
737
        if (var2 != null) {
738
            if (var2 instanceof EntityXPOrb) {
739
                this.clientWorldController.playSoundAtEntity(var2, "random.orb", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
740
            } else {
741
                this.clientWorldController.playSoundAtEntity(var2, "random.pop", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F);
742
            }
743
744
            this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, var2, (Entity) var3, 0.5F));
745
            this.clientWorldController.removeEntityFromWorld(packetIn.func_149354_c());
746
        }
747
    }
748
749
    /**
750
     * Prints a chatmessage in the chat GUI
751
     */
752
    public void handleChat(S02PacketChat packetIn) {
753
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
754
755
        if (packetIn.func_179841_c() == 2) {
756
            this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false);
757
        } else {
758
            this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c());
759
        }
760
    }
761
762
    /**
763
     * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
764
     * or receiving a critical hit by normal or magical means
765
     */
766
    public void handleAnimation(S0BPacketAnimation packetIn) {
767
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
768
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_148978_c());
769
770
        if (var2 != null) {
771
            if (packetIn.func_148977_d() == 0) {
772
                EntityLivingBase var3 = (EntityLivingBase) var2;
773
                var3.swingItem();
774
            } else if (packetIn.func_148977_d() == 1) {
775
                var2.performHurtAnimation();
776
            } else if (packetIn.func_148977_d() == 2) {
777
                EntityPlayer var4 = (EntityPlayer) var2;
778
                var4.wakeUpPlayer(false, false, false);
779
            } else if (packetIn.func_148977_d() == 4) {
780
                this.gameController.effectRenderer.func_178926_a(var2, EnumParticleTypes.CRIT);
781
            } else if (packetIn.func_148977_d() == 5) {
782
                this.gameController.effectRenderer.func_178926_a(var2, EnumParticleTypes.CRIT_MAGIC);
783
            }
784
        }
785
    }
786
787
    /**
788
     * Retrieves the player identified by the packet, puts him to sleep if possible (and flags whether all players are
789
     * asleep)
790
     */
791
    public void handleUseBed(S0APacketUseBed packetIn) {
792
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
793
        packetIn.getPlayer(this.clientWorldController).func_180469_a(packetIn.func_179798_a());
794
    }
795
796
    /**
797
     * Spawns the mob entity at the specified location, with the specified rotation, momentum and type. Updates the
798
     * entities Datawatchers with the entity metadata specified in the packet
799
     */
800
    public void handleSpawnMob(S0FPacketSpawnMob packetIn) {
801
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
802
        double var2 = (double) packetIn.func_149023_f() / 32.0D;
803
        double var4 = (double) packetIn.func_149034_g() / 32.0D;
804
        double var6 = (double) packetIn.func_149029_h() / 32.0D;
805
        float var8 = (float) (packetIn.func_149028_l() * 360) / 256.0F;
806
        float var9 = (float) (packetIn.func_149030_m() * 360) / 256.0F;
807
        EntityLivingBase var10 = (EntityLivingBase) EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld);
808
        var10.serverPosX = packetIn.func_149023_f();
809
        var10.serverPosY = packetIn.func_149034_g();
810
        var10.serverPosZ = packetIn.func_149029_h();
811
        var10.rotationYawHead = (float) (packetIn.func_149032_n() * 360) / 256.0F;
812
        Entity[] var11 = var10.getParts();
813
814
        if (var11 != null) {
815
            int var12 = packetIn.func_149024_d() - var10.getEntityId();
816
817
            for (int var13 = 0; var13 < var11.length; ++var13) {
818
                var11[var13].setEntityId(var11[var13].getEntityId() + var12);
819
            }
820
        }
821
822
        var10.setEntityId(packetIn.func_149024_d());
823
        var10.setPositionAndRotation(var2, var4, var6, var8, var9);
824
        var10.motionX = (double) ((float) packetIn.func_149026_i() / 8000.0F);
825
        var10.motionY = (double) ((float) packetIn.func_149033_j() / 8000.0F);
826
        var10.motionZ = (double) ((float) packetIn.func_149031_k() / 8000.0F);
827
        this.clientWorldController.addEntityToWorld(packetIn.func_149024_d(), var10);
828
        List var14 = packetIn.func_149027_c();
829
830
        if (var14 != null) {
831
            var10.getDataWatcher().updateWatchedObjectsFromList(var14);
832
        }
833
    }
834
835
    public void handleTimeUpdate(S03PacketTimeUpdate packetIn) {
836
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
837
        this.gameController.theWorld.func_82738_a(packetIn.func_149366_c());
838
        this.gameController.theWorld.setWorldTime(packetIn.func_149365_d());
839
    }
840
841
    public void handleSpawnPosition(S05PacketSpawnPosition packetIn) {
842
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
843
        this.gameController.thePlayer.func_180473_a(packetIn.func_179800_a(), true);
844
        this.gameController.theWorld.getWorldInfo().setSpawn(packetIn.func_179800_a());
845
    }
846
847
    public void handleEntityAttach(S1BPacketEntityAttach packetIn) {
848
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
849
        Object var2 = this.clientWorldController.getEntityByID(packetIn.func_149403_d());
850
        Entity var3 = this.clientWorldController.getEntityByID(packetIn.func_149402_e());
851
852
        if (packetIn.func_149404_c() == 0) {
853
            boolean var4 = false;
854
855
            if (packetIn.func_149403_d() == this.gameController.thePlayer.getEntityId()) {
856
                var2 = this.gameController.thePlayer;
857
858
                if (var3 instanceof EntityBoat) {
859
                    ((EntityBoat) var3).setIsBoatEmpty(false);
860
                }
861
862
                var4 = ((Entity) var2).ridingEntity == null && var3 != null;
863
            } else if (var3 instanceof EntityBoat) {
864
                ((EntityBoat) var3).setIsBoatEmpty(true);
865
            }
866
867
            if (var2 == null) {
868
                return;
869
            }
870
871
            ((Entity) var2).mountEntity(var3);
872
873
            if (var4) {
874
                GameSettings var5 = this.gameController.gameSettings;
875
                this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[]{GameSettings.getKeyDisplayString(var5.keyBindSneak.getKeyCode())}), false);
876
            }
877
        } else if (packetIn.func_149404_c() == 1 && var2 instanceof EntityLiving) {
878
            if (var3 != null) {
879
                ((EntityLiving) var2).setLeashedToEntity(var3, false);
880
            } else {
881
                ((EntityLiving) var2).clearLeashed(false, false);
882
            }
883
        }
884
    }
885
886
    /**
887
     * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death),
888
     * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch
889
     * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke
890
     * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...)
891
     */
892
    public void handleEntityStatus(S19PacketEntityStatus packetIn) {
893
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
894
        Entity var2 = packetIn.func_149161_a(this.clientWorldController);
895
896
        if (var2 != null) {
897
            if (packetIn.func_149160_c() == 21) {
898
                this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian) var2));
899
            } else {
900
                var2.handleHealthUpdate(packetIn.func_149160_c());
901
            }
902
        }
903
    }
904
905
    public void handleUpdateHealth(S06PacketUpdateHealth packetIn) {
906
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
907
        this.gameController.thePlayer.setPlayerSPHealth(packetIn.getHealth());
908
        this.gameController.thePlayer.getFoodStats().setFoodLevel(packetIn.getFoodLevel());
909
        this.gameController.thePlayer.getFoodStats().setFoodSaturationLevel(packetIn.getSaturationLevel());
910
    }
911
912
    public void handleSetExperience(S1FPacketSetExperience packetIn) {
913
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
914
        this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.func_149396_d(), packetIn.func_149395_e());
915
    }
916
917
    public void handleRespawn(S07PacketRespawn packetIn) {
918
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
919
920
        if (packetIn.func_149082_c() != this.gameController.thePlayer.dimension) {
921
            this.doneLoadingTerrain = false;
922
            Scoreboard var2 = this.clientWorldController.getScoreboard();
923
            this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.func_149083_e(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.func_149080_f()), packetIn.func_149082_c(), packetIn.func_149081_d(), this.gameController.mcProfiler);
924
            this.clientWorldController.setWorldScoreboard(var2);
925
            this.gameController.loadWorld(this.clientWorldController);
926
            this.gameController.thePlayer.dimension = packetIn.func_149082_c();
927
            this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
928
        }
929
930
        this.gameController.setDimensionAndSpawnPlayer(packetIn.func_149082_c());
931
        this.gameController.playerController.setGameType(packetIn.func_149083_e());
932
    }
933
934
    /**
935
     * Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet.
936
     */
937
    public void handleExplosion(S27PacketExplosion packetIn) {
938
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
939
        Explosion var2 = new Explosion(this.gameController.theWorld, (Entity) null, packetIn.func_149148_f(), packetIn.func_149143_g(), packetIn.func_149145_h(), packetIn.func_149146_i(), packetIn.func_149150_j());
940
        var2.doExplosionB(true);
941
        this.gameController.thePlayer.motionX += (double) packetIn.func_149149_c();
942
        this.gameController.thePlayer.motionY += (double) packetIn.func_149144_d();
943
        this.gameController.thePlayer.motionZ += (double) packetIn.func_149147_e();
944
    }
945
946
    /**
947
     * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table,
948
     * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse
949
     */
950
    public void handleOpenWindow(S2DPacketOpenWindow packetIn) {
951
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
952
        EntityPlayerSP var2 = this.gameController.thePlayer;
953
954
        if ("minecraft:container".equals(packetIn.func_148902_e())) {
955
            var2.displayGUIChest(new InventoryBasic(packetIn.func_179840_c(), packetIn.func_148898_f()));
956
            var2.openContainer.windowId = packetIn.func_148901_c();
957
        } else if ("minecraft:villager".equals(packetIn.func_148902_e())) {
958
            var2.displayVillagerTradeGui(new NpcMerchant(var2, packetIn.func_179840_c()));
959
            var2.openContainer.windowId = packetIn.func_148901_c();
960
        } else if ("EntityHorse".equals(packetIn.func_148902_e())) {
961
            Entity var3 = this.clientWorldController.getEntityByID(packetIn.func_148897_h());
962
963
            if (var3 instanceof EntityHorse) {
964
                var2.displayGUIHorse((EntityHorse) var3, new AnimalChest(packetIn.func_179840_c(), packetIn.func_148898_f()));
965
                var2.openContainer.windowId = packetIn.func_148901_c();
966
            }
967
        } else if (!packetIn.func_148900_g()) {
968
            var2.displayGui(new LocalBlockIntercommunication(packetIn.func_148902_e(), packetIn.func_179840_c()));
969
            var2.openContainer.windowId = packetIn.func_148901_c();
970
        } else {
971
            ContainerLocalMenu var4 = new ContainerLocalMenu(packetIn.func_148902_e(), packetIn.func_179840_c(), packetIn.func_148898_f());
972
            var2.displayGUIChest(var4);
973
            var2.openContainer.windowId = packetIn.func_148901_c();
974
        }
975
    }
976
977
    /**
978
     * Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
979
     */
980
    public void handleSetSlot(S2FPacketSetSlot packetIn) {
981
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
982
        EntityPlayerSP var2 = this.gameController.thePlayer;
983
984
        if (packetIn.func_149175_c() == -1) {
985
            var2.inventory.setItemStack(packetIn.func_149174_e());
986
        } else {
987
            boolean var3 = false;
988
989
            if (this.gameController.currentScreen instanceof GuiContainerCreative) {
990
                GuiContainerCreative var4 = (GuiContainerCreative) this.gameController.currentScreen;
991
                var3 = var4.func_147056_g() != CreativeTabs.tabInventory.getTabIndex();
992
            }
993
994
            if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45) {
995
                ItemStack var5 = var2.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack();
996
997
                if (packetIn.func_149174_e() != null && (var5 == null || var5.stackSize < packetIn.func_149174_e().stackSize)) {
998
                    packetIn.func_149174_e().animationsToGo = 5;
999
                }
1000
1001
                var2.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
1002
            } else if (packetIn.func_149175_c() == var2.openContainer.windowId && (packetIn.func_149175_c() != 0 || !var3)) {
1003
                var2.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
1004
            }
1005
        }
1006
    }
1007
1008
    /**
1009
     * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player
1010
     * and confirms if it is the case.
1011
     */
1012
    public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) {
1013
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1014
        Container var2 = null;
1015
        EntityPlayerSP var3 = this.gameController.thePlayer;
1016
1017
        if (packetIn.func_148889_c() == 0) {
1018
            var2 = var3.inventoryContainer;
1019
        } else if (packetIn.func_148889_c() == var3.openContainer.windowId) {
1020
            var2 = var3.openContainer;
1021
        }
1022
1023
        if (var2 != null && !packetIn.func_148888_e()) {
1024
            this.addToSendQueue(new C0FPacketConfirmTransaction(packetIn.func_148889_c(), packetIn.func_148890_d(), true));
1025
        }
1026
    }
1027
1028
    /**
1029
     * Handles the placement of a specified ItemStack in a specified container/inventory slot
1030
     */
1031
    public void handleWindowItems(S30PacketWindowItems packetIn) {
1032
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1033
        EntityPlayerSP var2 = this.gameController.thePlayer;
1034
1035
        if (packetIn.func_148911_c() == 0) {
1036
            var2.inventoryContainer.putStacksInSlots(packetIn.func_148910_d());
1037
        } else if (packetIn.func_148911_c() == var2.openContainer.windowId) {
1038
            var2.openContainer.putStacksInSlots(packetIn.func_148910_d());
1039
        }
1040
    }
1041
1042
    /**
1043
     * Creates a sign in the specified location if it didn't exist and opens the GUI to edit its text
1044
     */
1045
    public void handleSignEditorOpen(S36PacketSignEditorOpen packetIn) {
1046
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1047
        Object var2 = this.clientWorldController.getTileEntity(packetIn.func_179777_a());
1048
1049
        if (!(var2 instanceof TileEntitySign)) {
1050
            var2 = new TileEntitySign();
1051
            ((TileEntity) var2).setWorldObj(this.clientWorldController);
1052
            ((TileEntity) var2).setPos(packetIn.func_179777_a());
1053
        }
1054
1055
        this.gameController.thePlayer.func_175141_a((TileEntitySign) var2);
1056
    }
1057
1058
    /**
1059
     * Updates a specified sign with the specified text lines
1060
     */
1061
    public void handleUpdateSign(S33PacketUpdateSign packetIn) {
1062
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1063
        boolean var2 = false;
1064
1065
        if (this.gameController.theWorld.isBlockLoaded(packetIn.func_179704_a())) {
1066
            TileEntity var3 = this.gameController.theWorld.getTileEntity(packetIn.func_179704_a());
1067
1068
            if (var3 instanceof TileEntitySign) {
1069
                TileEntitySign var4 = (TileEntitySign) var3;
1070
1071
                if (var4.getIsEditable()) {
1072
                    System.arraycopy(packetIn.func_180753_b(), 0, var4.signText, 0, 4);
1073
                    var4.markDirty();
1074
                }
1075
1076
                var2 = true;
1077
            }
1078
        }
1079
1080
        if (!var2 && this.gameController.thePlayer != null) {
1081
            //this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + packetIn.func_179704_a().getX() + ", " + packetIn.func_179704_a().getY() + ", " + packetIn.func_179704_a().getZ()));
1082
        }
1083
    }
1084
1085
    /**
1086
     * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
1087
     * beacons, skulls, flowerpot
1088
     */
1089
    public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
1090
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1091
1092
        if (this.gameController.theWorld.isBlockLoaded(packetIn.func_179823_a())) {
1093
            TileEntity var2 = this.gameController.theWorld.getTileEntity(packetIn.func_179823_a());
1094
            int var3 = packetIn.getTileEntityType();
1095
1096
            if (var3 == 1 && var2 instanceof TileEntityMobSpawner || var3 == 2 && var2 instanceof TileEntityCommandBlock || var3 == 3 && var2 instanceof TileEntityBeacon || var3 == 4 && var2 instanceof TileEntitySkull || var3 == 5 && var2 instanceof TileEntityFlowerPot || var3 == 6 && var2 instanceof TileEntityBanner) {
1097
                var2.readFromNBT(packetIn.getNbtCompound());
1098
            }
1099
        }
1100
    }
1101
1102
    /**
1103
     * Sets the progressbar of the opened window to the specified value
1104
     */
1105
    public void handleWindowProperty(S31PacketWindowProperty packetIn) {
1106
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1107
        EntityPlayerSP var2 = this.gameController.thePlayer;
1108
1109
        if (var2.openContainer != null && var2.openContainer.windowId == packetIn.func_149182_c()) {
1110
            var2.openContainer.updateProgressBar(packetIn.func_149181_d(), packetIn.func_149180_e());
1111
        }
1112
    }
1113
1114
    public void handleEntityEquipment(S04PacketEntityEquipment packetIn) {
1115
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1116
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149389_d());
1117
1118
        if (var2 != null) {
1119
            var2.setCurrentItemOrArmor(packetIn.func_149388_e(), packetIn.func_149390_c());
1120
        }
1121
    }
1122
1123
    /**
1124
     * Resets the ItemStack held in hand and closes the window that is opened
1125
     */
1126
    public void handleCloseWindow(S2EPacketCloseWindow packetIn) {
1127
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1128
        this.gameController.thePlayer.func_175159_q();
1129
    }
1130
1131
    /**
1132
     * Triggers Block.onBlockEventReceived, which is implemented in BlockPistonBase for extension/retraction, BlockNote
1133
     * for setting the instrument (including audiovisual feedback) and in BlockContainer to set the number of players
1134
     * accessing a (Ender)Chest
1135
     */
1136
    public void handleBlockAction(S24PacketBlockAction packetIn) {
1137
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1138
        this.gameController.theWorld.addBlockEvent(packetIn.func_179825_a(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2());
1139
    }
1140
1141
    /**
1142
     * Updates all registered IWorldAccess instances with destroyBlockInWorldPartially
1143
     */
1144
    public void handleBlockBreakAnim(S25PacketBlockBreakAnim packetIn) {
1145
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1146
        this.gameController.theWorld.sendBlockBreakProgress(packetIn.func_148845_c(), packetIn.func_179821_b(), packetIn.func_148846_g());
1147
    }
1148
1149
    public void handleMapChunkBulk(S26PacketMapChunkBulk packetIn) {
1150
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1151
1152
        for (int var2 = 0; var2 < packetIn.func_149254_d(); ++var2) {
1153
            int var3 = packetIn.func_149255_a(var2);
1154
            int var4 = packetIn.func_149253_b(var2);
1155
            this.clientWorldController.doPreChunk(var3, var4, true);
1156
            this.clientWorldController.invalidateBlockReceiveRegion(var3 << 4, 0, var4 << 4, (var3 << 4) + 15, 256, (var4 << 4) + 15);
1157
            Chunk var5 = this.clientWorldController.getChunkFromChunkCoords(var3, var4);
1158
            var5.func_177439_a(packetIn.func_149256_c(var2), packetIn.func_179754_d(var2), true);
1159
            this.clientWorldController.markBlockRangeForRenderUpdate(var3 << 4, 0, var4 << 4, (var3 << 4) + 15, 256, (var4 << 4) + 15);
1160
1161
            if (!(this.clientWorldController.provider instanceof WorldProviderSurface)) {
1162
                var5.resetRelightChecks();
1163
            }
1164
        }
1165
    }
1166
1167
    public void handleChangeGameState(S2BPacketChangeGameState packetIn) {
1168
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1169
        EntityPlayerSP var2 = this.gameController.thePlayer;
1170
        int var3 = packetIn.func_149138_c();
1171
        float var4 = packetIn.func_149137_d();
1172
        int var5 = MathHelper.floor_float(var4 + 0.5F);
1173
1174
        if (var3 >= 0 && var3 < S2BPacketChangeGameState.MESSAGE_NAMES.length && S2BPacketChangeGameState.MESSAGE_NAMES[var3] != null) {
1175
            var2.addChatComponentMessage(new ChatComponentTranslation(S2BPacketChangeGameState.MESSAGE_NAMES[var3], new Object[0]));
1176
        }
1177
1178
        if (var3 == 1) {
1179
            this.clientWorldController.getWorldInfo().setRaining(true);
1180
            this.clientWorldController.setRainStrength(0.0F);
1181
        } else if (var3 == 2) {
1182
            this.clientWorldController.getWorldInfo().setRaining(false);
1183
            this.clientWorldController.setRainStrength(1.0F);
1184
        } else if (var3 == 3) {
1185
            this.gameController.playerController.setGameType(WorldSettings.GameType.getByID(var5));
1186
        } else if (var3 == 4) {
1187
            this.gameController.displayGuiScreen(new GuiWinGame());
1188
        } else if (var3 == 5) {
1189
            GameSettings var6 = this.gameController.gameSettings;
1190
1191
            if (var4 == 0.0F) {
1192
                this.gameController.displayGuiScreen(new GuiScreenDemo());
1193
            } else if (var4 == 101.0F) {
1194
                this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.movement", new Object[]{GameSettings.getKeyDisplayString(var6.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(var6.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(var6.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(var6.keyBindRight.getKeyCode())}));
1195
            } else if (var4 == 102.0F) {
1196
                this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.jump", new Object[]{GameSettings.getKeyDisplayString(var6.keyBindJump.getKeyCode())}));
1197
            } else if (var4 == 103.0F) {
1198
                this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.inventory", new Object[]{GameSettings.getKeyDisplayString(var6.keyBindInventory.getKeyCode())}));
1199
            }
1200
        } else if (var3 == 6) {
1201
            this.clientWorldController.playSound(var2.posX, var2.posY + (double) var2.getEyeHeight(), var2.posZ, "random.successful_hit", 0.18F, 0.45F, false);
1202
        } else if (var3 == 7) {
1203
            this.clientWorldController.setRainStrength(var4);
1204
        } else if (var3 == 8) {
1205
            this.clientWorldController.setThunderStrength(var4);
1206
        } else if (var3 == 10) {
1207
            this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, var2.posX, var2.posY, var2.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
1208
            this.clientWorldController.playSound(var2.posX, var2.posY, var2.posZ, "mob.guardian.curse", 1.0F, 1.0F, false);
1209
        }
1210
    }
1211
1212
    /**
1213
     * Updates the worlds MapStorage with the specified MapData for the specified map-identifier and invokes a
1214
     * MapItemRenderer for it
1215
     */
1216
    public void handleMaps(S34PacketMaps packetIn) {
1217
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1218
        MapData var2 = ItemMap.loadMapData(packetIn.getMapId(), this.gameController.theWorld);
1219
        packetIn.func_179734_a(var2);
1220
        this.gameController.entityRenderer.getMapItemRenderer().func_148246_a(var2);
1221
    }
1222
1223
    public void handleEffect(S28PacketEffect packetIn) {
1224
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1225
1226
        if (packetIn.isSoundServerwide()) {
1227
            this.gameController.theWorld.func_175669_a(packetIn.getSoundType(), packetIn.func_179746_d(), packetIn.getSoundData());
1228
        } else {
1229
            this.gameController.theWorld.playAuxSFX(packetIn.getSoundType(), packetIn.func_179746_d(), packetIn.getSoundData());
1230
        }
1231
    }
1232
1233
    /**
1234
     * Updates the players statistics or achievements
1235
     */
1236
    public void handleStatistics(S37PacketStatistics packetIn) {
1237
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1238
        boolean var2 = false;
1239
        StatBase var5;
1240
        int var6;
1241
1242
        for (Iterator var3 = packetIn.func_148974_c().entrySet().iterator(); var3.hasNext(); this.gameController.thePlayer.getStatFileWriter().func_150873_a(this.gameController.thePlayer, var5, var6)) {
1243
            Entry var4 = (Entry) var3.next();
1244
            var5 = (StatBase) var4.getKey();
1245
            var6 = ((Integer) var4.getValue()).intValue();
1246
1247
            if (var5.isAchievement() && var6 > 0) {
1248
                if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().writeStat(var5) == 0) {
1249
                    Achievement var7 = (Achievement) var5;
1250
                    this.gameController.guiAchievement.displayAchievement(var7);
1251
                    this.gameController.getTwitchStream().func_152911_a(new MetadataAchievement(var7), 0L);
1252
1253
                    if (var5 == AchievementList.openInventory) {
1254
                        this.gameController.gameSettings.showInventoryAchievementHint = false;
1255
                        this.gameController.gameSettings.saveOptions();
1256
                    }
1257
                }
1258
1259
                var2 = true;
1260
            }
1261
        }
1262
1263
        if (!this.field_147308_k && !var2 && this.gameController.gameSettings.showInventoryAchievementHint) {
1264
            this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.openInventory);
1265
        }
1266
1267
        this.field_147308_k = true;
1268
1269
        if (this.gameController.currentScreen instanceof IProgressMeter) {
1270
            ((IProgressMeter) this.gameController.currentScreen).doneLoading();
1271
        }
1272
    }
1273
1274
    public void handleEntityEffect(S1DPacketEntityEffect packetIn) {
1275
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1276
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149426_d());
1277
1278
        if (var2 instanceof EntityLivingBase) {
1279
            PotionEffect var3 = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f());
1280
            var3.setPotionDurationMax(packetIn.func_149429_c());
1281
            ((EntityLivingBase) var2).addPotionEffect(var3);
1282
        }
1283
    }
1284
1285
    public void func_175098_a(S42PacketCombatEvent p_175098_1_) {
1286
        PacketThreadUtil.func_180031_a(p_175098_1_, this, this.gameController);
1287
        Entity var2 = this.clientWorldController.getEntityByID(p_175098_1_.field_179775_c);
1288
        EntityLivingBase var3 = var2 instanceof EntityLivingBase ? (EntityLivingBase) var2 : null;
1289
1290
        if (p_175098_1_.field_179776_a == S42PacketCombatEvent.Event.END_COMBAT) {
1291
            long var4 = (long) (1000 * p_175098_1_.field_179772_d / 20);
1292
            MetadataCombat var6 = new MetadataCombat(this.gameController.thePlayer, var3);
1293
            this.gameController.getTwitchStream().func_176026_a(var6, 0L - var4, 0L);
1294
        } else if (p_175098_1_.field_179776_a == S42PacketCombatEvent.Event.ENTITY_DIED) {
1295
            Entity var7 = this.clientWorldController.getEntityByID(p_175098_1_.field_179774_b);
1296
1297
            if (var7 instanceof EntityPlayer) {
1298
                MetadataPlayerDeath var5 = new MetadataPlayerDeath((EntityPlayer) var7, var3);
1299
                var5.func_152807_a(p_175098_1_.field_179773_e);
1300
                this.gameController.getTwitchStream().func_152911_a(var5, 0L);
1301
            }
1302
        }
1303
    }
1304
1305
    public void func_175101_a(S41PacketServerDifficulty p_175101_1_) {
1306
        PacketThreadUtil.func_180031_a(p_175101_1_, this, this.gameController);
1307
        this.gameController.theWorld.getWorldInfo().setDifficulty(p_175101_1_.func_179831_b());
1308
        this.gameController.theWorld.getWorldInfo().setDifficultyLocked(p_175101_1_.func_179830_a());
1309
    }
1310
1311
    public void func_175094_a(S43PacketCamera p_175094_1_) {
1312
        PacketThreadUtil.func_180031_a(p_175094_1_, this, this.gameController);
1313
        Entity var2 = p_175094_1_.func_179780_a(this.clientWorldController);
1314
1315
        if (var2 != null) {
1316
            this.gameController.func_175607_a(var2);
1317
        }
1318
    }
1319
1320
    public void func_175093_a(S44PacketWorldBorder p_175093_1_) {
1321
        PacketThreadUtil.func_180031_a(p_175093_1_, this, this.gameController);
1322
        p_175093_1_.func_179788_a(this.clientWorldController.getWorldBorder());
1323
    }
1324
1325
    public void func_175099_a(S45PacketTitle p_175099_1_) {
1326
        PacketThreadUtil.func_180031_a(p_175099_1_, this, this.gameController);
1327
        S45PacketTitle.Type var2 = p_175099_1_.func_179807_a();
1328
        String var3 = null;
1329
        String var4 = null;
1330
        String var5 = p_175099_1_.func_179805_b() != null ? p_175099_1_.func_179805_b().getFormattedText() : "";
1331
1332
        switch (NetHandlerPlayClient.SwitchAction.field_178885_a[var2.ordinal()]) {
1333
            case 1:
1334
                var3 = var5;
1335
                break;
1336
1337
            case 2:
1338
                var4 = var5;
1339
                break;
1340
1341
            case 3:
1342
                this.gameController.ingameGUI.func_175178_a("", "", -1, -1, -1);
1343
                this.gameController.ingameGUI.func_175177_a();
1344
                return;
1345
        }
1346
1347
        this.gameController.ingameGUI.func_175178_a(var3, var4, p_175099_1_.func_179806_c(), p_175099_1_.func_179804_d(), p_175099_1_.func_179803_e());
1348
    }
1349
1350
    public void func_175100_a(S46PacketSetCompressionLevel p_175100_1_) {
1351
        if (!this.netManager.isLocalChannel()) {
1352
            this.netManager.setCompressionTreshold(p_175100_1_.func_179760_a());
1353
        }
1354
    }
1355
1356
    public void func_175096_a(S47PacketPlayerListHeaderFooter p_175096_1_) {
1357
        this.gameController.ingameGUI.getTabList().setHeader(p_175096_1_.func_179700_a().getFormattedText().length() == 0 ? null : p_175096_1_.func_179700_a());
1358
        this.gameController.ingameGUI.getTabList().setFooter(p_175096_1_.func_179701_b().getFormattedText().length() == 0 ? null : p_175096_1_.func_179701_b());
1359
    }
1360
1361
    public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn) {
1362
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1363
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149076_c());
1364
1365
        if (var2 instanceof EntityLivingBase) {
1366
            ((EntityLivingBase) var2).removePotionEffectClient(packetIn.func_149075_d());
1367
        }
1368
    }
1369
1370
    public void handlePlayerListItem(S38PacketPlayerListItem packetIn) {
1371
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1372
        Iterator var2 = packetIn.func_179767_a().iterator();
1373
1374
        while (var2.hasNext()) {
1375
            S38PacketPlayerListItem.AddPlayerData var3 = (S38PacketPlayerListItem.AddPlayerData) var2.next();
1376
1377
            if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {
1378
                this.playerInfoMap.remove(var3.func_179962_a().getId());
1379
            } else {
1380
                NetworkPlayerInfo var4 = (NetworkPlayerInfo) this.playerInfoMap.get(var3.func_179962_a().getId());
1381
1382
                if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) {
1383
                    var4 = new NetworkPlayerInfo(var3);
1384
                    this.playerInfoMap.put(var4.getGameProfile().getId(), var4);
1385
                }
1386
1387
                if (var4 != null) {
1388
                    switch (NetHandlerPlayClient.SwitchAction.field_178884_b[packetIn.func_179768_b().ordinal()]) {
1389
                        case 1:
1390
                            var4.setGameType(var3.func_179960_c());
1391
                            var4.setResponseTime(var3.func_179963_b());
1392
                            break;
1393
1394
                        case 2:
1395
                            var4.setGameType(var3.func_179960_c());
1396
                            break;
1397
1398
                        case 3:
1399
                            var4.setResponseTime(var3.func_179963_b());
1400
                            break;
1401
1402
                        case 4:
1403
                            var4.setDisplayName(var3.func_179961_d());
1404
                    }
1405
                }
1406
            }
1407
        }
1408
    }
1409
1410
    public void handleKeepAlive(S00PacketKeepAlive packetIn) {
1411
        this.addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c()));
1412
    }
1413
1414
    public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn) {
1415
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1416
        EntityPlayerSP var2 = this.gameController.thePlayer;
1417
        var2.capabilities.isFlying = packetIn.isFlying();
1418
        var2.capabilities.isCreativeMode = packetIn.isCreativeMode();
1419
        var2.capabilities.disableDamage = packetIn.isInvulnerable();
1420
        var2.capabilities.allowFlying = packetIn.isAllowFlying();
1421
        var2.capabilities.setFlySpeed(packetIn.getFlySpeed());
1422
        var2.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed());
1423
    }
1424
1425
    /**
1426
     * Displays the available command-completion options the server knows of
1427
     */
1428
    public void handleTabComplete(S3APacketTabComplete packetIn) {
1429
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1430
        String[] var2 = packetIn.func_149630_c();
1431
1432
        if (this.gameController.currentScreen instanceof GuiChat) {
1433
            GuiChat var3 = (GuiChat) this.gameController.currentScreen;
1434
            var3.onAutocompleteResponse(var2);
1435
        }
1436
    }
1437
1438
    public void handleSoundEffect(S29PacketSoundEffect packetIn) {
1439
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1440
        this.gameController.theWorld.playSound(packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getName(), packetIn.func_149208_g(), packetIn.func_149209_h(), false);
1441
    }
1442
1443
    public void func_175095_a(S48PacketResourcePackSend p_175095_1_) {
1444
        final String var2 = p_175095_1_.func_179783_a();
1445
        final String var3 = p_175095_1_.func_179784_b();
1446
1447
        if (var2.startsWith("level://")) {
1448
            String var4 = var2.substring("level://".length());
1449
            File var5 = new File(this.gameController.mcDataDir, "saves");
1450
            File var6 = new File(var5, var4);
1451
1452
            if (var6.isFile()) {
1453
                this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.ACCEPTED));
1454
                Futures.addCallback(this.gameController.getResourcePackRepository().func_177319_a(var6), new FutureCallback() {
1455
                    private static final String __OBFID = "CL_00000879";
1456
1457
                    public void onSuccess(Object p_onSuccess_1_) {
1458
                        NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED));
1459
                    }
1460
1461
                    public void onFailure(Throwable p_onFailure_1_) {
1462
                        NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
1463
                    }
1464
                });
1465
            } else {
1466
                this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
1467
            }
1468
        } else {
1469
            if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().getResourceMode() == ServerData.ServerResourceMode.ENABLED) {
1470
                this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.ACCEPTED));
1471
                Futures.addCallback(this.gameController.getResourcePackRepository().func_180601_a(var2, var3), new FutureCallback() {
1472
                    private static final String __OBFID = "CL_00002624";
1473
1474
                    public void onSuccess(Object p_onSuccess_1_) {
1475
                        NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED));
1476
                    }
1477
1478
                    public void onFailure(Throwable p_onFailure_1_) {
1479
                        NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
1480
                    }
1481
                });
1482
            } else if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().getResourceMode() != ServerData.ServerResourceMode.PROMPT) {
1483
                this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.DECLINED));
1484
            } else {
1485
                this.gameController.addScheduledTask(new Runnable() {
1486
                    private static final String __OBFID = "CL_00002623";
1487
1488
                    public void run() {
1489
                        NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() {
1490
                            private static final String __OBFID = "CL_00002622";
1491
1492
                            public void confirmClicked(boolean result, int id) {
1493
                                NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft();
1494
1495
                                if (result) {
1496
                                    if (NetHandlerPlayClient.this.gameController.getCurrentServerData() != null) {
1497
                                        NetHandlerPlayClient.this.gameController.getCurrentServerData().setResourceMode(ServerData.ServerResourceMode.ENABLED);
1498
                                    }
1499
1500
                                    NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.ACCEPTED));
1501
                                    Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().func_180601_a(var2, var3), new FutureCallback() {
1502
                                        private static final String __OBFID = "CL_00002621";
1503
1504
                                        public void onSuccess(Object p_onSuccess_1_) {
1505
                                            NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED));
1506
                                        }
1507
1508
                                        public void onFailure(Throwable p_onFailure_1_) {
1509
                                            NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD));
1510
                                        }
1511
                                    });
1512
                                } else {
1513
                                    if (NetHandlerPlayClient.this.gameController.getCurrentServerData() != null) {
1514
                                        NetHandlerPlayClient.this.gameController.getCurrentServerData().setResourceMode(ServerData.ServerResourceMode.DISABLED);
1515
                                    }
1516
1517
                                    NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(var3, C19PacketResourcePackStatus.Action.DECLINED));
1518
                                }
1519
1520
                                ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.getCurrentServerData());
1521
                                NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen) null);
1522
                            }
1523
                        }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0));
1524
                    }
1525
                });
1526
            }
1527
        }
1528
    }
1529
1530
    public void func_175097_a(S49PacketUpdateEntityNBT p_175097_1_) {
1531
        PacketThreadUtil.func_180031_a(p_175097_1_, this, this.gameController);
1532
        Entity var2 = p_175097_1_.func_179764_a(this.clientWorldController);
1533
1534
        if (var2 != null) {
1535
            var2.func_174834_g(p_175097_1_.func_179763_a());
1536
        }
1537
    }
1538
1539
    /**
1540
     * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
1541
     * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
1542
     * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
1543
     * resourcepack for the client to load.
1544
     */
1545
    public void handleCustomPayload(S3FPacketCustomPayload packetIn) {
1546
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1547
1548
        if ("MC|TrList".equals(packetIn.getChannelName())) {
1549
            PacketBuffer var2 = packetIn.getBufferData();
1550
1551
            try {
1552
                int var3 = var2.readInt();
1553
                GuiScreen var4 = this.gameController.currentScreen;
1554
1555
                if (var4 != null && var4 instanceof GuiMerchant && var3 == this.gameController.thePlayer.openContainer.windowId) {
1556
                    IMerchant var5 = ((GuiMerchant) var4).getMerchant();
1557
                    MerchantRecipeList var6 = MerchantRecipeList.func_151390_b(var2);
1558
                    var5.setRecipes(var6);
1559
                }
1560
            } catch (IOException var10) {
1561
                logger.error("Couldn\'t load trade info", var10);
1562
            } finally {
1563
                var2.release();
1564
            }
1565
        } else if ("MC|Brand".equals(packetIn.getChannelName())) {
1566
            this.gameController.thePlayer.func_175158_f(packetIn.getBufferData().readStringFromBuffer(32767));
1567
        } else if ("MC|BOpen".equals(packetIn.getChannelName())) {
1568
            ItemStack var12 = this.gameController.thePlayer.getCurrentEquippedItem();
1569
1570
            if (var12 != null && var12.getItem() == Items.written_book) {
1571
                this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, var12, false));
1572
            }
1573
        }
1574
    }
1575
1576
    /**
1577
     * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname
1578
     */
1579
    public void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn) {
1580
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1581
        Scoreboard var2 = this.clientWorldController.getScoreboard();
1582
        ScoreObjective var3;
1583
1584
        if (packetIn.func_149338_e() == 0) {
1585
            var3 = var2.addScoreObjective(packetIn.func_149339_c(), IScoreObjectiveCriteria.DUMMY);
1586
            var3.setDisplayName(packetIn.func_149337_d());
1587
            var3.func_178767_a(packetIn.func_179817_d());
1588
        } else {
1589
            var3 = var2.getObjective(packetIn.func_149339_c());
1590
1591
            if (packetIn.func_149338_e() == 1) {
1592
                var2.func_96519_k(var3);
1593
            } else if (packetIn.func_149338_e() == 2) {
1594
                var3.setDisplayName(packetIn.func_149337_d());
1595
                var3.func_178767_a(packetIn.func_179817_d());
1596
            }
1597
        }
1598
    }
1599
1600
    /**
1601
     * Either updates the score with a specified value or removes the score for an objective
1602
     */
1603
    public void handleUpdateScore(S3CPacketUpdateScore packetIn) {
1604
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1605
        Scoreboard var2 = this.clientWorldController.getScoreboard();
1606
        ScoreObjective var3 = var2.getObjective(packetIn.func_149321_d());
1607
1608
        if (packetIn.func_180751_d() == S3CPacketUpdateScore.Action.CHANGE) {
1609
            Score var4 = var2.getValueFromObjective(packetIn.func_149324_c(), var3);
1610
            var4.setScorePoints(packetIn.func_149323_e());
1611
        } else if (packetIn.func_180751_d() == S3CPacketUpdateScore.Action.REMOVE) {
1612
            if (StringUtils.isNullOrEmpty(packetIn.func_149321_d())) {
1613
                var2.func_178822_d(packetIn.func_149324_c(), (ScoreObjective) null);
1614
            } else if (var3 != null) {
1615
                var2.func_178822_d(packetIn.func_149324_c(), var3);
1616
            }
1617
        }
1618
    }
1619
1620
    /**
1621
     * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below
1622
     * name)
1623
     */
1624
    public void handleDisplayScoreboard(S3DPacketDisplayScoreboard packetIn) {
1625
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1626
        Scoreboard var2 = this.clientWorldController.getScoreboard();
1627
1628
        if (packetIn.func_149370_d().length() == 0) {
1629
            var2.setObjectiveInDisplaySlot(packetIn.func_149371_c(), (ScoreObjective) null);
1630
        } else {
1631
            ScoreObjective var3 = var2.getObjective(packetIn.func_149370_d());
1632
            var2.setObjectiveInDisplaySlot(packetIn.func_149371_c(), var3);
1633
        }
1634
    }
1635
1636
    /**
1637
     * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team-
1638
     * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled
1639
     */
1640
    public void handleTeams(S3EPacketTeams packetIn) {
1641
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1642
        Scoreboard var2 = this.clientWorldController.getScoreboard();
1643
        ScorePlayerTeam var3;
1644
1645
        if (packetIn.func_149307_h() == 0) {
1646
            var3 = var2.createTeam(packetIn.func_149312_c());
1647
        } else {
1648
            var3 = var2.getTeam(packetIn.func_149312_c());
1649
        }
1650
1651
        if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2) {
1652
            var3.setTeamName(packetIn.func_149306_d());
1653
            var3.setNamePrefix(packetIn.func_149311_e());
1654
            var3.setNameSuffix(packetIn.func_149309_f());
1655
            var3.func_178774_a(EnumChatFormatting.func_175744_a(packetIn.func_179813_h()));
1656
            var3.func_98298_a(packetIn.func_149308_i());
1657
            Team.EnumVisible var4 = Team.EnumVisible.func_178824_a(packetIn.func_179814_i());
1658
1659
            if (var4 != null) {
1660
                var3.func_178772_a(var4);
1661
            }
1662
        }
1663
1664
        String var5;
1665
        Iterator var6;
1666
1667
        if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3) {
1668
            var6 = packetIn.func_149310_g().iterator();
1669
1670
            while (var6.hasNext()) {
1671
                var5 = (String) var6.next();
1672
                var2.func_151392_a(var5, packetIn.func_149312_c());
1673
            }
1674
        }
1675
1676
        if (packetIn.func_149307_h() == 4) {
1677
            var6 = packetIn.func_149310_g().iterator();
1678
1679
            while (var6.hasNext()) {
1680
                var5 = (String) var6.next();
1681
                var2.removePlayerFromTeam(var5, var3);
1682
            }
1683
        }
1684
1685
        if (packetIn.func_149307_h() == 1) {
1686
            var2.removeTeam(var3);
1687
        }
1688
    }
1689
1690
    /**
1691
     * Spawns a specified number of particles at the specified location with a randomized displacement according to
1692
     * specified bounds
1693
     */
1694
    public void handleParticles(S2APacketParticles packetIn) {
1695
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1696
1697
        if (packetIn.func_149222_k() == 0) {
1698
            double var2 = (double) (packetIn.func_149227_j() * packetIn.func_149221_g());
1699
            double var4 = (double) (packetIn.func_149227_j() * packetIn.func_149224_h());
1700
            double var6 = (double) (packetIn.func_149227_j() * packetIn.func_149223_i());
1701
1702
            try {
1703
                this.clientWorldController.spawnParticle(packetIn.func_179749_a(), packetIn.func_179750_b(), packetIn.func_149220_d(), packetIn.func_149226_e(), packetIn.func_149225_f(), var2, var4, var6, packetIn.func_179748_k());
1704
            } catch (Throwable var17) {
1705
                logger.warn("Could not spawn particle effect " + packetIn.func_179749_a());
1706
            }
1707
        } else {
1708
            for (int var18 = 0; var18 < packetIn.func_149222_k(); ++var18) {
1709
                double var3 = this.avRandomizer.nextGaussian() * (double) packetIn.func_149221_g();
1710
                double var5 = this.avRandomizer.nextGaussian() * (double) packetIn.func_149224_h();
1711
                double var7 = this.avRandomizer.nextGaussian() * (double) packetIn.func_149223_i();
1712
                double var9 = this.avRandomizer.nextGaussian() * (double) packetIn.func_149227_j();
1713
                double var11 = this.avRandomizer.nextGaussian() * (double) packetIn.func_149227_j();
1714
                double var13 = this.avRandomizer.nextGaussian() * (double) packetIn.func_149227_j();
1715
1716
                try {
1717
                    this.clientWorldController.spawnParticle(packetIn.func_179749_a(), packetIn.func_179750_b(), packetIn.func_149220_d() + var3, packetIn.func_149226_e() + var5, packetIn.func_149225_f() + var7, var9, var11, var13, packetIn.func_179748_k());
1718
                } catch (Throwable var16) {
1719
                    logger.warn("Could not spawn particle effect " + packetIn.func_179749_a());
1720
                    return;
1721
                }
1722
            }
1723
        }
1724
    }
1725
1726
    /**
1727
     * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
1728
     * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
1729
     * maxHealth and knockback resistance as well as reinforcement spawning chance.
1730
     */
1731
    public void handleEntityProperties(S20PacketEntityProperties packetIn) {
1732
        PacketThreadUtil.func_180031_a(packetIn, this, this.gameController);
1733
        Entity var2 = this.clientWorldController.getEntityByID(packetIn.func_149442_c());
1734
1735
        if (var2 != null) {
1736
            if (!(var2 instanceof EntityLivingBase)) {
1737
                throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + var2 + ")");
1738
            } else {
1739
                BaseAttributeMap var3 = ((EntityLivingBase) var2).getAttributeMap();
1740
                Iterator var4 = packetIn.func_149441_d().iterator();
1741
1742
                while (var4.hasNext()) {
1743
                    S20PacketEntityProperties.Snapshot var5 = (S20PacketEntityProperties.Snapshot) var4.next();
1744
                    IAttributeInstance var6 = var3.getAttributeInstanceByName(var5.func_151409_a());
1745
1746
                    if (var6 == null) {
1747
                        var6 = var3.registerAttribute(new RangedAttribute((IAttribute) null, var5.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
1748
                    }
1749
1750
                    var6.setBaseValue(var5.func_151410_b());
1751
                    var6.removeAllModifiers();
1752
                    Iterator var7 = var5.func_151408_c().iterator();
1753
1754
                    while (var7.hasNext()) {
1755
                        AttributeModifier var8 = (AttributeModifier) var7.next();
1756
                        var6.applyModifier(var8);
1757
                    }
1758
                }
1759
            }
1760
        }
1761
    }
1762
1763
    /**
1764
     * Returns this the NetworkManager instance registered with this NetworkHandlerPlayClient
1765
     */
1766
    public NetworkManager getNetworkManager() {
1767
        return this.netManager;
1768
    }
1769
1770
    public Collection func_175106_d() {
1771
        return this.playerInfoMap.values();
1772
    }
1773
1774
    public NetworkPlayerInfo func_175102_a(UUID p_175102_1_) {
1775
        return (NetworkPlayerInfo) this.playerInfoMap.get(p_175102_1_);
1776
    }
1777
1778
    public NetworkPlayerInfo func_175104_a(String p_175104_1_) {
1779
        Iterator var2 = this.playerInfoMap.values().iterator();
1780
        NetworkPlayerInfo var3;
1781
1782
        do {
1783
            if (!var2.hasNext()) {
1784
                return null;
1785
            }
1786
1787
            var3 = (NetworkPlayerInfo) var2.next();
1788
        }
1789
        while (!var3.getGameProfile().getName().equals(p_175104_1_));
1790
1791
        return var3;
1792
    }
1793
1794
    public GameProfile func_175105_e() {
1795
        return this.field_175107_d;
1796
    }
1797
1798
    static final class SwitchAction {
1799
        static final int[] field_178885_a;
1800
1801
        static final int[] field_178884_b = new int[S38PacketPlayerListItem.Action.values().length];
1802
        private static final String __OBFID = "CL_00002620";
1803
1804
        static {
1805
            try {
1806
                field_178884_b[S38PacketPlayerListItem.Action.ADD_PLAYER.ordinal()] = 1;
1807
            } catch (NoSuchFieldError var7) {
1808
                ;
1809
            }
1810
1811
            try {
1812
                field_178884_b[S38PacketPlayerListItem.Action.UPDATE_GAME_MODE.ordinal()] = 2;
1813
            } catch (NoSuchFieldError var6) {
1814
                ;
1815
            }
1816
1817
            try {
1818
                field_178884_b[S38PacketPlayerListItem.Action.UPDATE_LATENCY.ordinal()] = 3;
1819
            } catch (NoSuchFieldError var5) {
1820
                ;
1821
            }
1822
1823
            try {
1824
                field_178884_b[S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME.ordinal()] = 4;
1825
            } catch (NoSuchFieldError var4) {
1826
                ;
1827
            }
1828
1829
            field_178885_a = new int[S45PacketTitle.Type.values().length];
1830
1831
            try {
1832
                field_178885_a[S45PacketTitle.Type.TITLE.ordinal()] = 1;
1833
            } catch (NoSuchFieldError var3) {
1834
                ;
1835
            }
1836
1837
            try {
1838
                field_178885_a[S45PacketTitle.Type.SUBTITLE.ordinal()] = 2;
1839
            } catch (NoSuchFieldError var2) {
1840
                ;
1841
            }
1842
1843
            try {
1844
                field_178885_a[S45PacketTitle.Type.RESET.ordinal()] = 3;
1845
            } catch (NoSuchFieldError var1) {
1846
                ;
1847
            }
1848
        }
1849
    }
1850
}

What this file does

handlePlayerPosLook (line 599) is the consumer that NoRotate pre-empts. It resolves the target position from packetIn.getX()/getY()/getZ(), honoring the relative X/Y/Z flags by adding them onto the current position (lines 608-624) and zeroing the matching motion components for absolute flags, then resolves the rotation the same way for X_ROT/Y_ROT (lines 626-632), calls setPositionAndRotation with the final values (line 634), and immediately replies with C06PacketPlayerPosLook carrying the client's own position, yaw, pitch and onGround false (line 635). Because NoRotate already replaced yaw and pitch before this method ran, the angles fed to setPositionAndRotation and echoed in the C06 are the client's own, while the position keeps the server's correction. The file also shows the intended vanilla behavior the module defeats: a stock client would apply the S08 angles and echo them back, closing the rotation loop.

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 WrongTurn (pitch bounds)

WrongTurn.java49 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.net;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.checks.Check;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
22
/**
23
 * The WrongTurn check will detect players who send improbable rotations 
24
 */
25
public class WrongTurn extends Check {
26
    
27
    public WrongTurn() {
28
        super(CheckType.NET_WRONGTURN);
29
    }
30
31
    /**
32
     * Checks a player
33
     * @param player
34
     * @param pitch
35
     * @param data
36
     * @param cc
37
     * @return true if successful.
38
     * 
39
     */
40
    public boolean check(final Player player, final float pitch, final NetData data, final NetConfig cc) {
41
        boolean cancel = false;
42
        // Currently, only impossible pitch is detected, later, we might throw in actual pattern-based checks.
43
        if (pitch > 90.0 || pitch < -90.0) {
44
            data.wrongTurnVL++;
45
            cancel = executeActions(player, data.wrongTurnVL, 1, cc.wrongTurnActions).willCancel();
46
        }
47
        return cancel;
48
    }
49
}

How it counteracts this module

WrongTurn is NCP's entire rotation check, and its own doc comment admits the scope: 'Currently, only impossible pitch is detected, later, we might throw in actual pattern-based checks.' It fires only when the reported pitch is above 90 or below -90, incrementing wrongTurnVL and executing the configured actions. It never compares a reported rotation against a rotation the server previously sent, and it never inspects S08 packets at all.

NoRotate is invisible to it by construction: the module rewrites the S08's angles to the client's own rotation, and a legitimate client's pitch is always inside [-90, 90], so the check's sole predicate can never be satisfied by anything the module produces. The C06 echo it would need to inspect travels through the movement listeners, not this check. This entry documents that NCP's rotation layer is pitch-bounds only, which is why the module survives NCP untouched.

anticheat InvalidPitch (pitch bounds)

InvalidPitch.java42 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.movement.look;
20
21
import me.islandscout.hawk.check.MovementCheck;
22
import me.islandscout.hawk.event.MoveEvent;
23
24
//Not really an important check. This just stops skids from thinking they're so cool.
25
public class InvalidPitch extends MovementCheck {
26
27
    //PASSED (9/11/18)
28
29
    public InvalidPitch() {
30
        super("invalidpitch", "%player% failed invalid pitch. VL: %vl%");
31
    }
32
33
    @Override
34
    protected void check(MoveEvent event) {
35
        if (!event.hasDeltaRot())
36
            return;
37
        if (Math.abs(event.getTo().getPitch()) > 90)
38
            punishAndTryRubberband(event.getHawkPlayer(), event);
39
        else
40
            reward(event.getHawkPlayer());
41
    }
42
}

How it counteracts this module

Hawk's InvalidPitch is the same shape as NCP's WrongTurn: on any move that carries a rotation delta it punishes and rubber-bands a player whose absolute pitch exceeds 90, and rewards otherwise. The check's own comment calls it 'Not really an important check', noting it just stops players from abusing impossible look angles.

NoRotate cannot trip it. The rewritten S08 is consumed locally and never re-reported as a pitch value; the client's own pitch is what flows into the move events, and that pitch is always within the legal range by construction. Like WrongTurn, this is a bounds check on reported rotation, not a compliance check against server-issued rotations, so the module's substitution leaves no trace in the data the check reads. The entry is the second half of the same observation: both major anticheats police only the pitch envelope, and neither models teleport-rotation convergence.

anticheat AimbotConvergence (look-target heuristic)

AimbotConvergence.java84 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.movement.look;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.CustomCheck;
23
import me.islandscout.hawk.event.Event;
24
import me.islandscout.hawk.event.MoveEvent;
25
import me.islandscout.hawk.util.*;
26
import org.bukkit.entity.Player;
27
import org.bukkit.util.Vector;
28
29
import java.util.*;
30
31
public class AimbotConvergence extends CustomCheck {
32
33
    //You better turn off your aimbot when your opponent is standing still!
34
    //Flags basic aimbots that update rotation before motion updates
35
36
    private Map<UUID, Vector> lastConvergencePointMap;
37
38
    public AimbotConvergence() {
39
        super("aimbotconvergence", true, -1, 5, 0.999, 5000, "%player% failed aimbot (convergence), VL: %vl%", null);
40
        this.lastConvergencePointMap = new HashMap<>();
41
    }
42
43
    @Override
44
    protected void check(Event event) {
45
        if(event instanceof MoveEvent) {
46
            MoveEvent e = (MoveEvent) event;
47
            HawkPlayer pp = e.getHawkPlayer();
48
            if(!e.hasDeltaPos())
49
                return;
50
            UUID uuid = pp.getUuid();
51
            Vector prePos = e.getFrom().toVector().clone().subtract(pp.getVelocity()).add(new Vector(0, 1.62, 0));
52
            Vector postPos = e.getFrom().toVector().add(new Vector(0, 1.62, 0));
53
            Vector preDir = e.getFrom().getDirection();
54
            Vector postDir = e.getTo().getDirection();
55
            Pair<Vector, Vector> points = new Ray(prePos, preDir).closestPointsBetweenLines(new Ray(postPos, postDir));
56
57
            Vector lastConvergence = lastConvergencePointMap.get(uuid);
58
            Vector convergence = points.getKey().add(points.getValue()).multiply(0.5);
59
60
            if(lastConvergence != null &&
61
                    //make sure TPs don't false this check
62
                    pp.getCurrentTick() - pp.getLastTeleportAcceptTick() > ServerUtils.getPing(e.getPlayer()) / 50 + 10 &&
63
                    pp.getCurrentTick() > 100) {
64
65
                double distance = lastConvergence.distanceSquared(convergence);
66
                if(!Double.isNaN(distance)) {
67
68
                    if(distance < 0.00000001) //TODO convergence point should be some distance away from head position to filter some falses
69
                        punish(pp, false, e);
70
                    else
71
                        reward(pp);
72
73
                }
74
            }
75
76
            lastConvergencePointMap.put(uuid, convergence);
77
        }
78
    }
79
80
    @Override
81
    public void removeData(Player p) {
82
        lastConvergencePointMap.remove(p.getUniqueId());
83
    }
84
}

How it counteracts this module

AimbotConvergence is Hawk's closest thing to a rotation-pattern check, and it is aimed at a different target entirely. It tracks the point a player's look direction converges on over successive moves and punishes convergence that is too stable or too perfect, the signature of an aim-assist that snaps to a target and stays glued. The check runs on move events and compares computed convergence points across a window.

NoRotate's mutation happens inside the S08 handler, before any move event, and the module does not touch the player's look at all: rotationYaw and rotationPitch are read, not written. The convergence heuristic therefore sees exactly the same input stream as it would from a vanilla client - the difference the module makes is that the client's rotation never receives the server's teleport angles, which is not a pattern AimbotConvergence looks for. The entry stands as the representative of Hawk's look suite: all of it targets aim behavior, none of it validates S08 rotation compliance.

anticheat Arc v2 (no clientbound consumer)

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 PacketListener is the complete list of packets the anticheat observes, and it is entirely serverbound. startListening registers ProtocolLib adapters for Play.Client.FLYING, POSITION and POSITION_LOOK (the movement layer), USE_ENTITY (fight data and KillAura), ARM_ANIMATION (swing timing), HELD_ITEM_SLOT (soup switching) and BLOCK_PLACE (the soup auto-heal branch). There is no Play.Server adapter of any kind: no S08, no teleport tracking, no rotation bookkeeping.

The consequence is total invisibility. Arc v2 never sees the S08 the module rewrites, never sees the C06 echo's rotation, and has no data structure that could hold a server-issued rotation to compare against. Its movement checks (Speed, Flight, MorePackets, NoFall) consume only the serverbound position stream, where the module's effect - an unchanged rotation echo - is indistinguishable from a vanilla client that happens to look the same way. This entry closes the gap: of the three anticheats, Arc v2 has the least surface for NoRotate, which is to say none.

← Back to Analysis Hub