Ejemplo n.º 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));
   }
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 3
0
 @Override
 public void trackEntity(Entity entity) {
   try {
     tracker.a(((CanaryEntity) entity).getHandle());
   } catch (Exception e) {
     log.error("Entitytracker error.", e);
   }
 }
Ejemplo n.º 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;
    }
Ejemplo n.º 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);
      }
    }
  }
Ejemplo n.º 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());
      }
    }
  }
Ejemplo n.º 7
0
 @Override
 public void sendPacketToTrackedPlayer(Player player, Packet packet) {
   tracker.a(((CanaryEntity) player).getHandle(), ((CanaryPacket) packet).getPacket());
 }
Ejemplo n.º 8
0
 @Override
 public void updateTrackedEntities() {
   tracker.a();
 }
Ejemplo n.º 9
0
 @Override
 public void untrackPlayerSymmetrics(Player player) {
   tracker.a((((CanaryPlayer) player).getHandle()));
 }
Ejemplo n.º 10
0
 @Override
 public void untrackEntity(Entity entity) {
   tracker.b(((CanaryEntity) entity).getHandle());
 }