NMS Mob - Head moving?

Discussion in 'Spigot Plugin Development' started by Inkzzz, May 28, 2015.

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

    Resource Staff

    Hey,
    I'm making a plugin, that has the use of NMS mobs. It's working and it's fine, however I'd like the mob(s) heads to stop rotating towards the player.
    How would I do that?
     
  2. Inkzzz

    Resource Staff

  3. You just have to change its PathfinderGoalSelector.
     
  4. Inkzzz

    Resource Staff

    How?
     
  5. Code (Java):
    try {
           Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
           bField.setAccessible(true);
           Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
           cField.setAccessible(true);
           bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
           bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
           cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
           cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
         } catch (Exception exc) {
           exc.printStackTrace();
         }

         this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityToLook.class, 8.0F)); //Replace "EntityToLook" by the Entity to look :P
     
    • Informative Informative x 1
  6. Inkzzz

    Resource Staff

    Thanks bud!
     
Thread Status:
Not open for further replies.