Custom PathfinderGoalTarget attack player list

Discussion in 'Spigot Plugin Development' started by Kwizzy, May 22, 2016.

  1. Hello i'm still on 1.9, i've a custom entity and now i want a custom pathfinder who the mob attack only a list of player !

    This is possible ? How to do that ?
  2. Use the constructor PathfinderGoalNearestAttackableTarget(EntityCreature, Class<T>, int, boolean, boolean, Predicate<? super T>) passing the EntityHuman as the the target class and in the predicate you check your condition (if the player is in a list?).
    • Like Like x 1
  3. I'will try this soon thank's :)
    Can you do a simple example ? I don't know the utilisation of "int, boolean, boolean"

    Thank's you very much !
  4. The int seems to be related to the chance of the execution of the goal but I'm not sure. By default it's 10 for every entity except EntityWither which is 0.
    If the first boolean is true the entity will change target if it isn't in his life of sight for more than 3 seconds. Usually the field is true when the target class is EntityHuman or EntityIronGolem and false for the other types of entities. This makes sense because, for instance, both players and irongolems are hostile to zombies by default and doing so a zombie will prioritize either the player or the irongolem, keep following them even if it can't see him, while it will change target if it is like a villager etc.
    I don't really know what the second boolean does (too much code to look through in order to understand it's logic) but It's usually false for every entity except EntityIronGolem.
    #4 Grimerlin, May 22, 2016
    Last edited: May 22, 2016