@Override public List<Entity> getNearbyEntities(double arg0, double arg1, double arg2) { return base.getNearbyEntities(arg0, arg1, arg2); }
public static boolean hasPlayerNearby(Entity entity, int distance) { for (Entity e : entity.getNearbyEntities(distance, distance, distance)) { if (e instanceof Player && !checkCustomNpc(e)) { return true; } } return false; }
@Override public List<MCEntity> getNearbyEntities(double x, double y, double z) { List<Entity> lst = e.getNearbyEntities(x, y, z); List<MCEntity> retn = new ArrayList<>(); for(Entity e : lst) { retn.add(BukkitConvertor.BukkitGetCorrectEntity(e)); } return retn; }
/** * Get a list of nearby players * @param arena the arena * @param boss the boss * @param x the 'radius' in which to grab players * @return a list of nearby players */ public static List<Player> getNearbyPlayers(Arena arena, Entity boss, int x) { List<Player> result = new ArrayList<>(); for (Entity e : boss.getNearbyEntities(x, x, x)) { if (arena.getPlayersInArena().contains(e)) { result.add((Player) e); } } return result; }
private List<Entity> getJunkTravellers() { // spawn an entity Entity orb = junkLoc.getWorld().spawnEntity(junkLoc, EntityType.EXPERIENCE_ORB); List<Entity> ents = orb.getNearbyEntities(4.0, 4.0, 4.0); orb.remove(); return ents; }
private List<Entity> getJunkTravellers() { // spawn an entity Entity orb = vortexJunkLoc.getWorld().spawnEntity(vortexJunkLoc, EntityType.EXPERIENCE_ORB); List<Entity> ents = orb.getNearbyEntities(4.0d, 4.0d, 4.0d); orb.remove(); return ents; }
public List<Entity> getJunkTravellers(Location loc) { // spawn an entity Entity orb = loc.getWorld().spawnEntity(loc, EntityType.EXPERIENCE_ORB); List<Entity> ents = orb.getNearbyEntities(16.0d, 16.0d, 16.0d); orb.remove(); return ents; }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onTNTExplode(EntityExplodeEvent e) { if (!cm.disableChainReaction) { return; } Entity entity = e.getEntity(); if (entity instanceof TNTPrimed) { for (Entity primedTNT : entity.getNearbyEntities(4.5, 4.5, 4.5)) { if (primedTNT instanceof TNTPrimed) { primedTNT.remove(); } } } } }
@Override public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){ try{ // TODO: Probably check other ids too before doing this ? for (final Entity other : entity.getNearbyEntities(2.0, 2.0, 2.0)){ final EntityType type = other.getType(); if (type != EntityType.BOAT){ // && !(other instanceof Minecart)) continue; } final double locY = entity.getLocation(useLoc).getY(); useLoc.setWorld(null); if (Math.abs(locY - minY) < 0.7){ // TODO: A "better" estimate is possible, though some more tolerance would be good. return true; } else return false; } } catch (Throwable t){ // Ignore exceptions (Context: DisguiseCraft). } return false; }
@Override public Collection<NPC> getNearby(NPC npc) { if (cached != null && cacheTicks++ < maxCacheTicks) { return cached; } else { cached = null; cacheTicks = 0; } Collection<NPC> ret = Lists.newArrayList(); for (Entity entity : npc.getEntity().getNearbyEntities(radius, radius, radius)) { NPC npc2 = CitizensAPI.getNPCRegistry().getNPC(entity); if (npc2 != null) { if (!npc2.getNavigator().isNavigating()) continue; ret.add(npc2); } } this.cached = ret; return ret; } }
/** * Supports Bukkit earlier than Spigot Bukkit-1.8.4 */ public static Collection<Entity> getNearbyEntities(Location location, double x, double y, double z) { World world = location.getWorld(); try { return world.getNearbyEntities(location, x, y, z); } catch (NoSuchMethodError ignored) { Entity entity = world.spawnEntity(location, EntityType.EXPERIENCE_ORB); Collection<Entity> result = entity.getNearbyEntities(x, y, z); entity.remove(); return result; } }
private List<Entity> getJunkTravellers() { // spawn an entity Entity orb = dd.getLocation().getWorld().spawnEntity(dd.getLocation(), EntityType.EXPERIENCE_ORB); List<Entity> ents = orb.getNearbyEntities(1.0, 1.0, 1.0); orb.remove(); return ents; }
@Override public void doPickupAnimation(Entity entity, Entity target) { for (Entity p : target.getNearbyEntities(10, 10, 10)) { if (p instanceof Player) { ((CraftPlayer) p).getHandle().playerConnection.sendPacket(new PacketPlayOutCollect(target.getEntityId(), entity.getEntityId())); } } }
@Override public boolean shouldExecute() { if (targets.size() == 0 || !npc.isSpawned()) return false; Collection<Entity> nearby = npc.getEntity().getNearbyEntities(radius, radius, radius); this.target = null; for (Entity entity : nearby) { if (targets.contains(entity.getType())) { target = entity; break; } } if (target != null) { npc.getNavigator().setTarget(target, aggressive); npc.getNavigator().getLocalParameters().addSingleUseCallback(new NavigatorCallback() { @Override public void onCompletion(CancelReason cancelReason) { reason = cancelReason; finished = true; } }); return true; } return false; }
List<Entity> creeps = ent.getNearbyEntities(1d, 1d, 1d); ent.remove(); boolean boost = false;
if (!hidden) { Entity ent = map.getKey().getWorld().spawnEntity(map.getKey(), EntityType.EXPERIENCE_ORB); List<Entity> entities = ent.getNearbyEntities(16, 16, 16); ent.remove(); boolean found = false;
Entity e = w.spawnEntity(l, EntityType.CREEPER); for (Entity k : e.getNearbyEntities(1d, 1d, 1d)) { if (k.getType().equals(EntityType.CREEPER)) { e.remove();
List<Entity> nearby = mounted.getNearbyEntities(crashEntityDistance, crashEntityDistance, crashEntityDistance); Vector crashDirection = direction.clone(); if (crashVelocityYOffset > 0) {
ent.getNearbyEntities(1.5d, 1.5d, 1.5d).forEach((e) -> { if (e instanceof Creeper) { e.remove();
List<Entity> mobs = ent.getNearbyEntities(3.75D, 3.75D, 3.75D); if (mobs.size() > 0) { List<TARDISHorse> old_macd_had_a_horse = new ArrayList<>();