Пример #1
0
 protected void onItemPickup(EntityPlayer entityplayer) {
   if ((!this.isDead) && (!this.worldObj.isRemote)) {
     EntityTracker tracker = ((WorldServer) this.worldObj).getEntityTracker();
     tracker.sendPacketToAllPlayersTrackingEntity(
         this, new Packet22Collect(this.entityId, entityplayer.entityId));
   }
 }
Пример #2
0
  @Override
  public List<Entity> getTrackedEntities() {
    List<Entity> entities = new ArrayList<Entity>();

    synchronized (tracker.getTrackedEntities()) { // Synchronize set access
      for (net.minecraft.entity.EntityTrackerEntry e : tracker.getTrackedEntities()) {
        entities.add(e.getCanaryTrackerEntry().getEntity());
      }
    }
    return entities;
  }
Пример #3
0
 @Override
 public void trackEntity(Entity entity) {
   try {
     tracker.a(((CanaryEntity) entity).getHandle());
   } catch (Exception e) {
     log.error("Entitytracker error.", e);
   }
 }
Пример #4
0
    public boolean tryTrackingEntity(EntityTracker entityTracker, Entity entity)
    {

        EntityRegistration er = lookupModSpawn(entity.getClass(), true);
        if (er != null)
        {
            entityTracker.addEntityToTracker(entity, er.getTrackingRange(), er.getUpdateFrequency(), er.sendsVelocityUpdates());
            return true;
        }
        return false;
    }
Пример #5
0
  @Override
  public void hidePlayer(Player player, Player toHide) {
    if (player != null && toHide != null && !player.equals(toHide)) {
      if (!hiddenPlayersMap.containsKey(player) || !hiddenPlayersMap.get(player).contains(toHide)) {
        hiddenPlayersMap.get(player).add(toHide);

        net.minecraft.entity.EntityTrackerEntry entry = tracker.getTrackerEntry(toHide.getID());
        entry.a(((CanaryPlayer) player).getHandle());

        PlayerListData listEntry = toHide.getPlayerListData(PlayerListAction.REMOVE_PLAYER);
        player.sendPlayerListData(listEntry);
      }
    }
  }
Пример #6
0
  @Override
  public void showPlayer(Player player, Player toShow) {
    if (player != null && toShow != null && !player.equals(toShow)) {
      if (hiddenPlayersMap.containsKey(player) && hiddenPlayersMap.get(player).contains(toShow)) {
        hiddenPlayersMap.get(player).remove(toShow);

        PlayerListData listEntry = toShow.getPlayerListData(PlayerListAction.ADD_PLAYER);
        player.sendPlayerListData(listEntry);

        net.minecraft.entity.EntityTrackerEntry entry = tracker.getTrackerEntry(toShow.getID());
        entry.b(((CanaryPlayer) player).getHandle());
      }
    }
  }
Пример #7
0
 @Override
 public void sendPacketToTrackedPlayer(Player player, Packet packet) {
   tracker.a(((CanaryEntity) player).getHandle(), ((CanaryPacket) packet).getPacket());
 }
Пример #8
0
 @Override
 public void updateTrackedEntities() {
   tracker.a();
 }
Пример #9
0
 @Override
 public void untrackPlayerSymmetrics(Player player) {
   tracker.a((((CanaryPlayer) player).getHandle()));
 }
Пример #10
0
 @Override
 public void untrackEntity(Entity entity) {
   tracker.b(((CanaryEntity) entity).getHandle());
 }