gt:                         for (int var10 = 0; var10 < 5; ++var10)
context: package net.minecraft.src;
  
  import java.util.*;
  
  public class EntityTrackerEntry
  {
      /** The entity that this EntityTrackerEntry tracks. */
      public Entity trackedEntity;
      public int trackingDistanceThreshold;
  
      /** check for sync when ticks % updateFrequency==0 */
      public int updateFrequency;
  
      /** The encoded entity X position. */
      public int encodedPosX;
  
      /** The encoded entity Y position. */
      public int encodedPosY;
  
      /** The encoded entity Z position. */
      public int encodedPosZ;
  
      /** The encoded entity yaw rotation. */
      public int encodedRotationYaw;
  
      /** The encoded entity pitch rotation. */
      public int encodedRotationPitch;
      public int lastHeadMotion;
      public double lastTrackedEntityMotionX;
      public double lastTrackedEntityMotionY;
      public double motionZ;
      public int updateCounter;
      private double lastTrackedEntityPosX;
      private double lastTrackedEntityPosY;
      private double lastTrackedEntityPosZ;
      private boolean firstUpdateDone;
      private boolean sendVelocityUpdates;
  
      /**
       * every 400 ticks a  full teleport packet is sent, rather than just a "move me +x" command, so that position
       * remains fully synced.
       */
      private int ticksSinceLastForcedTeleport;
      private Entity field_85178_v;
      private boolean ridingEntity;
      public boolean playerEntitiesUpdated;
  
      /**
       * Holds references to all the players that are currently receiving position updates for this entity.
       */
      public Set trackingPlayers = new HashSet();
  
      public EntityTrackerEntry(Entity par1Entity, int par2, int par3, boolean par4)
      {
          this.trackedEntity = par1Entity;
          this.trackingDistanceThreshold = par2;
          this.updateFrequency = par3;
          this.sendVelocityUpdates = par4;
          this.encodedPosX = MathHelper.floor_double(par1Entity.posX * 32.0D);
          this.encodedPosY = MathHelper.floor_double(par1Entity.posY * 32.0D);
          this.encodedPosZ = MathHelper.floor_double(par1Entity.posZ * 32.0D);
          this.encodedRotationYaw = MathHelper.floor_float(par1Entity.rotationYaw * 256.0F / 360.0F);
          this.encodedRotationPitch = MathHelper.floor_float(par1Entity.rotationPitch * 256.0F / 360.0F);
          this.lastHeadMotion = MathHelper.floor_float(par1Entity.getRotationYawHead() * 256.0F / 360.0F);
      }
  
      public boolean equals(Object par1Obj)
      {
          return par1Obj instanceof EntityTrackerEntry ? ((EntityTrackerEntry)par1Obj).trackedEntity.entityId == this.trackedEntity.entityId : false;
      }
  
      public int hashCode()
      {
          return this.trackedEntity.entityId;
      }
  
      public void updatePlayerList(List par1List)
      {
          this.playerEntitiesUpdated = false;
  
          if (!this.firstUpdateDone || this.trackedEntity.getDistanceSq(this.lastTrackedEntityPosX, this.lastTrackedEntityPosY, this.lastTrackedEntityPosZ) > 16.0D)
          {
              this.lastTrackedEntityPosX = this.trackedEntity.posX;
              this.lastTrackedEntityPosY = this.trackedEntity.posY;
              this.lastTrackedEntityPosZ = this.trackedEntity.posZ;
              this.firstUpdateDone = true;
              this.playerEntitiesUpdated = true;
              this.updatePlayerEntities(par1List);
          }
  
          if (this.field_85178_v != this.trackedEntity.ridingEntity || this.trackedEntity.ridingEntity != null && this.updateCounter % 60 == 0)
          {
              this.field_85178_v = this.trackedEntity.ridingEntity;
              this.sendPacketToTrackedPlayers(new Packet39AttachEntity(0, this.trackedEntity, this.trackedEntity.ridingEntity));
          }
  
          if (this.trackedEntity instanceof EntityItemFrame && this.updateCounter % 10 == 0)
          {
              EntityItemFrame var23 = (EntityItemFrame)this.trackedEntity;
              ItemStack var24 = var23.getDisplayedItem();
  
              if (var24 != null && var24.getItem() instanceof ItemMap)
              {
                  MapData var26 = Item.map.getMapData(var24, this.trackedEntity.worldObj);
                  Iterator var27 = par1List.iterator();
  
                  while (var27.hasNext())
                  {
                      EntityPlayer var28 = (EntityPlayer)var27.next();
                      EntityPlayerMP var29 = (EntityPlayerMP)var28;
                      var26.updateVisiblePlayers(var29, var24);
  
                      if (var29.playerNetServerHandler.getNumChunkDataPackets() <= 5)
                      {
                          Packet var30 = Item.map.getUpdatePacket(var24, this.trackedEntity.worldObj, var29);
  
                          if (var30 != null)
                          {
                              var29.playerNetServerHandler.sendPacket(var30);
                          }
                      }
                  }
              }
  
              this.func_111190_b();
          }
          else if (this.updateCounter % this.updateFrequency == 0 || this.trackedEntity.isAirBorne || this.trackedEntity.getDataWatcher().hasObjectChanged())
          {
              int var2;
              int var3;
  
              if (this.trackedEntity.ridingEntity == null)
              {
                  ++this.ticksSinceLastForcedTeleport;
                  var2 = this.trackedEntity.myEntitySize.multiplyBy32AndRound(this.trackedEntity.posX);
                  var3 = MathHelper.floor_double(this.trackedEntity.posY * 32.0D);
                  int var4 = this.trackedEntity.myEntitySize.multiplyBy32AndRound(this.trackedEntity.posZ);
                  int var5 = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F);
                  int var6 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F);
                  int var7 = var2 - this.encodedPosX;
                  int var8 = var3 - this.encodedPosY;
                  int var9 = var4 - this.encodedPosZ;
                  Object var10 = null;
                  boolean var11 = Math.abs(var7) >= 4 || Math.abs(var8) >= 4 || Math.abs(var9) >= 4 || this.updateCounter % 60 == 0;
                  boolean var12 = Math.abs(var5 - this.encodedRotationYaw) >= 4 || Math.abs(var6 - this.encodedRotationPitch) >= 4;
  
                  if (this.updateCounter > 0 || this.trackedEntity instanceof EntityArrow)
                  {
                      if (var7 >= -128 && var7 < 128 && var8 >= -128 && var8 < 128 && var9 >= -128 && var9 < 128 && this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity)
                      {
                          if (var11 && var12)
                          {
                              var10 = new Packet33RelEntityMoveLook(this.trackedEntity.entityId, (byte)var7, (byte)var8, (byte)var9, (byte)var5, (byte)var6);
                          }
                          else if (var11)
                          {
                              var10 = new Packet31RelEntityMove(this.trackedEntity.entityId, (byte)var7, (byte)var8, (byte)var9);
                          }
                          else if (var12)
                          {
                              var10 = new Packet32EntityLook(this.trackedEntity.entityId, (byte)var5, (byte)var6);
                          }
                      }
                      else
                      {
                          this.ticksSinceLastForcedTeleport = 0;
                          var10 = new Packet34EntityTeleport(this.trackedEntity.entityId, var2, var3, var4, (byte)var5, (byte)var6);
                      }
                  }
  
                  if (this.sendVelocityUpdates)
                  {
                      double var13 = this.trackedEntity.motionX - this.lastTrackedEntityMotionX;
                      double var15 = this.trackedEntity.motionY - this.lastTrackedEntityMotionY;
                      double var17 = this.trackedEntity.motionZ - this.motionZ;
                      double var19 = 0.02D;
                      double var21 = var13 * var13 + var15 * var15 + var17 * var17;
  
                      if (var21 > var19 * var19 || var21 > 0.0D && this.trackedEntity.motionX == 0.0D && this.trackedEntity.motionY == 0.0D && this.trackedEntity.motionZ == 0.0D)
                      {
                          this.lastTrackedEntityMotionX = this.trackedEntity.motionX;
                          this.lastTrackedEntityMotionY = this.trackedEntity.motionY;
                          this.motionZ = this.trackedEntity.motionZ;
                          this.sendPacketToTrackedPlayers(new Packet28EntityVelocity(this.trackedEntity.entityId, this.lastTrackedEntityMotionX, this.lastTrackedEntityMotionY, this.motionZ));
                      }
                  }
  
                  if (var10 != null)
                  {
                      this.sendPacketToTrackedPlayers((Packet)var10);
                  }
  
                  this.func_111190_b();
  
                  if (var11)
                  {
                      this.encodedPosX = var2;
                      this.encodedPosY = var3;
                      this.encodedPosZ = var4;
                  }
  
                  if (var12)
                  {
                      this.encodedRotationYaw = var5;
                      this.encodedRotationPitch = var6;
                  }
  
                  this.ridingEntity = false;
              }
              else
              {
                  var2 = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F);
                  var3 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F);
                  boolean var25 = Math.abs(var2 - this.encodedRotationYaw) >= 4 || Math.abs(var3 - this.encodedRotationPitch) >= 4;
  
                  if (var25)
                  {
                      this.sendPacketToTrackedPlayers(new Packet32EntityLook(this.trackedEntity.entityId, (byte)var2, (byte)var3));
                      this.encodedRotationYaw = var2;
                      this.encodedRotationPitch = var3;
                  }
  
                  this.encodedPosX = this.trackedEntity.myEntitySize.multiplyBy32AndRound(this.trackedEntity.posX);
                  this.encodedPosY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D);
                  this.encodedPosZ = this.trackedEntity.myEntitySize.multiplyBy32AndRound(this.trackedEntity.posZ);
                  this.func_111190_b();
                  this.ridingEntity = true;
              }
  
              var2 = MathHelper.floor_float(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F);
  
              if (Math.abs(var2 - this.lastHeadMotion) >= 4)
              {
                  this.sendPacketToTrackedPlayers(new Packet35EntityHeadRotation(this.trackedEntity.entityId, (byte)var2));
                  this.lastHeadMotion = var2;
              }
  
              this.trackedEntity.isAirBorne = false;
          }
  
          ++this.updateCounter;
  
          if (this.trackedEntity.velocityChanged)
          {
              this.sendPacketToTrackedPlayersAndTrackedEntity(new Packet28EntityVelocity(this.trackedEntity));
              this.trackedEntity.velocityChanged = false;
          }
      }
  
      private void func_111190_b()
      {
          DataWatcher var1 = this.trackedEntity.getDataWatcher();
  
          if (var1.hasObjectChanged())
          {
              this.sendPacketToTrackedPlayersAndTrackedEntity(new Packet40EntityMetadata(this.trackedEntity.entityId, var1, false));
          }
  
          if (this.trackedEntity instanceof EntityLivingBase)
          {
              ServersideAttributeMap var2 = (ServersideAttributeMap)((EntityLivingBase)this.trackedEntity).func_110140_aT();
              Set var3 = var2.func_111161_b();
  
              if (!var3.isEmpty())
              {
                  this.sendPacketToTrackedPlayersAndTrackedEntity(new Packet44UpdateAttributes(this.trackedEntity.entityId, var3));
              }
  
              var3.clear();
          }
      }
  
      public void sendPacketToTrackedPlayers(Packet par1Packet)
      {
          Iterator var2 = this.trackingPlayers.iterator();
  
          while (var2.hasNext())
          {
              EntityPlayerMP var3 = (EntityPlayerMP)var2.next();
              var3.playerNetServerHandler.sendPacket(par1Packet);
          }
      }
  
      public void sendPacketToTrackedPlayersAndTrackedEntity(Packet par1Packet)
      {
          this.sendPacketToTrackedPlayers(par1Packet);
  
          if (this.trackedEntity instanceof EntityPlayerMP)
          {
              ((EntityPlayerMP)this.trackedEntity).playerNetServerHandler.sendPacket(par1Packet);
          }
      }
  
      public void sendDestroyEntityPacketToTrackedPlayers()
      {
          Iterator var1 = this.trackingPlayers.iterator();
  
          while (var1.hasNext())
          {
              EntityPlayerMP var2 = (EntityPlayerMP)var1.next();
              var2.destroyedItemsNetCache.add(Integer.valueOf(this.trackedEntity.entityId));
          }
      }
  
      public void removeFromTrackedPlayers(EntityPlayerMP par1EntityPlayerMP)
      {
          if (this.trackingPlayers.contains(par1EntityPlayerMP))
          {
              par1EntityPlayerMP.destroyedItemsNetCache.add(Integer.valueOf(this.trackedEntity.entityId));
              this.trackingPlayers.remove(par1EntityPlayerMP);
          }
      }
  
      public void updatePlayerEntity(EntityPlayerMP par1EntityPlayerMP)
      {
          if (par1EntityPlayerMP != this.trackedEntity)
          {
              double var2 = par1EntityPlayerMP.posX - (double)(this.encodedPosX / 32);
              double var4 = par1EntityPlayerMP.posZ - (double)(this.encodedPosZ / 32);
  
              if (var2 >= (double)(-this.trackingDistanceThreshold) && var2 <= (double)this.trackingDistanceThreshold && var4 >= (double)(-this.trackingDistanceThreshold) && var4 <= (double)this.trackingDistanceThreshold)
              {
                  if (!this.trackingPlayers.contains(par1EntityPlayerMP) && (this.isPlayerWatchingThisChunk(par1EntityPlayerMP) || this.trackedEntity.field_98038_p))
                  {
                      this.trackingPlayers.add(par1EntityPlayerMP);
                      Packet var6 = this.getSpawnPacket();
                      par1EntityPlayerMP.playerNetServerHandler.sendPacket(var6);
  
                      if (!this.trackedEntity.getDataWatcher().getIsBlank())
                      {
                          par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet40EntityMetadata(this.trackedEntity.entityId, this.trackedEntity.getDataWatcher(), true));
                      }
  
                      if (this.trackedEntity instanceof EntityLivingBase)
                      {
                          ServersideAttributeMap var7 = (ServersideAttributeMap)((EntityLivingBase)this.trackedEntity).func_110140_aT();
                          Collection var8 = var7.func_111160_c();
  
                          if (!var8.isEmpty())
                          {
                              par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet44UpdateAttributes(this.trackedEntity.entityId, var8));
                          }
                      }
  
                      this.lastTrackedEntityMotionX = this.trackedEntity.motionX;
                      this.lastTrackedEntityMotionY = this.trackedEntity.motionY;
                      this.motionZ = this.trackedEntity.motionZ;
  
                      if (this.sendVelocityUpdates && !(var6 instanceof Packet24MobSpawn))
                      {
                          par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet28EntityVelocity(this.trackedEntity.entityId, this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ));
                      }
  
                      if (this.trackedEntity.ridingEntity != null)
                      {
                          par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet39AttachEntity(0, this.trackedEntity, this.trackedEntity.ridingEntity));
                      }
  
                      if (this.trackedEntity instanceof EntityLiving && ((EntityLiving)this.trackedEntity).func_110166_bE() != null)
                      {
                          par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet39AttachEntity(1, this.trackedEntity, ((EntityLiving)this.trackedEntity).func_110166_bE()));
                      }
  
                      if (this.trackedEntity instanceof EntityLivingBase)
                      {
  