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-reachingprivate floatprotected doubleprivate static final intprivate static final floatprivate BlockPosprotected intprotected longprotected Vec3iprotected doubleprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCutCorner(PathType pPathType) booleancanFloat()protected booleancanMoveDirectly(Vec3 pPosVec31, Vec3 pPosVec32) Checks if the specified entity can safely walk to the specified location.abstract booleanprotected abstract booleanfinal PathcreatePath(double pX, double pY, double pZ, int pAccuracy) Returns path to given BlockPoscreatePath(Set<BlockPos> pPositions, int pDistance) protected PathcreatePath(Set<BlockPos> pTargets, int pRegionOffset, boolean pOffsetUpward, int pAccuracy) Returns a path to one of the given targets or nullprotected PathcreatePath(Set<BlockPos> pTargets, int pRegionOffset, boolean pOffsetUpward, int pAccuracy, float pFollowRange) createPath(Stream<BlockPos> pTargets, int pAccuracy) Returns a path to one of the elements of the stream or nullcreatePath(BlockPos pPos, int pAccuracy) Returns path to given BlockPoscreatePath(BlockPos pPos, int pRegionOffset, int pAccuracy) createPath(Entity pEntity, int pAccuracy) Returns a path to the given entity or nullprotected abstract PathFindercreatePathFinder(int pMaxVisitedNodes) protected voiddoStuckDetection(Vec3 pPositionVec3) Checks if entity haven't been moved when last checked and if so, stops the current navigation.protected voidprotected doublegetGroundY(Vec3 pVec) floatprivate floatgetPath()protected abstract Vec3protected static booleanisClearForMovementBetween(Mob pMob, Vec3 pPos1, Vec3 pPos2, boolean pAllowSwimming) booleanisDone()booleanbooleanisStableDestination(BlockPos pPos) booleanisStuck()booleanmoveTo(double pX, double pY, double pZ, double pSpeed) Try to find and set a path to XYZ.booleanmoveTo(double pX, double pY, double pZ, int pAccuracy, double pSpeed) booleanTry to find and set a path to EntityLiving.booleanSets a new path.voidvoidprivate voidvoidsetCanFloat(boolean pCanSwim) voidsetCanOpenDoors(boolean pCanOpenDoors) voidsetMaxVisitedNodesMultiplier(float pMultiplier) voidsetRequiredPathLength(float pRequiredPathLength) voidsetSpeedModifier(double pSpeed) Sets the speedbooleanshouldRecomputePath(BlockPos pPos) private booleanvoidstop()voidtick()private voidprotected voidtrimPath()void
-
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 -
requiredPathLength
private float requiredPathLength
-
-
Constructor Details
-
PathNavigation
-
-
Method Details
-
updatePathfinderMaxVisitedNodes
public void updatePathfinderMaxVisitedNodes() -
setRequiredPathLength
public void setRequiredPathLength(float pRequiredPathLength) -
getMaxPathLength
private float getMaxPathLength() -
resetMaxVisitedNodesMultiplier
public void resetMaxVisitedNodesMultiplier() -
setMaxVisitedNodesMultiplier
public void setMaxVisitedNodesMultiplier(float pMultiplier) -
getTargetPos
-
createPathFinder
-
setSpeedModifier
public void setSpeedModifier(double pSpeed) 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> pTargets, int pRegionOffset, boolean pOffsetUpward, int pAccuracy) Returns a path to one of the given targets or null -
createPath
-
moveTo
public boolean moveTo(double pX, double pY, double pZ, double pSpeed) Try to find and set a path to XYZ. Returnstrueif successful. -
moveTo
public boolean moveTo(double pX, double pY, double pZ, int pAccuracy, double pSpeed) -
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 pCanSwim) -
canFloat
public boolean canFloat() -
shouldRecomputePath
-
getMaxDistanceToWaypoint
public float getMaxDistanceToWaypoint() -
isStuck
public boolean isStuck() -
setCanOpenDoors
public void setCanOpenDoors(boolean pCanOpenDoors)
-