Solved Disable mob movement but still target entity's

Discussion in 'Spigot Plugin Development' started by The_AxeMaster, Feb 13, 2017.

  1. Alright, so i am trying to disable a mob from moving, yet still target entity's in its range. I am working with Guardians.

    This is my code so far
    THIS IS FIXED
    Code (Text):
    [/LEFT]
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if(sender instanceof Player) {
                Player p = (Player) sender;
                Guardian Guar = (Guardian) p.getWorld().spawnEntity(p.getLocation(), EntityType.GUARDIAN);
                Guardian Guar1 = (Guardian) p.getWorld().spawnEntity(p.getLocation(), EntityType.GUARDIAN);
                Guardian Guar2 = (Guardian) p.getWorld().spawnEntity(p.getLocation(), EntityType.GUARDIAN);
                Guardian Guar3 = (Guardian) p.getWorld().spawnEntity(p.getLocation(), EntityType.GUARDIAN);
            Guar.setTarget(p);
            Guar.setVelocity(new Vector(0f, 0.3f, 0f));
            Guar1.setTarget(p);
            Guar1.setVelocity(new Vector(0f, 0.3f, 0f));
            Guar2.setTarget(p);
            Guar2.setVelocity(new Vector(0f, 0.3f, 0f));
            Guar3.setTarget(p);
            Guar3.setVelocity(new Vector(0f, 0.3f, 0f));
           
            }
            return true;
        }

    }
    [LEFT]
     
    #1 The_AxeMaster, Feb 13, 2017
    Last edited: Feb 13, 2017
    • Like Like x 1
    • Optimistic Optimistic x 1
  2. You should still provide the fix, it could be a useful feature for many people.
     
    • Agree Agree x 2
  3. Could u Please put the code back in? I've got the same problem.
     
    • Agree Agree x 1
  4. Thank you for adding back the code. Appreciate it.