NMS Pathfinder help

Discussion in 'Plugin Development' started by Scullyking, Apr 16, 2015.

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


    I have a custom zombie as defined:

    public class CustomZombie extends EntityZombie {
        public CustomZombie(org.bukkit.World world) {
            super(((CraftWorld) world).getHandle());
            List goalB = (List) Reflect.getPrivateField("b", PathfinderGoalSelector.class, goalSelector); goalB.clear();
            List goalC = (List) Reflect.getPrivateField("c", PathfinderGoalSelector.class, goalSelector); goalC.clear();
            List targetB = (List) Reflect.getPrivateField("b", PathfinderGoalSelector.class, targetSelector); targetB.clear();
            List targetC = (List) Reflect.getPrivateField("c", PathfinderGoalSelector.class, targetSelector); targetC.clear();
            this.goalSelector.a(0, new PathfinderGoalFloat(this));
            this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityChicken.class, 1.0D, true));
            this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
            this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
            this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
            this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityChicken.class, 8.0F));
            this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
            this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
            this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
    However it isn't attacking me in-game. It is spawning, and it is spawning the custom zombie because it only looks at chickens (as a set in the PathfinderGoalLookAtPlayer overwrite).

    Another question I have, what are the numbers in the first parameter in a(). The ones that read 0, 4, 5, 6, 7, 8, 8, etc. I want to add new pathfinders to my zombie, but I have no idea what this int should be.
  2. Offline


  3. Offline


    Good question. I'm not exactly sure, but I would guess that they are some kind of priority number, with zero being the highest priority ?

    I'm not sure if clearing all the pathfinders first will solve your problem, but it's worth a try.

    Here it is the method from Teeepeee's tutorial:
  4. Offline


    @ark9026 @Europia79

    I have already overwritten default pathfinders. This is proven because my custom zombie looks at chickens, not humans. Because I have overwritten it to look at chickens not players.
Thread Status:
Not open for further replies.

Share This Page