Problem with EntityType

Discussion in 'Plugin Development' started by Wundark, Apr 1, 2012.

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

    Wundark

    Right now i'm trying to get every mob/animal.

    The code below doesn't work because. Incompatible conditional operand types EntityType and Creature.
    PHP:
    for (EntityType et EntityType.values()){
        if(
    et instanceof Creature){
            
    def.put("entity."+et.getName(), 1);
        }
    }
    I cant find a way of getting all the mob/animal types but filtering out all the others. Any help appreciated.
     
  2. what are you trying to do exact? you want all entities?
    Code:java
    1. World world;
    2. java.util.Collection< org.bukkit.entity.Creature mobs = world.getEntitiesByClass(org.bukkit.entity.Creature.class) ;

    Edit, using [.syntax=java] [/syntax] is more recommends than using [.php][/php]
     
  3. Offline

    Wundark

    I'm trying to only get Mobs/Animals, not other things like minecarts/items/thrown ender pearl/falling sand.
     
  4. look at the follwing part:
    world.getEntitiesByClass(org.bukkit.entity.Creature.class)
    as you see, its only getting "org.bukkit.entity.Creature", thats is what you want?
     
  5. Offline

    Wundark

    That only gives me, Where are all the other mobs?

    Code:
    entity:
      Pig
      Chicken
      Cow
      Villager
      Sheep
     
  6. it only gives the existing entities at the world of that kind
     
  7. Offline

    Wundark

    Thats useless...

    I might as well just use the deprecated type, CreatureType. It does what I want, nothing you suggested has exactly this.
     
Thread Status:
Not open for further replies.

Share This Page