Custom Pathfinder Entity Not Properly Jumping

Discussion in 'Plugin Development' started by The Fancy Whale, Jul 23, 2015.

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

    The Fancy Whale

    I am creating a custom pathfinder. The pathfinder works, except when the entity reaches a block it needs to jump over it does this:

    Here is the code:
    Code:
    public class PathFinderGoalWalkToLoc extends PathfinderGoal
    {
       private double speed;
    
       private EntityMonster entity;
    
       private ArrayList<Location> loc;
    
       private Navigation navigation;
      
       private int currentLoc;
    
       public PathFinderGoalWalkToLoc(EntityMonster entity, ArrayList<Location> loc, double speed)
       {
         this.entity = entity;
         this.loc = loc;
         this.currentLoc = 1;
         this.navigation = (Navigation) this.entity.getNavigation();
         this.speed = speed;
       }
    
       public boolean a()
       {
        if (this.entity.getGoalTarget() != null)   return false;
         return true;
       }
       public void c()
       {
           if (currentLoc + 1 < this.loc.size()){
               if (this.entity.getBukkitEntity().getLocation().distance(this.loc.get(currentLoc + 1)) <= 15) currentLoc++;
           }
           PathEntity pathEntity = this.navigation.a(loc.get(currentLoc).getX(), loc.get(currentLoc).getY(), loc.get(currentLoc).getZ());
           this.navigation.a(pathEntity, speed);
       }
       public void e()
       {
           if (currentLoc + 1 < this.loc.size()){
               if (this.entity.getBukkitEntity().getLocation().distance(this.loc.get(currentLoc + 1)) <= 15) currentLoc++;
           }
           PathEntity pathEntity = this.navigation.a(loc.get(currentLoc).getX(), loc.get(currentLoc).getY(), loc.get(currentLoc).getZ());
           this.navigation.a(pathEntity, speed);
       }
    }
    If you know how to fix the jumping please let me know. Thanks!
     
  2. Offline

    mythbusterma

    @The Fancy Whale

    It looks like it might be stopping just short of making it over the block, although I can't really say for sure.
     
  3. Offline

    The Fancy Whale

    Yeah it seems to be jumping up but not also moving forward which is an issue... Looking for a possible fix though
     
  4. Offline

    mythbusterma

    @The Fancy Whale

    I would try making their goal a few fractions of a block higher than the step itself.
     
  5. Offline

    The Fancy Whale

    Well the goal is actually 3 blocks above in that case. It is getting high enough though. You can tell because I am able to push them onto the block when they jump.
     
Thread Status:
Not open for further replies.

Share This Page