Class PathNavigation
java.lang.Object
net.minecraft.world.entity.ai.navigation.PathNavigation
- Direct Known Subclasses:
AmphibiousPathNavigation
,FlyingPathNavigation
,GroundPathNavigation
,WaterBoundPathNavigation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Whether the path can be changed byinvalid reference
onUpdateNavigation()
private boolean
protected int
protected Vec3
protected long
protected final Level
private static final int
protected float
private float
protected final Mob
protected NodeEvaluator
protected Path
private final PathFinder
private int
Distance in which a path point counts as target-reachingprotected double
private static final int
private static final float
private BlockPos
protected int
protected long
protected Vec3i
protected double
protected long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCutCorner
(PathType pPathType) boolean
canFloat()
protected boolean
canMoveDirectly
(Vec3 pPosVec31, Vec3 pPosVec32) Checks if the specified entity can safely walk to the specified location.protected abstract boolean
final Path
createPath
(double pX, double pY, double pZ, int pAccuracy) Returns path to given BlockPoscreatePath
(Set<BlockPos> pPositions, int pDistance) protected Path
createPath
(Set<BlockPos> pTargets, int pRegionOffset, boolean pOffsetUpward, int pAccuracy) Returns a path to one of the given targets or nullprotected Path
createPath
(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 PathFinder
createPathFinder
(int pMaxVisitedNodes) protected void
doStuckDetection
(Vec3 pPositionVec3) Checks if entity haven't been moved when last checked and if so, stops the current navigation.protected void
protected double
getGroundY
(Vec3 pVec) float
getPath()
protected abstract Vec3
protected static boolean
isClearForMovementBetween
(Mob pMob, Vec3 pPos1, Vec3 pPos2, boolean pAllowSwimming) boolean
isDone()
boolean
boolean
isStableDestination
(BlockPos pPos) boolean
isStuck()
boolean
moveTo
(double pX, double pY, double pZ, double pSpeed) Try to find and set a path to XYZ.boolean
moveTo
(double pX, double pY, double pZ, int pAccuracy, double pSpeed) boolean
Try to find and set a path to EntityLiving.boolean
Sets a new path.void
void
private void
void
setCanFloat
(boolean pCanSwim) void
setMaxVisitedNodesMultiplier
(float pMultiplier) void
setSpeedModifier
(double pSpeed) Sets the speedboolean
shouldRecomputePath
(BlockPos pPos) private boolean
void
stop()
void
tick()
private void
protected void
trimPath()
-
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 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. Returnstrue
if 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. Returnstrue
if 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()
-