NMS Help PathFinders

Discussion in 'Plugin Development' started by glory_fades, Feb 2, 2015.

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

    glory_fades

    So im getting errors on just one pathfinder and cant seem why and also the pathfinders work just when i spawn the zombie, it can barely move

    Code:
    package Main;
    
    import java.lang.reflect.Field;
    
    import org.bukkit.craftbukkit.v1_7_R4.util.UnsafeList;
    
    import net.minecraft.server.v1_7_R4.EntityPig;
    import net.minecraft.server.v1_7_R4.EntitySkeleton;
    import net.minecraft.server.v1_7_R4.EntityZombie;
    import net.minecraft.server.v1_7_R4.PathfinderGoalMeleeAttack;
    import net.minecraft.server.v1_7_R4.PathfinderGoalNearestAttackableTarget;
    import net.minecraft.server.v1_7_R4.World;
    public class CustomEntityZombie extends EntityZombie {
         public CustomEntityZombie(World world) {
                super(world);
                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(0, new PathfinderGoalFloat(this));
                this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this,EntityPig.class, 1.0D, false));
                this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this,EntitySkeleton.class, 1.0D, true));
                this.goalSelector.a(4, new PathfinderGoalWalktoTile(this, (float) 1.0));
                this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
                this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityPig.class, 0, true));
                this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntitySkeleton.class, 0, false));
            }
        }
    this is my error
    Code:
                this.goalSelector.a(0, new PathfinderGoalFloat(this));
     
  2. Offline

    sirrus86

    Can you give us the error itself?
     
Thread Status:
Not open for further replies.

Share This Page