Solved Giving mob effect to stay still?

Discussion in 'Plugin Development' started by Sean0402, Jul 28, 2014.

Thread Status:
Not open for further replies.
  1. Hello i'm trying to make my mob stay still... I gave it slowness but still nothing will make it stay still..
    Code:java
    1. Villager z = (Villager)loc2.getWorld().spawnEntity(loc2, EntityType.VILLAGER);
    2. StopWalking.createWMAPIMob(s, loc2);
    3. z.setCustomName(ChatColor.GOLD + "Shop");
    4. z.setCustomNameVisible(true);
    5. z.setVelocity(z.getVelocity().multiply(0));
    6. z.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 0));
     
  2. Offline

    fireblast709

    Sean0402 that is Slowness I, it will just slow them a bit. Try a higher amplifier (level)
     
  3. Offline

    manguvana

    Sean0402
    Teleport it to the same place every tick. If you use it too much, then it will start lagging. But if you use only one, or few, it should be fine.
    Use:
    Code:
        BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
        scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                Entity villager = loc2.getWorld().spawnEntity(loc2, EntityType.VILLAGER);
                villager.teleport(loc2);
            }
        }, 0L, 20L);
    
    You also may try to use it over 2 ticks (change the last number).
     
  4. manguvana you code above is abit weird? Has all that [FONT] stuff?

    I solved it. I gave them slowness for a long duration then put amplifier of 100, Can't move at all! Perfect!

    Thanks for the help! :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    fireblast709

    Sean0402 ( manguvana ) according to the wiki, 7+ should be enough to freeze players. You could try this with mobs.

    [Edit] ninja solved xD?
     
  6. fireblast709 I know I tested on myself before I done it and I couldn't move an inch :p
     
Thread Status:
Not open for further replies.

Share This Page