예제 #1
0
  public void updateTrackedEntities() {
    ArrayList arraylist = new ArrayList();
    Iterator iterator = trackedEntitySet.iterator();

    do {
      if (!iterator.hasNext()) {
        break;
      }

      EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
      entitytrackerentry.updatePlayerList(field_72795_a.playerEntities);

      if (entitytrackerentry.playerEntitiesUpdated
          && (entitytrackerentry.trackedEntity instanceof EntityPlayerMP)) {
        arraylist.add((EntityPlayerMP) entitytrackerentry.trackedEntity);
      }
    } while (true);

    for (Iterator iterator1 = arraylist.iterator(); iterator1.hasNext(); ) {
      EntityPlayerMP entityplayermp = (EntityPlayerMP) iterator1.next();
      EntityPlayerMP entityplayermp1 = entityplayermp;
      Iterator iterator2 = trackedEntitySet.iterator();

      while (iterator2.hasNext()) {
        EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator2.next();

        if (entitytrackerentry1.trackedEntity != entityplayermp1) {
          entitytrackerentry1.updatePlayerEntity(entityplayermp1);
        }
      }
    }
  }
예제 #2
0
  public void sendPacketToTrackedPlayersAndTrackedEntity(Entity par1Entity, Packet par2Packet) {
    EntityTrackerEntry entitytrackerentry =
        (EntityTrackerEntry) trackedEntityHashTable.lookup(par1Entity.entityId);

    if (entitytrackerentry != null) {
      entitytrackerentry.sendPacketToTrackedPlayersAndTrackedEntity(par2Packet);
    }
  }
예제 #3
0
  public void removeTrackedPlayerSymmetric(EntityPlayerMP par1EntityPlayerMP) {
    EntityTrackerEntry entitytrackerentry;

    for (Iterator iterator = trackedEntitySet.iterator();
        iterator.hasNext();
        entitytrackerentry.removeTrackedPlayerSymmetric(par1EntityPlayerMP)) {
      entitytrackerentry = (EntityTrackerEntry) iterator.next();
    }
  }
예제 #4
0
  public void trackEntity(Entity par1Entity, int par2, int par3, boolean par4) {
    if (par2 > maxTrackingDistanceThreshold) {
      par2 = maxTrackingDistanceThreshold;
    }

    if (trackedEntityHashTable.containsItem(par1Entity.entityId)) {
      throw new IllegalStateException("Entity is already tracked!");
    } else {
      EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(par1Entity, par2, par3, par4);
      trackedEntitySet.add(entitytrackerentry);
      trackedEntityHashTable.addKey(par1Entity.entityId, entitytrackerentry);
      entitytrackerentry.updatePlayerEntities(field_72795_a.playerEntities);
      return;
    }
  }
예제 #5
0
  public void untrackEntity(Entity par1Entity) {
    if (par1Entity instanceof EntityPlayerMP) {
      EntityPlayerMP entityplayermp = (EntityPlayerMP) par1Entity;
      EntityTrackerEntry entitytrackerentry1;

      for (Iterator iterator = trackedEntitySet.iterator();
          iterator.hasNext();
          entitytrackerentry1.removeFromTrackedPlayers(entityplayermp)) {
        entitytrackerentry1 = (EntityTrackerEntry) iterator.next();
      }
    }

    EntityTrackerEntry entitytrackerentry =
        (EntityTrackerEntry) trackedEntityHashTable.removeObject(par1Entity.entityId);

    if (entitytrackerentry != null) {
      trackedEntitySet.remove(entitytrackerentry);
      entitytrackerentry.sendDestroyEntityPacketToTrackedPlayers();
    }
  }
예제 #6
0
  public void trackEntity(Entity par1Entity) {
    if (par1Entity instanceof EntityPlayerMP) {
      trackEntity(par1Entity, 512, 2);
      EntityPlayerMP entityplayermp = (EntityPlayerMP) par1Entity;
      Iterator iterator = trackedEntitySet.iterator();

      do {
        if (!iterator.hasNext()) {
          break;
        }

        EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();

        if (entitytrackerentry.trackedEntity != entityplayermp) {
          entitytrackerentry.updatePlayerEntity(entityplayermp);
        }
      } while (true);
    } else if (par1Entity instanceof EntityFishHook) {
      trackEntity(par1Entity, 64, 5, true);
    } else if (par1Entity instanceof EntityArrow) {
      trackEntity(par1Entity, 64, 20, false);
    } else if (par1Entity instanceof EntitySmallFireball) {
      trackEntity(par1Entity, 64, 10, false);
    } else if (par1Entity instanceof EntityFireball) {
      trackEntity(par1Entity, 64, 10, false);
    } else if (par1Entity instanceof EntitySnowball) {
      trackEntity(par1Entity, 64, 10, true);
    } else if (par1Entity instanceof EntityEnderPearl) {
      trackEntity(par1Entity, 64, 10, true);
    } else if (par1Entity instanceof EntityEnderEye) {
      trackEntity(par1Entity, 64, 4, true);
    } else if (par1Entity instanceof EntityEgg) {
      trackEntity(par1Entity, 64, 10, true);
    } else if (par1Entity instanceof EntityPotion) {
      trackEntity(par1Entity, 64, 10, true);
    } else if (par1Entity instanceof EntityExpBottle) {
      trackEntity(par1Entity, 64, 10, true);
    } else if (par1Entity instanceof EntityItem) {
      trackEntity(par1Entity, 64, 20, true);
    } else if (par1Entity instanceof EntityMinecart) {
      trackEntity(par1Entity, 80, 3, true);
    } else if (par1Entity instanceof EntityBoat) {
      trackEntity(par1Entity, 80, 3, true);
    } else if (par1Entity instanceof EntitySquid) {
      trackEntity(par1Entity, 64, 3, true);
    } else if (par1Entity instanceof IAnimals) {
      trackEntity(par1Entity, 80, 3, true);
    } else if (par1Entity instanceof EntityDragon) {
      trackEntity(par1Entity, 160, 3, true);
    } else if (par1Entity instanceof EntityTNTPrimed) {
      trackEntity(par1Entity, 160, 10, true);
    } else if (par1Entity instanceof EntityFallingSand) {
      trackEntity(par1Entity, 160, 20, true);
    } else if (par1Entity instanceof EntityPainting) {
      trackEntity(par1Entity, 160, 0x7fffffff, false);
    } else if (par1Entity instanceof EntityXPOrb) {
      trackEntity(par1Entity, 160, 20, true);
    } else if (par1Entity instanceof EntityEnderCrystal) {
      trackEntity(par1Entity, 256, 0x7fffffff, false);
    }

    ModLoaderMp.handleEntityTrackers(this, par1Entity);
  }