gt:         double d2 = packetIn.getZ();
context: package net.minecraft.client.network;
  
  import com.google.common.collect.Maps;
  import com.google.common.util.concurrent.FutureCallback;
  import com.google.common.util.concurrent.Futures;
  import com.mojang.authlib.GameProfile;
  import io.netty.buffer.Unpooled;
  import java.io.File;
  import java.io.IOException;
  import java.net.URI;
  import java.net.URISyntaxException;
  import java.util.Collection;
  import java.util.List;
  import java.util.Map;
  import java.util.Random;
  import java.util.UUID;
  import java.util.Map.Entry;
  import net.minecraft.block.Block;
  import net.minecraft.client.ClientBrandRetriever;
  import net.minecraft.client.Minecraft;
  import net.minecraft.client.audio.GuardianSound;
  import net.minecraft.client.audio.ISound;
  import net.minecraft.client.audio.PositionedSoundRecord;
  import net.minecraft.client.entity.EntityOtherPlayerMP;
  import net.minecraft.client.entity.EntityPlayerSP;
  import net.minecraft.client.gui.GuiCommandBlock;
  import net.minecraft.client.gui.GuiDisconnected;
  import net.minecraft.client.gui.GuiDownloadTerrain;
  import net.minecraft.client.gui.GuiGameOver;
  import net.minecraft.client.gui.GuiMainMenu;
  import net.minecraft.client.gui.GuiMerchant;
  import net.minecraft.client.gui.GuiMultiplayer;
  import net.minecraft.client.gui.GuiScreen;
  import net.minecraft.client.gui.GuiScreenBook;
  import net.minecraft.client.gui.GuiScreenDemo;
  import net.minecraft.client.gui.GuiScreenRealmsProxy;
  import net.minecraft.client.gui.GuiWinGame;
  import net.minecraft.client.gui.GuiYesNo;
  import net.minecraft.client.gui.GuiYesNoCallback;
  import net.minecraft.client.gui.IProgressMeter;
  import net.minecraft.client.gui.inventory.GuiContainerCreative;
  import net.minecraft.client.multiplayer.PlayerControllerMP;
  import net.minecraft.client.multiplayer.ServerData;
  import net.minecraft.client.multiplayer.ServerList;
  import net.minecraft.client.multiplayer.WorldClient;
  import net.minecraft.client.particle.EntityPickupFX;
  import net.minecraft.client.player.inventory.ContainerLocalMenu;
  import net.minecraft.client.player.inventory.LocalBlockIntercommunication;
  import net.minecraft.client.resources.I18n;
  import net.minecraft.client.settings.GameSettings;
  import net.minecraft.creativetab.CreativeTabs;
  import net.minecraft.entity.Entity;
  import net.minecraft.entity.EntityAreaEffectCloud;
  import net.minecraft.entity.EntityLeashKnot;
  import net.minecraft.entity.EntityList;
  import net.minecraft.entity.EntityLiving;
  import net.minecraft.entity.EntityLivingBase;
  import net.minecraft.entity.EntityTracker;
  import net.minecraft.entity.IMerchant;
  import net.minecraft.entity.NpcMerchant;
  import net.minecraft.entity.ai.attributes.AbstractAttributeMap;
  import net.minecraft.entity.ai.attributes.AttributeModifier;
  import net.minecraft.entity.ai.attributes.IAttribute;
  import net.minecraft.entity.ai.attributes.IAttributeInstance;
  import net.minecraft.entity.ai.attributes.RangedAttribute;
  import net.minecraft.entity.effect.EntityLightningBolt;
  import net.minecraft.entity.item.EntityArmorStand;
  import net.minecraft.entity.item.EntityBoat;
  import net.minecraft.entity.item.EntityEnderCrystal;
  import net.minecraft.entity.item.EntityEnderEye;
  import net.minecraft.entity.item.EntityEnderPearl;
  import net.minecraft.entity.item.EntityExpBottle;
  import net.minecraft.entity.item.EntityFallingBlock;
  import net.minecraft.entity.item.EntityFireworkRocket;
  import net.minecraft.entity.item.EntityItem;
  import net.minecraft.entity.item.EntityItemFrame;
  import net.minecraft.entity.item.EntityMinecart;
  import net.minecraft.entity.item.EntityPainting;
  import net.minecraft.entity.item.EntityTNTPrimed;
  import net.minecraft.entity.item.EntityXPOrb;
  import net.minecraft.entity.monster.EntityGuardian;
  import net.minecraft.entity.passive.EntityHorse;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.entity.player.InventoryPlayer;
  import net.minecraft.entity.projectile.EntityArrow;
  import net.minecraft.entity.projectile.EntityDragonFireball;
  import net.minecraft.entity.projectile.EntityEgg;
  import net.minecraft.entity.projectile.EntityFishHook;
  import net.minecraft.entity.projectile.EntityLargeFireball;
  import net.minecraft.entity.projectile.EntityPotion;
  import net.minecraft.entity.projectile.EntityShulkerBullet;
  import net.minecraft.entity.projectile.EntitySmallFireball;
  import net.minecraft.entity.projectile.EntitySnowball;
  import net.minecraft.entity.projectile.EntitySpectralArrow;
  import net.minecraft.entity.projectile.EntityTippedArrow;
  import net.minecraft.entity.projectile.EntityWitherSkull;
  import net.minecraft.init.Items;
  import net.minecraft.init.SoundEvents;
  import net.minecraft.inventory.AnimalChest;
  import net.minecraft.inventory.Container;
  import net.minecraft.inventory.InventoryBasic;
  import net.minecraft.item.ItemMap;
  import net.minecraft.item.ItemStack;
  import net.minecraft.network.NetworkManager;
  import net.minecraft.network.Packet;
  import net.minecraft.network.PacketBuffer;
  import net.minecraft.network.PacketThreadUtil;
  import net.minecraft.network.datasync.EntityDataManager;
  import net.minecraft.network.play.INetHandlerPlayClient;
  import net.minecraft.network.play.client.CPacketClientStatus;
  import net.minecraft.network.play.client.CPacketConfirmTeleport;
  import net.minecraft.network.play.client.CPacketConfirmTransaction;
  import net.minecraft.network.play.client.CPacketCustomPayload;
  import net.minecraft.network.play.client.CPacketKeepAlive;
  import net.minecraft.network.play.client.CPacketPlayer;
  import net.minecraft.network.play.client.CPacketResourcePackStatus;
  import net.minecraft.network.play.client.CPacketVehicleMove;
  import net.minecraft.network.play.server.SPacketAnimation;
  import net.minecraft.network.play.server.SPacketBlockAction;
  import net.minecraft.network.play.server.SPacketBlockBreakAnim;
  import net.minecraft.network.play.server.SPacketBlockChange;
  import net.minecraft.network.play.server.SPacketCamera;
  import net.minecraft.network.play.server.SPacketChangeGameState;
  import net.minecraft.network.play.server.SPacketChat;
  import net.minecraft.network.play.server.SPacketChunkData;
  import net.minecraft.network.play.server.SPacketCloseWindow;
  import net.minecraft.network.play.server.SPacketCollectItem;
  import net.minecraft.network.play.server.SPacketCombatEvent;
  import net.minecraft.network.play.server.SPacketConfirmTransaction;
  import net.minecraft.network.play.server.SPacketCooldown;
  import net.minecraft.network.play.server.SPacketCustomPayload;
  import net.minecraft.network.play.server.SPacketCustomSound;
  import net.minecraft.network.play.server.SPacketDestroyEntities;
  import net.minecraft.network.play.server.SPacketDisconnect;
  import net.minecraft.network.play.server.SPacketDisplayObjective;
  import net.minecraft.network.play.server.SPacketEffect;
  import net.minecraft.network.play.server.SPacketEntity;
  import net.minecraft.network.play.server.SPacketEntityAttach;
  import net.minecraft.network.play.server.SPacketEntityEffect;
  import net.minecraft.network.play.server.SPacketEntityEquipment;
  import net.minecraft.network.play.server.SPacketEntityHeadLook;
  import net.minecraft.network.play.server.SPacketEntityMetadata;
  import net.minecraft.network.play.server.SPacketEntityProperties;
  import net.minecraft.network.play.server.SPacketEntityStatus;
  import net.minecraft.network.play.server.SPacketEntityTeleport;
  import net.minecraft.network.play.server.SPacketEntityVelocity;
  import net.minecraft.network.play.server.SPacketExplosion;
  import net.minecraft.network.play.server.SPacketHeldItemChange;
  import net.minecraft.network.play.server.SPacketJoinGame;
  import net.minecraft.network.play.server.SPacketKeepAlive;
  import net.minecraft.network.play.server.SPacketMaps;
  import net.minecraft.network.play.server.SPacketMoveVehicle;
  import net.minecraft.network.play.server.SPacketMultiBlockChange;
  import net.minecraft.network.play.server.SPacketOpenWindow;
  import net.minecraft.network.play.server.SPacketParticles;
  import net.minecraft.network.play.server.SPacketPlayerAbilities;
  import net.minecraft.network.play.server.SPacketPlayerListHeaderFooter;
  import net.minecraft.network.play.server.SPacketPlayerListItem;
  import net.minecraft.network.play.server.SPacketPlayerPosLook;
  import net.minecraft.network.play.server.SPacketRemoveEntityEffect;
  import net.minecraft.network.play.server.SPacketResourcePackSend;
  import net.minecraft.network.play.server.SPacketRespawn;
  import net.minecraft.network.play.server.SPacketScoreboardObjective;
  import net.minecraft.network.play.server.SPacketServerDifficulty;
  import net.minecraft.network.play.server.SPacketSetExperience;
  import net.minecraft.network.play.server.SPacketSetPassengers;
  import net.minecraft.network.play.server.SPacketSetSlot;
  import net.minecraft.network.play.server.SPacketSignEditorOpen;
  import net.minecraft.network.play.server.SPacketSoundEffect;
  import net.minecraft.network.play.server.SPacketSpawnExperienceOrb;
  import net.minecraft.network.play.server.SPacketSpawnGlobalEntity;
  import net.minecraft.network.play.server.SPacketSpawnMob;
  import net.minecraft.network.play.server.SPacketSpawnObject;
  import net.minecraft.network.play.server.SPacketSpawnPainting;
  import net.minecraft.network.play.server.SPacketSpawnPlayer;
  import net.minecraft.network.play.server.SPacketSpawnPosition;
  import net.minecraft.network.play.server.SPacketStatistics;
  import net.minecraft.network.play.server.SPacketTabComplete;
  import net.minecraft.network.play.server.SPacketTeams;
  import net.minecraft.network.play.server.SPacketTimeUpdate;
  import net.minecraft.network.play.server.SPacketTitle;
  import net.minecraft.network.play.server.SPacketUnloadChunk;
  import net.minecraft.network.play.server.SPacketUpdateEntityNBT;
  import net.minecraft.network.play.server.SPacketUpdateHealth;
  import net.minecraft.network.play.server.SPacketUpdateScore;
  import net.minecraft.network.play.server.SPacketUpdateSign;
  import net.minecraft.network.play.server.SPacketUpdateTileEntity;
  import net.minecraft.network.play.server.SPacketUseBed;
  import net.minecraft.network.play.server.SPacketWindowItems;
  import net.minecraft.network.play.server.SPacketWindowProperty;
  import net.minecraft.network.play.server.SPacketWorldBorder;
  import net.minecraft.pathfinding.PathEntity;
  import net.minecraft.potion.Potion;
  import net.minecraft.potion.PotionEffect;
  import net.minecraft.realms.DisconnectedRealmsScreen;
  import net.minecraft.scoreboard.IScoreCriteria;
  import net.minecraft.scoreboard.Score;
  import net.minecraft.scoreboard.ScoreObjective;
  import net.minecraft.scoreboard.ScorePlayerTeam;
  import net.minecraft.scoreboard.Scoreboard;
  import net.minecraft.scoreboard.Team;
  import net.minecraft.stats.Achievement;
  import net.minecraft.stats.AchievementList;
  import net.minecraft.stats.StatBase;
  import net.minecraft.tileentity.TileEntity;
  import net.minecraft.tileentity.TileEntityBanner;
  import net.minecraft.tileentity.TileEntityBeacon;
  import net.minecraft.tileentity.TileEntityCommandBlock;
  import net.minecraft.tileentity.TileEntityEndGateway;
  import net.minecraft.tileentity.TileEntityFlowerPot;
  import net.minecraft.tileentity.TileEntityMobSpawner;
  import net.minecraft.tileentity.TileEntitySign;
  import net.minecraft.tileentity.TileEntitySkull;
  import net.minecraft.tileentity.TileEntityStructure;
  import net.minecraft.util.EnumFacing;
  import net.minecraft.util.EnumHand;
  import net.minecraft.util.EnumParticleTypes;
  import net.minecraft.util.ITabCompleter;
  import net.minecraft.util.ResourceLocation;
  import net.minecraft.util.SoundCategory;
  import net.minecraft.util.StringUtils;
  import net.minecraft.util.math.BlockPos;
  import net.minecraft.util.math.MathHelper;
  import net.minecraft.util.text.ITextComponent;
  import net.minecraft.util.text.TextComponentTranslation;
  import net.minecraft.util.text.TextFormatting;
  import net.minecraft.village.MerchantRecipeList;
  import net.minecraft.world.Explosion;
  import net.minecraft.world.WorldProviderSurface;
  import net.minecraft.world.WorldSettings;
  import net.minecraft.world.chunk.Chunk;
  import net.minecraft.world.storage.MapData;
  import net.minecraftforge.fml.relauncher.Side;
  import net.minecraftforge.fml.relauncher.SideOnly;
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  @SideOnly(Side.CLIENT)
  public class NetHandlerPlayClient implements INetHandlerPlayClient
  {
      private static final Logger logger = LogManager.getLogger();
      /**
       * The NetworkManager instance used to communicate with the server (used only by handlePlayerPosLook to update
       * positioning and handleJoinGame to inform the server of the client distribution/mods)
       */
      private final NetworkManager netManager;
      private final GameProfile profile;
      /**
       * Seems to be either null (integrated server) or an instance of either GuiMultiplayer (when connecting to a server)
       * or GuiScreenReamlsTOS (when connecting to MCO server)
       */
      private final GuiScreen guiScreenServer;
      /** Reference to the Minecraft instance, which many handler methods operate on */
      private Minecraft gameController;
      /** Reference to the current ClientWorld instance, which many handler methods operate on */
      private WorldClient clientWorldController;
      /**
       * True if the client has finished downloading terrain and may spawn. Set upon receipt of S08PacketPlayerPosLook,
       * reset upon respawning
       */
      private boolean doneLoadingTerrain;
      private final Map<UUID, NetworkPlayerInfo> playerInfoMap = Maps.<UUID, NetworkPlayerInfo>newHashMap();
      public int currentServerMaxPlayers = 20;
      private boolean hasStatistics = false;
      /**
       * Just an ordinary random number generator, used to randomize audio pitch of item/orb pickup and randomize both
       * particlespawn offset and velocity
       */
      private final Random avRandomizer = new Random();
  
      public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager networkManagerIn, GameProfile profileIn)
      {
          this.gameController = mcIn;
          this.guiScreenServer = p_i46300_2_;
          this.netManager = networkManagerIn;
          this.profile = profileIn;
      }
  
      /**
       * Clears the WorldClient instance associated with this NetHandlerPlayClient
       */
      public void cleanup()
      {
          this.clientWorldController = null;
      }
  
      /**
       * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new
       * WorldClient and sets the player initial dimension
       */
      public void handleJoinGame(SPacketJoinGame packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
          this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler);
          this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
          this.gameController.loadWorld(this.clientWorldController);
          this.gameController.thePlayer.dimension = packetIn.getDimension();
          this.gameController.displayGuiScreen(new GuiDownloadTerrain(this));
          this.gameController.thePlayer.setEntityId(packetIn.getPlayerId());
          this.currentServerMaxPlayers = packetIn.getMaxPlayers();
          this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
          this.gameController.playerController.setGameType(packetIn.getGameType());
          this.gameController.gameSettings.sendSettingsToServer();
          this.netManager.sendPacket(new CPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
      }
  
      /**
       * Spawns an instance of the objecttype indicated by the packet and sets its position and momentum
       */
      public void handleSpawnObject(SPacketSpawnObject packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          double d0 = packetIn.getX();
          double d1 = packetIn.getY();
          double d2 = packetIn.getZ();
          Entity entity = null;
  
          if (packetIn.getType() == 10)
          {
              entity = EntityMinecart.func_184263_a(this.clientWorldController, d0, d1, d2, EntityMinecart.Type.getById(packetIn.getData()));
          }
          else if (packetIn.getType() == 90)
          {
              Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getData());
  
              if (entity1 instanceof EntityPlayer)
              {
                  entity = new EntityFishHook(this.clientWorldController, d0, d1, d2, (EntityPlayer)entity1);
              }
  
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 60)
          {
              entity = new EntityTippedArrow(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 91)
          {
              entity = new EntitySpectralArrow(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 61)
          {
              entity = new EntitySnowball(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 71)
          {
              entity = new EntityItemFrame(this.clientWorldController, new BlockPos(d0, d1, d2), EnumFacing.getHorizontal(packetIn.getData()));
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 77)
          {
              entity = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)));
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 65)
          {
              entity = new EntityEnderPearl(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 72)
          {
              entity = new EntityEnderEye(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 76)
          {
              entity = new EntityFireworkRocket(this.clientWorldController, d0, d1, d2, (ItemStack)null);
          }
          else if (packetIn.getType() == 63)
          {
              entity = new EntityLargeFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 93)
          {
              entity = new EntityDragonFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 64)
          {
              entity = new EntitySmallFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 66)
          {
              entity = new EntityWitherSkull(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 67)
          {
              entity = new EntityShulkerBullet(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 62)
          {
              entity = new EntityEgg(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 73)
          {
              entity = new EntityPotion(this.clientWorldController, d0, d1, d2, (ItemStack)null);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 75)
          {
              entity = new EntityExpBottle(this.clientWorldController, d0, d1, d2);
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 1)
          {
              entity = new EntityBoat(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 50)
          {
              entity = new EntityTNTPrimed(this.clientWorldController, d0, d1, d2, (EntityLivingBase)null);
          }
          else if (packetIn.getType() == 78)
          {
              entity = new EntityArmorStand(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 51)
          {
              entity = new EntityEnderCrystal(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 2)
          {
              entity = new EntityItem(this.clientWorldController, d0, d1, d2);
          }
          else if (packetIn.getType() == 70)
          {
              entity = new EntityFallingBlock(this.clientWorldController, d0, d1, d2, Block.getStateById(packetIn.getData() & 65535));
              packetIn.setData(0);
          }
          else if (packetIn.getType() == 3)
          {
              entity = new EntityAreaEffectCloud(this.clientWorldController, d0, d1, d2);
          }
  
          if (entity != null)
          {
              EntityTracker.func_187254_a(entity, d0, d1, d2);
              entity.rotationPitch = (float)(packetIn.getPitch() * 360) / 256.0F;
              entity.rotationYaw = (float)(packetIn.getYaw() * 360) / 256.0F;
              Entity[] aentity = entity.getParts();
  
              if (aentity != null)
              {
                  int i = packetIn.getEntityID() - entity.getEntityId();
  
                  for (int j = 0; j < aentity.length; ++j)
                  {
                      aentity[j].setEntityId(aentity[j].getEntityId() + i);
                  }
              }
  
              entity.setEntityId(packetIn.getEntityID());
              entity.setUniqueId(packetIn.getUniqueId());
              this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
  
              if (packetIn.getData() > 0)
              {
                  if (packetIn.getType() == 60 || packetIn.getType() == 91)
                  {
                      Entity entity2 = this.clientWorldController.getEntityByID(packetIn.getData() - 1);
  
                      if (entity2 instanceof EntityLivingBase && entity instanceof EntityArrow)
                      {
                          ((EntityArrow)entity).shootingEntity = entity2;
                      }
                  }
  
                  entity.setVelocity((double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D);
              }
          }
      }
  
      /**
       * Spawns an experience orb and sets its value (amount of XP)
       */
      public void handleSpawnExperienceOrb(SPacketSpawnExperienceOrb packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          double d0 = packetIn.getX();
          double d1 = packetIn.getY();
          double d2 = packetIn.getZ();
          Entity entity = new EntityXPOrb(this.clientWorldController, d0, d1, d2, packetIn.getXPValue());
          EntityTracker.func_187254_a(entity, d0, d1, d2);
          entity.rotationYaw = 0.0F;
          entity.rotationPitch = 0.0F;
          entity.setEntityId(packetIn.getEntityID());
          this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
      }
  
      /**
       * Handles globally visible entities. Used in vanilla for lightning bolts
       */
      public void handleSpawnGlobalEntity(SPacketSpawnGlobalEntity packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          double d0 = packetIn.getX();
          double d1 = packetIn.getY();
          double d2 = packetIn.getZ();
          Entity entity = null;
  
          if (packetIn.getType() == 1)
          {
              entity = new EntityLightningBolt(this.clientWorldController, d0, d1, d2, false);
          }
  
          if (entity != null)
          {
              EntityTracker.func_187254_a(entity, d0, d1, d2);
              entity.rotationYaw = 0.0F;
              entity.rotationPitch = 0.0F;
              entity.setEntityId(packetIn.getEntityId());
              this.clientWorldController.addWeatherEffect(entity);
          }
      }
  
      /**
       * Handles the spawning of a painting object
       */
      public void handleSpawnPainting(SPacketSpawnPainting packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle());
          entitypainting.setUniqueId(packetIn.getUniqueId());
          this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting);
      }
  
      /**
       * Sets the velocity of the specified entity to the specified value
       */
      public void handleEntityVelocity(SPacketEntityVelocity packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
  
          if (entity != null)
          {
              entity.setVelocity((double)packetIn.getMotionX() / 8000.0D, (double)packetIn.getMotionY() / 8000.0D, (double)packetIn.getMotionZ() / 8000.0D);
          }
      }
  
      /**
       * Invoked when the server registers new proximate objects in your watchlist or when objects in your watchlist have
       * changed -> Registers any changes locally
       */
      public void handleEntityMetadata(SPacketEntityMetadata packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
  
          if (entity != null && packetIn.getDataManagerEntries() != null)
          {
              entity.getDataManager().setEntryValues(packetIn.getDataManagerEntries());
          }
      }
  
      /**
       * Handles the creation of a nearby player entity, sets the position and held item
       */
      public void handleSpawnPlayer(SPacketSpawnPlayer packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          double d0 = packetIn.getX();
          double d1 = packetIn.getY();
          double d2 = packetIn.getZ();
          float f = (float)(packetIn.getYaw() * 360) / 256.0F;
          float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
          EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getPlayer()).getGameProfile());
          entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = d0;
          entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = d1;
          entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = d2;
          EntityTracker.func_187254_a(entityotherplayermp, d0, d1, d2);
          entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1);
          this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp);
          List < EntityDataManager.DataEntry<? >> list = packetIn.getDataManagerEntries();
  
          if (list != null)
          {
              entityotherplayermp.getDataManager().setEntryValues(list);
          }
      }
  
      /**
       * Updates an entity's position and rotation as specified by the packet
       */
      public void handleEntityTeleport(SPacketEntityTeleport packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
  
          if (entity != null)
          {
              double d0 = packetIn.getX();
              double d1 = packetIn.getY();
              double d2 = packetIn.getZ();
              EntityTracker.func_187254_a(entity, d0, d1, d2);
  
              if (!entity.canPassengerSteer())
              {
                  float f = (float)(packetIn.getYaw() * 360) / 256.0F;
                  float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
  
                  if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
                  {
                      entity.setPositionAndRotation2(entity.posX, entity.posY, entity.posZ, f, f1, 0, true);
                  }
                  else
                  {
                      entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, true);
                  }
  
                  entity.onGround = packetIn.getOnGround();
              }
          }
      }
  
      /**
       * Updates which hotbar slot of the player is currently selected
       */
      public void handleHeldItemChange(SPacketHeldItemChange packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
  
          if (InventoryPlayer.isHotbar(packetIn.getHeldItemHotbarIndex()))
          {
              this.gameController.thePlayer.inventory.currentItem = packetIn.getHeldItemHotbarIndex();
          }
      }
  
      /**
       * Updates the specified entity's position by the specified relative moment and absolute rotation. Note that
       * subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs.
       * rotation or both).
       */
      public void handleEntityMovement(SPacketEntity packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          Entity entity = packetIn.getEntity(this.clientWorldController);
  
          if (entity != null)
          {
              entity.serverPosX += (long)packetIn.func_186952_a();
              entity.serverPosY += (long)packetIn.func_186953_b();
              entity.serverPosZ += (long)packetIn.func_186951_c();
              double d0 = (double)entity.serverPosX / 4096.0D;
              double d1 = (double)entity.serverPosY / 4096.0D;
              double d2 = (double)entity.serverPosZ / 4096.0D;
  
              if (!entity.canPassengerSteer())
              {
                  float f = packetIn.func_149060_h() ? (float)(packetIn.func_149066_f() * 360) / 256.0F : entity.rotationYaw;
                  float f1 = packetIn.func_149060_h() ? (float)(packetIn.func_149063_g() * 360) / 256.0F : entity.rotationPitch;
                  entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false);
                  entity.onGround = packetIn.getOnGround();
              }
          }
      }
  
      /**
       * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the
       * rotation of the entity itself
       */
      public void handleEntityHeadLook(SPacketEntityHeadLook packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          Entity entity = packetIn.getEntity(this.clientWorldController);
  
          if (entity != null)
          {
              float f = (float)(packetIn.getYaw() * 360) / 256.0F;
              entity.setRotationYawHead(f);
          }
      }
  
      /**
       * Locally eliminates the entities. Invoked by the server when the items are in fact destroyed, or the player is no
       * longer registered as required to monitor them. The latter  happens when distance between the player and item
       * increases beyond a certain treshold (typically the viewing distance)
       */
      public void handleDestroyEntities(SPacketDestroyEntities packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
  
          for (int i = 0; i < packetIn.getEntityIDs().length; ++i)
          {
              this.clientWorldController.removeEntityFromWorld(packetIn.getEntityIDs()[i]);
          }
      }
  
      public void handlePlayerPosLook(SPacketPlayerPosLook packetIn)
      {
          PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
          EntityPlayer entityplayer = this.gameController.thePlayer;
          double d0 = packetIn.getX();
          double d1 = packetIn.getY();
  