DebugFlags enum

Пакет: com.hypixel.hytale.server.npc.corecomponents.movement

Файл: com/hypixel/hytale/server/npc/corecomponents/movement/BodyMotionFindBase.java

implements: Supplier<String>

Поля (1)

МодификаторыТипИмя
private final String description

Методы (2)

МодификаторыВозвратСигнатура
abstract Stay Stay("Don't move. Only compute path")
public String getpublic String get()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.movement;

class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
class="kw">import com.hypixel.hytale.math.random.RandomExtra;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.math.util.TrigMathUtil;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.NPCPlugin;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.BodyMotionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.movement.builders.BuilderBodyMotionFindBase;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.movement.NavState;
class="kw">import com.hypixel.hytale.server.npc.movement.Steering;
class="kw">import com.hypixel.hytale.server.npc.movement.constraints.RelaxedConstraint;
class="kw">import com.hypixel.hytale.server.npc.movement.controllers.MotionController;
class="kw">import com.hypixel.hytale.server.npc.movement.controllers.ProbeMoveData;
class="kw">import com.hypixel.hytale.server.npc.movement.steeringforces.SteeringForceWithTarget;
class="kw">import com.hypixel.hytale.server.npc.navigation.AStarBase;
class="kw">import com.hypixel.hytale.server.npc.navigation.AStarDebugBase;
class="kw">import com.hypixel.hytale.server.npc.navigation.AStarEvaluator;
class="kw">import com.hypixel.hytale.server.npc.navigation.AStarNode;
class="kw">import com.hypixel.hytale.server.npc.navigation.AStarNodePoolProvider;
class="kw">import com.hypixel.hytale.server.npc.navigation.AStarNodePoolProviderSimple;
class="kw">import com.hypixel.hytale.server.npc.navigation.IWaypoint;
class="kw">import com.hypixel.hytale.server.npc.navigation.PathFollower;
class="kw">import com.hypixel.hytale.server.npc.role.RoleDebugFlags;
class="kw">import com.hypixel.hytale.server.npc.role.support.DebugSupport;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import java.util.EnumSet;
class="kw">import java.util.function.Supplier;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;

class="kw">public class="kw">abstract class BodyMotionFindBase<T class="kw">extends AStarBase> class="kw">extends BodyMotionBase class="kw">implements AStarEvaluator, DebugSupport.DebugFlagsChangeListener {
   class="kw">protected class="kw">final int nodesPerTick;
   class="kw">protected class="kw">final boolean useBestPath;
   class="kw">protected class="kw">final double throttleDelayMin;
   class="kw">protected class="kw">final double throttleDelayMax;
   class="kw">protected class="kw">final int throttleIgnoreCount;
   class="kw">protected class="kw">final boolean useSteering;
   class="kw">protected class="kw">final boolean usePathfinder;
   class="kw">protected class="kw">final boolean skipSteering;
   class="kw">protected class="kw">final double minPathLength;
   class="kw">protected class="kw">final double minPathLengthSquared;
   class="kw">protected class="kw">final boolean canSkipSteering;
   class="kw">protected class="kw">final double desiredAltitudeWeight;
   class="kw">protected class="kw">final boolean dbgStatus;
   class="kw">protected class="kw">final boolean dbgProfile;
   class="kw">protected class="kw">final boolean dbgMaps;
   class="kw">protected class="kw">final boolean dbgOpens;
   class="kw">protected class="kw">final boolean dbgPath;
   class="kw">protected class="kw">final boolean dbgRebuild;
   class="kw">protected class="kw">final boolean dbgNodes;
   class="kw">protected class="kw">final boolean dbgStay;
   class="kw">protected class="kw">final boolean dbgMotionState;
   @Nonnull
   class="kw">protected class="kw">final T aStar;
   @Nullable
   class="kw">protected class="kw">final AStarDebugBase aStarDebug;
   class="kw">protected class="kw">final PathFollower pathFollower = new PathFollower();
   class="kw">protected class="kw">final ProbeMoveData probeMoveData = new ProbeMoveData();
   class="kw">protected AStarNodePoolProvider sharedNodePoolProvider;
   class="kw">protected int throttleCount;
   class="kw">protected double throttleTime;
   class="kw">protected double targetDeltaSquared;
   class="kw">protected boolean wasSteering;
   class="kw">protected double throttleDelay;
   class="kw">protected boolean passedWaypoint;
   class="kw">protected boolean wasAvoidingBlockDamage;
   class="kw">protected boolean wasUnableToBreathe;
   class="kw">protected boolean dbgDisplayString;
   class="kw">protected boolean visPath;
   @Nullable
   class="kw">protected DebugSupport cachedDebugSupport;
   @Nonnull
   class="kw">protected class="kw">final EnumSet<RelaxedConstraint> cachedEffectiveConstraints;
   class="kw">protected class="kw">final Vector3d lastSeekVisTarget = new Vector3d(Double.NaN, Double.NaN, Double.NaN);
   class="kw">protected StringBuilder debugString;

   class="kw">public BodyMotionFindBase(@Nonnull BuilderBodyMotionFindBase var1, @Nonnull BuilderSupport var2, @Nonnull T var3) {
      super(var1);
      this.aStar = var3;
      this.useBestPath = var1.getUseBestPath(var2);
      this.nodesPerTick = var1.getNodesPerTick(var2);
      this.usePathfinder = var1.isUsePathfinder(var2);
      this.useSteering = var1.isUseSteering(var2);
      this.skipSteering = var1.isSkipSteering(var2);
      this.canSkipSteering = this.skipSteering || this.usePathfinder;
      this.minPathLength = var1.getMinPathLength(var2);
      this.minPathLengthSquared = this.minPathLength * this.minPathLength;
      double[] var4 = var1.getThrottleDelayRange(var2);
      this.throttleDelayMin = var4[0];
      this.throttleDelayMax = var4[1];
      this.throttleIgnoreCount = var1.getThrottleIgnoreCount(var2);
      boolean var5 = var1.isLegacyRelaxedMoveConstraints(var2);
      boolean var6 = !var1.isRelaxedConstraintsPresent();
      EnumSet var7 = var1.getRelaxedConstraints(var2);
      boolean var8 = var1.isAvoidingBlockDamage(var2);
      this.cachedEffectiveConstraints = computeEffectiveRelaxedConstraints(var6, var7, var5, var8);
      this.desiredAltitudeWeight = var1.getDesiredAltitudeWeight(var2);
      this.probeMoveData.setRelaxedConstraints(this.cachedEffectiveConstraints);
      this.pathFollower.setPathSmoothing(var1.getPathSmoothing(var2));
      this.pathFollower.setRelativeSpeed(var1.getRelativeSpeed(var2));
      this.pathFollower.setRelativeSpeedWaypoint(var1.getRelativeSpeedWaypoint(var2));
      this.pathFollower.setWaypointRadius(var1.getWaypointRadius(var2));
      this.pathFollower.setRejectionWeight(var1.getRejectionWeight(var2));
      this.pathFollower.setBlendHeading(var1.getBlendHeading(var2));
      this.aStar.setMaxPathLength(var1.getMaxPathLength(var2));
      this.aStar.setOpenNodesLimit(var1.getMaxOpenNodes(var2));
      this.aStar.setTotalNodesLimit(var1.getMaxTotalNodes(var2));
      this.aStar.setCanMoveDiagonal(var1.isDiagonalMoves(var2));
      this.aStar.setOptimizedBuildPath(var1.isBuildOptimisedPath(var2));
      EnumSet var9 = var1.getParsedDebugFlags();
      this.dbgRebuild = var9.contains(BodyMotionFindBase.DebugFlags.Rebuild);
      this.dbgNodes = var9.contains(BodyMotionFindBase.DebugFlags.Nodes);
      this.dbgProfile = var9.contains(BodyMotionFindBase.DebugFlags.Profile);
      this.dbgPath = var9.contains(BodyMotionFindBase.DebugFlags.Path);
      this.dbgOpens = var9.contains(BodyMotionFindBase.DebugFlags.Opens);
      this.dbgMaps = var9.contains(BodyMotionFindBase.DebugFlags.Maps);
      this.dbgStatus = var9.contains(BodyMotionFindBase.DebugFlags.Status);
      this.dbgStay = var9.contains(BodyMotionFindBase.DebugFlags.Stay);
      this.dbgMotionState = var9.contains(BodyMotionFindBase.DebugFlags.Motion);
      this.dbgDisplayString = false;
      this.aStarDebug = !this.dbgPath && !this.dbgOpens && !this.dbgMaps ? null : var3.createDebugHelper(HytaleLogger.forEnclosingClass());
      this.pathFollower.setDebugNodes(this.dbgNodes);
   }

   @Nullable
   @Override
   class="kw">public EnumSet<RelaxedConstraint> getRelaxedConstraints() {
      class="kw">return this.cachedEffectiveConstraints;
   }

   @Override
   class="kw">public void activate(@Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      TransformComponent var4 = var3.getComponent(var1, TransformComponent.getComponentType());
      assert var4 != null;
      MotionController var5 = var2.getMotionContextSupport().getActiveMotionController();
      DebugSupport var6 = var2.getDebugSupport();
      this.sharedNodePoolProvider = var3.getResource(AStarNodePoolProviderSimple.getResourceType());
      this.dbgDisplayString = var6.getDebugFlags().contains(RoleDebugFlags.Pathfinder);
      this.visPath = var6.isVisPath();
      this.cachedDebugSupport = var6;
      var6.registerDebugFlagsListener(this);
      this.setNavStateInit(var5);
      this.wasSteering = false;
      this.wasAvoidingBlockDamage = !this.cachedEffectiveConstraints.contains(RelaxedConstraint.DAMAGE) && var5.isAvoidingBlockDamage();
      this.wasUnableToBreathe = !var2.getPositionCache().couldBreatheCached();
      this.aStar.setStartPosition(var4.getPosition());
   }

   @Override
   class="kw">public void deactivate(@Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      var2.getDebugSupport().removeDebugFlagsListener(this);
      var2.getDebugSupport().clearPathVisualization();
      this.cachedDebugSupport = null;
      this.lastSeekVisTarget.x = this.lastSeekVisTarget.y = this.lastSeekVisTarget.z = Double.NaN;
      this.pathFollower.clearPath();
      this.aStar.clearPath();
   }

   @Override
   class="kw">public boolean computeSteering(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull ExecutionSupport var2,
      @Nullable InfoProvider var3,
      double var4,
      @Nonnull Steering var6,
      @Nonnull ComponentAccessor<EntityStore> var7
   ) {
      var6.clear();
      MotionController var8 = var2.getMotionContextSupport().getActiveMotionController();
      TransformComponent var9 = var7.getComponent(var1, TransformComponent.getComponentType());
      assert var9 != null;
      Vector3d var10 = var9.getPosition();
      if (!this.canComputeMotion(var1, var2, var3, var7)) {
         this.setNavStateAborted(var8);
         this.wasSteering = false;
         class="kw">return false;
      }

      var8.setRelaxedMoveConstraints(this.cachedEffectiveConstraints);
      this.probeMoveData.setRelaxedConstraints(this.cachedEffectiveConstraints);
      applyEscapeConstraints(var2, this.probeMoveData);
      if (this.isGoalReached(var1, var8, var10, var7)) {
         this.setNavStateAtGoal(var2.getMotionContextSupport().getActiveMotionController());
         this.wasSteering = false;
         if (this.dbgMotionState) {
            ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: At Goal");
         }

         class="kw">return false;
      } else {
         if (this.throttleCount > this.throttleIgnoreCount) {
            this.throttleTime += var4;
         }

         this.throttleDelay -= var4;
         if (this.throttleDelay > 0.0) {
            this.wasSteering = false;
            if (!this.mustAbortThrottling(var8, var1)) {
               this.onThrottling(var8, var1, var6, var7);
               this.setNavStateThrottling(var8);
               if (this.dbgMotionState) {
                  ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Delaying");
               }

               class="kw">return true;
            }

            this.resetThrottleCount();
         }

         boolean var11 = !var8.isObstructed();
         if (this.passedWaypoint && this.pathFollower.getCurrentWaypoint() != null && this.useSteering && var11) {
            if (this.canSwitchToSteering(var1, var8, var7)) {
               if (this.dbgMotionState) {
                  ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Switch to steering");
               }

               this.forceRecomputePath(var8);
               this.wasSteering = true;
            }

            this.passedWaypoint = false;
         }

         if (this.pathFollower.getCurrentWaypoint() == null && !this.aStar.isComputing() && this.useSteering) {
            if (var11
               && (this.wasSteering || !this.canSkipSteering || !this.shouldSkipSteering(var1, var8, var10, var7))
               && this.computeSteering(var1, var2, var10, var6, var7)) {
               this.setNavStateSteering(var2.getMotionContextSupport().getActiveMotionController());
               this.onSteering(var8, var1, var7);
               this.wasSteering = true;
               if (this.visPath && this.cachedDebugSupport != null) {
                  Vector3d var15 = this.getSteeringTargetPosition();
                  if (var15 != null && !var15.equals(this.lastSeekVisTarget)) {
                     this.cachedDebugSupport.clearPathVisualization();
                     this.cachedDebugSupport.recordPathWaypoint(var15, true, true, true);
                     this.lastSeekVisTarget.set(var15);
                  }
               }

               if (this.dbgMotionState) {
                  ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Steering");
               }

               class="kw">return true;
            }

            if (!this.usePathfinder) {
               this.setNavStateBlocked(var2.getMotionContextSupport().getActiveMotionController());
               this.wasSteering = false;
               if (this.dbgMotionState) {
                  ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Blocked");
               }

               class="kw">return false;
            }

            if (this.dbgMotionState) {
               ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: End of steering - Fall through path finder");
            }

            this.forceRecomputePath(var8);
         }

         this.wasSteering = false;
         boolean var12 = this.mustRecomputePath(var1, var8, var7);
         boolean var13 = var8.isForceRecomputePath();
         if (var12 || var13) {
            if (this.dbgMotionState) {
               ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100))
                  .log("MotionFindBase: Trigger Recomputing path reason mustRecompute=%s forceRecompute=%s", var12, var13);
            }

            this.forceRecomputePath(var8);
         }

         if (this.pathFollower.getCurrentWaypoint() != null) {
            this.updatePathFollower(var1, var10, var8, var7);
            if (this.dbgMotionState) {
               ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Updating path follower");
            }
         }

         if (this.pathFollower.pathInFinalStage() && var8.canSteer(var1, var7)) {
            if (this.pathFollower.getCurrentWaypoint() == null) {
               if (this.aStar.getPath() != null) {
                  this.setPath(var1, var10, var8, var7);
                  if (this.dbgMotionState) {
                     ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: End of path - Precomputed exists");
                  }
               } else if (!this.aStar.isComputing()) {
                  if (var11 && (!this.canSkipSteering || !this.shouldSkipSteering(var1, var8, var10, var7))) {
                     this.setNavStateSteering(var8);
                     if (this.dbgMotionState) {
                        ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: End of path - Switch back to steering");
                     }

                     class="kw">return false;
                  }

                  if (this.shouldDeferPathComputation(var8, var10, var7)) {
                     this.onDeferring(var8, var1, var6, var7);
                     this.setNavStateDeferred(var8);
                     if (this.dbgMotionState) {
                        ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: End of path - Deferring computations");
                     }

                     class="kw">return true;
                  }

                  if (!this.startPathFinder(var1, var10, var2, var8, var7)) {
                     this.onNoPathFound(var8);
                     this.setNavStateAborted(var8);
                     if (this.dbgMotionState) {
                        ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: End of path - Start path finder failed");
                     }

                     class="kw">return false;
                  }

                  if (this.dbgMotionState) {
                     ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: End of path - Restarted path finder");
                  }
               }
            } else if (this.pathFollower.isWaypointFrozen()) {
               this.aStar.clearPath();
               Vector3d var14 = this.pathFollower.getCurrentWaypointPosition();
               if (var14.distanceSquared(var10) < 1.0) {
                  this.pathFollower.setWaypointFrozen(false);
                  if (this.canSkipSteering && this.shouldSkipSteering(var1, var8, var14, var7)) {
                     this.startPathFinder(var1, var10, var2, var8, var7);
                     if (this.dbgMotionState) {
                        ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Early start path computation");
                     }
                  } else if (this.dbgMotionState) {
                     ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Skipped early start path computation");
                  }
               }
            }
         }

         if (this.aStar.isComputing() && this.continuePathFinder(var1, var8, var7)) {
            if (this.pathFollower.getCurrentWaypoint() == null) {
               this.setNavStateComputing(var8);
               if (this.dbgMotionState) {
                  ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Computing - no follower");
               }

               class="kw">return true;
            }

            if (this.dbgMotionState) {
               ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Computing");
            }
         }

         if (this.pathFollower.getCurrentWaypoint() == null) {
            if (this.aStar.getPath() == null) {
               this.setNavStateThrottling(var8);
               if (this.dbgMotionState) {
                  ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: No path - throttling");
               }

               class="kw">return false;
            }

            this.setPath(var1, var10, var8, var7);
            if (this.dbgMotionState) {
               ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: No path - setting new path");
            }
         }

         if (var8.canSteer(var1, var7) && !this.dbgStay) {
            this.pathFollower.executePath(var10, var8, var6);
            if (this.dbgMotionState) {
               ((HytaleLogger.Api)NPCPlugin.get().getLogger().at(Level.INFO).every(100)).log("MotionFindBase: Executing path");
            }
         }

         this.setNavStateFollowing(var8);
         class="kw">return true;
      }
   }

   class="kw">public class="kw">abstract void findBestPath(AStarBase var1, MotionController var2);

   class="kw">protected boolean startPathFinder(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Vector3d var2,
      ExecutionSupport var3,
      @Nonnull MotionController var4,
      @Nonnull ComponentAccessor<EntityStore> var5
   ) {
      if (this.dbgProfile) {
         long var6 = System.nanoTime();
         AStarBase.Progress var8 = this.startComputePath(var1, var3, var4, var2, var5);
         if (var8 == AStarBase.Progress.COMPUTING) {
            var8 = this.aStar.computePath(var1, var4, this.probeMoveData, Integer.MAX_VALUE, var5);
         }

         var6 = System.nanoTime() - var6;
         NPCPlugin.get().getLogger().at(Level.INFO).log("Path computation profile %s in %s", var8.toString(), var6 / 1000L);
         if (var8 != AStarBase.Progress.ACCOMPLISHED) {
            class="kw">return false;
         }

         if (this.dbgPath) {
            this.aStarDebug.dumpPath();
            this.aStarDebug.dumpMap(true, var4);
         }
      } else {
         AStarBase.Progress var10 = this.startComputePath(var1, var3, var4, var2, var5);
         if (var10 != AStarBase.Progress.COMPUTING) {
            if (this.dbgStatus) {
               NPCPlugin.get().getLogger().at(Level.INFO).log("Path computation start failed %s", var10.toString());
            }

            class="kw">return false;
         }
      }

      class="kw">return true;
   }

   class="kw">protected boolean continuePathFinder(@Nonnull Ref<EntityStore> var1, @Nonnull MotionController var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      AStarBase.Progress var4 = this.aStar.computePath(var1, var2, this.probeMoveData, this.nodesPerTick, var3);
      if (var4 == AStarBase.Progress.COMPUTING) {
         this.setNavStateComputing(var2);
         if (this.dbgOpens) {
            this.aStarDebug.dumpOpens(var2);
         }

         if (this.dbgMaps) {
            this.aStarDebug.dumpMap(true, var2);
         }

         class="kw">return true;
      } else {
         if (var4 == AStarBase.Progress.ACCOMPLISHED) {
            this.resetThrottleCount();
         } else if (this.useBestPath) {
            this.findBestPath(this.aStar, var2);
            this.throttleCount++;
            if (this.aStar.getPath() != null) {
               var4 = AStarBase.Progress.ACCOMPLISHED;
            }
         }

         if (var4 != AStarBase.Progress.ACCOMPLISHED) {
            if (this.dbgStatus) {
               NPCPlugin.get().getLogger().at(Level.INFO).log("Path computation failed %s", var4.toString());
            }

            this.aStar.clearPath();
            this.onNoPathFound(var2);
            class="kw">return false;
         } else {
            double var5 = this.aStar.getEndPosition().distanceSquared(this.aStar.getPosition());
            if (var5 < this.minPathLengthSquared) {
               if (this.dbgStatus) {
                  NPCPlugin.get().getLogger().at(Level.INFO).log("Path computation failed. Path to short length=%s", Math.sqrt(var5));
               }

               this.aStar.clearPath();
               this.onNoPathFound(var2);
               class="kw">return false;
            } else {
               if (this.dbgPath) {
                  this.aStarDebug.dumpPath();
               }

               if (this.dbgPath || this.dbgMaps) {
                  this.aStarDebug.dumpMap(true, var2);
               }

               class="kw">return false;
            }
         }
      }
   }

   class="kw">protected boolean updatePathFollower(
      @Nonnull Ref<EntityStore> var1, @Nonnull Vector3d var2, @Nonnull MotionController var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      if (!this.pathFollower.updateCurrentTarget(var2, var3)) {
         if (this.visPath && this.cachedDebugSupport != null) {
            this.cachedDebugSupport.clearPathVisualization();
         }

         class="kw">return false;
      } else {
         if (this.pathFollower.shouldSmoothPath()) {
            this.passedWaypoint = true;
            this.pathFollower.smoothPath(var1, var2, var3, this.probeMoveData, var4);
            if (this.visPath && this.cachedDebugSupport != null) {
               this.recordPathVisualization(this.cachedDebugSupport);
            }
         }

         class="kw">return true;
      }
   }

   class="kw">protected boolean canSwitchToSteering(@Nonnull Ref<EntityStore> var1, MotionController var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      class="kw">return false;
   }

   class="kw">protected boolean shouldSkipSteering(@Nonnull Ref<EntityStore> var1, MotionController var2, Vector3d var3, @Nonnull ComponentAccessor<EntityStore> var4) {
      class="kw">return !this.useSteering;
   }

   class="kw">protected boolean computeSteering(
      @Nonnull Ref<EntityStore> var1, ExecutionSupport var2, Vector3d var3, Steering var4, @Nonnull ComponentAccessor<EntityStore> var5
   ) {
      class="kw">return false;
   }

   @Nullable
   class="kw">protected Vector3d getSteeringTargetPosition() {
      class="kw">return null;
   }

   class="kw">protected boolean scaleSteering(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull ExecutionSupport var2,
      @Nonnull SteeringForceWithTarget var3,
      @Nonnull Steering var4,
      double var5,
      @Nonnull ComponentAccessor<EntityStore> var7
   ) {
      MotionController var8 = var2.getMotionContextSupport().getActiveMotionController();
      boolean var9 = !var8.is2D() && var5 > 0.0;
      boolean var10 = var9 && var8.getDesiredVerticalRange(var1, var7).isWithinRange();
      if (var10) {
         var3.setComponentSelector(var2.getMotionContextSupport().getActiveMotionController().getPlanarComponentSelector());
      } else {
         var3.setComponentSelector(var2.getMotionContextSupport().getActiveMotionController().getComponentSelector());
      }

      if (!var3.compute(var4)) {
         class="kw">return false;
      }

      var4.scaleTranslation(this.getRelativeSpeed());
      if (var9 && !var10) {
         MotionController.VerticalRange var11 = var8.getDesiredVerticalRange(var1, var7);
         if (var11.current > var11.max) {
            var4.setY(-this.computeDesiredYTranslation(var4, var8.getMaxSinkAngle(), var5));
         } else if (var11.current < var11.min) {
            var4.setY(this.computeDesiredYTranslation(var4, var8.getMaxClimbAngle(), var5));
         }
      }

      class="kw">return true;
   }

   class="kw">protected double computeDesiredYTranslation(@Nonnull Steering var1, float var2, double var3) {
      double var5 = var1.getX();
      double var7 = var1.getZ();
      double var9 = Math.sqrt(var5 * var5 + var7 * var7);
      class="kw">return var9 * TrigMathUtil.sin(var2 * var3);
   }

   class="kw">protected void onNoPathFound(MotionController var1) {
      this.aStar.clearPath();
   }

   class="kw">protected void onBlockedPath() {
   }

   class="kw">protected void onSteering(MotionController var1, Ref<EntityStore> var2, ComponentAccessor<EntityStore> var3) {
   }

   class="kw">protected void onThrottling(MotionController var1, Ref<EntityStore> var2, Steering var3, ComponentAccessor<EntityStore> var4) {
   }

   class="kw">protected void onDeferring(MotionController var1, Ref<EntityStore> var2, Steering var3, ComponentAccessor<EntityStore> var4) {
   }

   class="kw">protected boolean mustAbortThrottling(MotionController var1, Ref<EntityStore> var2) {
      class="kw">return false;
   }

   class="kw">protected class="kw">abstract boolean isGoalReached(Ref<EntityStore> var1, MotionController var2, Vector3d var3, ComponentAccessor<EntityStore> var4);

   class="kw">protected void setNavState(NavState var1, String var2, boolean var3, @Nonnull MotionController var4) {
      if (var3) {
         this.resetThrottleCount();
         this.targetDeltaSquared = 0.0;
         this.forceRecomputePath(var4);
      }

      var4.setNavState(var1, this.throttleTime, this.targetDeltaSquared);
      if (this.dbgDisplayString && this.cachedDebugSupport != null) {
         if (this.debugString == null) {
            this.debugString = new StringBuilder();
         }

         this.debugString.append(var2).append(" TC:").append(this.throttleCount).append(" TT:").append(MathUtil.floor(this.throttleTime * 10.0) / 10.0);
         this.decorateDebugString(this.debugString);
         this.cachedDebugSupport.setDisplayPathfinderString(this.debugString.toString());
         this.debugString.setLength(0);
      }
   }

   class="kw">protected void decorateDebugString(StringBuilder var1) {
   }

   class="kw">protected void setNavStateInit(@Nonnull MotionController var1) {
      this.setNavState(NavState.INIT, "I-START", true, var1);
   }

   class="kw">protected void setNavStateComputing(@Nonnull MotionController var1) {
      this.setNavState(NavState.PROGRESSING, "P-COMPT", false, var1);
   }

   class="kw">protected void setNavStateDeferred(@Nonnull MotionController var1) {
      this.setNavState(NavState.DEFER, "D-DEFER", false, var1);
   }

   class="kw">protected void setNavStateAtGoal(@Nonnull MotionController var1) {
      this.setNavState(NavState.AT_GOAL, "G-GOAL", true, var1);
   }

   class="kw">protected void setNavStateFollowing(@Nonnull MotionController var1) {
      this.setNavState(NavState.PROGRESSING, "P-FOLLW", false, var1);
   }

   class="kw">protected void setNavStateSteering(@Nonnull MotionController var1) {
      this.setNavState(NavState.PROGRESSING, "P-STEER", false, var1);
   }

   class="kw">protected void setNavStateBlocked(@Nonnull MotionController var1) {
      this.setNavState(NavState.BLOCKED, "B-BLOCK", false, var1);
   }

   class="kw">protected void setNavStateAborted(@Nonnull MotionController var1) {
      this.setNavState(NavState.ABORTED, "A-ABORT", true, var1);
   }

   class="kw">protected void setNavStateThrottling(@Nonnull MotionController var1) {
      if (this.throttleDelay <= 0.0 && this.throttleDelayMax > 0.0 && this.throttleCount > this.throttleIgnoreCount) {
         this.throttleDelay = RandomExtra.randomRange(this.throttleDelayMin, this.throttleDelayMax);
      }

      this.setNavState(NavState.PROGRESSING, "P-THRTL", false, var1);
   }

   class="kw">protected void setPath(@Nonnull Ref<EntityStore> var1, @Nonnull Vector3d var2, @Nonnull MotionController var3, @Nonnull ComponentAccessor<EntityStore> var4) {
      AStarNode var5 = this.aStar.getPath();
      this.pathFollower.setPath(var5, var2);
      this.passedWaypoint = false;
      if (this.visPath && this.cachedDebugSupport != null) {
         this.recordPathVisualization(this.cachedDebugSupport);
      }

      this.updatePathFollower(var1, var2, var3, var4);
   }

   class="kw">protected void resetThrottleCount() {
      this.throttleTime = 0.0;
      this.throttleCount = 0;
      this.throttleDelay = 0.0;
   }

   class="kw">protected AStarBase.Progress startComputePath(
      @Nonnull Ref<EntityStore> var1,
      ExecutionSupport var2,
      @Nonnull MotionController var3,
      @Nonnull Vector3d var4,
      @Nonnull ComponentAccessor<EntityStore> var5
   ) {
      class="kw">return this.aStar.initComputePath(var1, var4, this, var3, this.probeMoveData, this.sharedNodePoolProvider, var5);
   }

   class="kw">protected boolean shouldDeferPathComputation(MotionController var1, Vector3d var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      class="kw">return false;
   }

   class="kw">protected boolean canComputeMotion(
      @Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nullable InfoProvider var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      class="kw">return true;
   }

   class="kw">protected boolean mustRecomputePath(@Nonnull Ref<EntityStore> var1, @Nonnull MotionController var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      if (this.dbgRebuild) {
         class="kw">return true;
      }

      if (var2.isObstructed()) {
         if (this.dbgStatus) {
            NPCPlugin.get().getLogger().at(Level.INFO).log("Recomputing Path - Blocked");
         }

         this.onBlockedPath();
         class="kw">return true;
      } else {
         boolean var4 = var2.isAvoidingBlockDamage();
         if (this.wasAvoidingBlockDamage != var4) {
            this.wasAvoidingBlockDamage = var4;
            if (this.dbgStatus) {
               NPCPlugin.get().getLogger().at(Level.INFO).log("Recomputing Path - AvoidBlockDamage changed");
            }

            class="kw">return true;
         } else {
            boolean var5 = !var2.getRole().couldBreatheCached(var1, var3);
            if (this.wasUnableToBreathe && !var5) {
               this.wasUnableToBreathe = false;
               if (this.dbgStatus) {
                  NPCPlugin.get().getLogger().at(Level.INFO).log("Recomputing Path - Recovered breathing");
               }

               class="kw">return true;
            } else {
               this.wasUnableToBreathe = var5;
               class="kw">return false;
            }
         }
      }
   }

   class="kw">protected double getRelativeSpeed() {
      class="kw">return this.pathFollower.getRelativeSpeed();
   }

   class="kw">protected void forceRecomputePath(MotionController var1) {
      this.aStar.clearPath();
      this.pathFollower.clearPath();
   }

   @Override
   class="kw">public void onDebugFlagsChanged(EnumSet<RoleDebugFlags> var1) {
      boolean var2 = this.visPath;
      this.visPath = var1.contains(RoleDebugFlags.VisPath);
      this.dbgDisplayString = var1.contains(RoleDebugFlags.Pathfinder);
      if (this.visPath && !var2 && this.cachedDebugSupport != null && this.pathFollower.getCurrentWaypoint() != null) {
         this.recordPathVisualization(this.cachedDebugSupport);
      }
   }

   class="kw">protected void recordPathVisualization(@Nonnull DebugSupport var1) {
      var1.clearPathVisualization();
      this.lastSeekVisTarget.x = this.lastSeekVisTarget.y = this.lastSeekVisTarget.z = Double.NaN;
      IWaypoint var2 = this.pathFollower.getCurrentWaypoint();
      if (var2 != null) {
         for (boolean var3 = true; var2 != null; var3 = false) {
            IWaypoint var4 = var2.next();
            var1.recordPathWaypoint(var2.getPosition(), var3, var4 == null);
            var2 = var4;
         }
      }
   }

   class="kw">public enum DebugFlags class="kw">implements Supplier<String> {
      Opens("Display open nodes each step when computing"),
      Maps("Display map each step when computing"),
      Path("Display map when path was found"),
      Status("Display status messages"),
      Rebuild("Force immediate rebuild of path"),
      Profile("Measure time for path finding"),
      Nodes("Display walk node information"),
      Motion("Display Motion state changes"),
      Stay("Don't move. Only compute path");

      class="kw">private class="kw">final String description;

      DebugFlags(String nullxx) {
         this.description = nullxx;
      }

      class="kw">public String get() {
         class="kw">return this.description;
      }
   }
}