Class PathNavigation
java.lang.Object
net.minecraft.world.entity.ai.navigation.PathNavigation
- Direct Known Subclasses:
AmphibiousPathNavigation,FlyingPathNavigation,GroundPathNavigation,WaterBoundPathNavigation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the path can be changed byinvalid reference
onUpdateNavigation()private booleanprotected intprotected Vec3protected longprotected final Levelprivate static final intprotected floatprivate floatprotected final Mobprotected NodeEvaluatorprotected Pathprivate final PathFinderprivate intDistance in which a path point counts as target-reachingprotected doubleprivate static final intprivate static final floatprivate BlockPosprotected intprotected longprotected Vec3iprotected doubleprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCutCorner(PathType pathType) booleancanFloat()protected booleancanMoveDirectly(Vec3 posVec31, Vec3 posVec32) Checks if the specified entity can safely walk to the specified location.protected abstract booleanfinal PathcreatePath(double x, double y, double z, int accuracy) Returns path to given BlockPoscreatePath(Set<BlockPos> positions, int distance) protected PathcreatePath(Set<BlockPos> targets, int regionOffset, boolean offsetUpward, int accuracy) Returns a path to one of the given targets or nullprotected PathcreatePath(Set<BlockPos> targets, int regionOffset, boolean offsetUpward, int accuracy, float followRange) createPath(Stream<BlockPos> targets, int accuracy) Returns a path to one of the elements of the stream or nullcreatePath(BlockPos pos, int accuracy) Returns path to given BlockPoscreatePath(BlockPos pos, int regionOffset, int accuracy) createPath(Entity entity, int accuracy) Returns a path to the given entity or nullprotected abstract PathFindercreatePathFinder(int maxVisitedNodes) protected voiddoStuckDetection(Vec3 positionVec3) Checks if entity haven't been moved when last checked and if so, stops the current navigation.protected voidprotected doublegetGroundY(Vec3 vec) floatgetPath()protected abstract Vec3protected static booleanisClearForMovementBetween(Mob mob, Vec3 pos1, Vec3 pos2, boolean allowSwimming) booleanisDone()booleanbooleanbooleanisStuck()booleanmoveTo(double x, double y, double z, double speed) Try to find and set a path to XYZ.booleanmoveTo(double x, double y, double z, int accuracy, double speed) booleanTry to find and set a path to EntityLiving.booleanSets a new path.voidvoidprivate voidvoidsetCanFloat(boolean canSwim) voidsetMaxVisitedNodesMultiplier(float multiplier) voidsetSpeedModifier(double speed) Sets the speedbooleanprivate booleanvoidstop()voidtick()private voidprotected voidtrimPath()
-
Field Details
-
MAX_TIME_RECOMPUTE
private static final int MAX_TIME_RECOMPUTE- See Also:
-
STUCK_CHECK_INTERVAL
private static final int STUCK_CHECK_INTERVAL- See Also:
-
STUCK_THRESHOLD_DISTANCE_FACTOR
private static final float STUCK_THRESHOLD_DISTANCE_FACTOR- See Also:
-
mob
-
level
-
path
-
speedModifier
protected double speedModifier -
tick
protected int tick -
lastStuckCheck
protected int lastStuckCheck -
lastStuckCheckPos
-
timeoutCachedNode
-
timeoutTimer
protected long timeoutTimer -
lastTimeoutCheck
protected long lastTimeoutCheck -
timeoutLimit
protected double timeoutLimit -
maxDistanceToWaypoint
protected float maxDistanceToWaypoint -
hasDelayedRecomputation
protected boolean hasDelayedRecomputationWhether the path can be changed byinvalid reference
onUpdateNavigation() -
timeLastRecompute
protected long timeLastRecompute -
nodeEvaluator
-
targetPos
-
reachRange
private int reachRangeDistance in which a path point counts as target-reaching -
maxVisitedNodesMultiplier
private float maxVisitedNodesMultiplier -
pathFinder
-
isStuck
private boolean isStuck
-
-
Constructor Details
-
PathNavigation
-
-
Method Details
-
resetMaxVisitedNodesMultiplier
public void resetMaxVisitedNodesMultiplier() -
setMaxVisitedNodesMultiplier
public void setMaxVisitedNodesMultiplier(float multiplier) -
getTargetPos
-
createPathFinder
-
setSpeedModifier
public void setSpeedModifier(double speed) Sets the speed -
recomputePath
public void recomputePath() -
createPath
Returns path to given BlockPos -
createPath
Returns a path to one of the elements of the stream or null -
createPath
-
createPath
Returns path to given BlockPos -
createPath
-
createPath
Returns a path to the given entity or null -
createPath
@Nullable protected Path createPath(Set<BlockPos> targets, int regionOffset, boolean offsetUpward, int accuracy) Returns a path to one of the given targets or null -
createPath
-
moveTo
public boolean moveTo(double x, double y, double z, double speed) Try to find and set a path to XYZ. Returnstrueif successful. -
moveTo
public boolean moveTo(double x, double y, double z, int accuracy, double speed) -
moveTo
Try to find and set a path to EntityLiving. Returnstrueif successful. -
moveTo
Sets a new path. If it's different from the old path. Checks to adjust path for sun avoiding, and stores start coords. -
getPath
-
tick
public void tick() -
getGroundY
-
followThePath
protected void followThePath() -
shouldTargetNextNodeInDirection
-
doStuckDetection
Checks if entity haven't been moved when last checked and if so, stops the current navigation. -
timeoutPath
private void timeoutPath() -
resetStuckTimeout
private void resetStuckTimeout() -
isDone
public boolean isDone() -
isInProgress
public boolean isInProgress() -
stop
public void stop() -
getTempMobPos
-
canUpdatePath
protected abstract boolean canUpdatePath() -
trimPath
protected void trimPath() -
canMoveDirectly
Checks if the specified entity can safely walk to the specified location. -
canCutCorner
-
isClearForMovementBetween
-
isStableDestination
-
getNodeEvaluator
-
setCanFloat
public void setCanFloat(boolean canSwim) -
canFloat
public boolean canFloat() -
shouldRecomputePath
-
getMaxDistanceToWaypoint
public float getMaxDistanceToWaypoint() -
isStuck
public boolean isStuck()
-