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