How to create still mobs?

Discussion in 'Plugin Development' started by masteroftime, Jun 7, 2011.

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

    masteroftime

    I am currently writing a plugin which spawns mobs at specific locations. I want that the player can see where the mobs will spawn and add/remove new spawns. Therefore I need to display mobs which cant move and can't attack.

    How can I achieve this? I was not able to find onEntityMove or a similar method, does such a method exists?
     
  2. Offline

    chronopolis

    In pseudocode:
    Code:
    static LivingEntity[] spawnPoints;
    spawnPoints[0] = World.spawnCreature(location,CreatureType);
    spawnPoints[0].setTarget(spawnPoints[0]);
    And in your EntityListener:
    Code:
    public void onEntityTarget(EntityTargetEvent event){
    for (LivingEntity mob:Plugin.spawnPoints){
       if (mob.getEntityId() == event.getEntity().getEntityId())mob.setTarget(mob);
       }
    }
    Replace the plugin variable with a static reference to your plugin.
     
  3. Offline

    masteroftime

    Thanks a lot!
     
Thread Status:
Not open for further replies.

Share This Page