Make A Villager That Doesn't Walk

Discussion in 'Plugin Development' started by superjesse07, Apr 25, 2014.

Thread Status:
Not open for further replies.
  1. so as the title says i want to make a villager that doesn't wander away
    this is my code so far
    Code:java
    1. public void CreateNPC(Player p,String name, Quest quest,boolean timed,int time)
    2. {
    3. Villager npc = (Villager)p.getWorld().spawnEntity(p.getLocation(), EntityType.VILLAGER);
    4. npc.setCustomName("§a" + name);
    5. npc.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, (20 * 9999), 9999));
    6. }
     
  2. Offline

    LordDarthBob

    superjesse07
    Use an extreme speed effect. High level speed potions can generate the exact opposite effect, actually slowing the player or mob, and at a certain point stopping them completely. The same can be said for jump boost.
     
  3. Offline

    Garris0n

    Or a slowness effect.

    @OP That method should be called "createNPC or createNpc". Please read up on the Java naming conventions. Also, you should use the ChatColor enum instead of raw color codes.
     
    ZodiacTheories likes this.
  4. Offline

    LordDarthBob

    Garris0n
    I just think it's funny to use something for a greatly different purpose than it would generally be used for, plus it would still work. Just using slow to slow something is boring.
     
  5. Offline

    coasterman10

    Since this is probably going to run only on CraftBukkit-based servers, you can also cast it to its NMS entity and remove any movement pathfinders from its goal selector, or just clear the goal selector altogether.
     
Thread Status:
Not open for further replies.

Share This Page