getNearbyEntities

Discussion in 'Plugin Development' started by Mother__, Feb 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Mother__

    How i can get Nearby Entities in determine location example

    Code:java
    1.  
    2.  
    3. for(Iterator<?> iterator = location.getNearbyEntities(4, 4, 4).iterator(); iterator.hasNext();){
    4. Entity nearby = (Entity)iterator.next();
    5. if(nearby instanceof Player)
    6. {
    7. .........
    8.  
    9. }
    10. }
    11.  
     
  2. Offline

    Qwertyness_

    Uhh, what?
     
  3. Offline

    Mother__

    how i can get Entities in x , y, z
     
  4. Offline

    Qwertyness_

    Sorry, I don't understand what your asking...
    OHHH, I get it

    You have to spawn an entity in the location and check getNearbyEntities() on the new entity, then despawn the entity.

    Or you could write your own logic for calculating the entities distance from the location, depends on what you want really.
     
  5. Offline

    Mother__


    O thx for asking! like this?

    Code:java
    1.  
    2. world.spawnEntity(loc, EntityType.PLAYER);
    3.  



    Can me show example ? sorry my english
     
  6. Offline

    Compressions

Thread Status:
Not open for further replies.

Share This Page