Package net.minecraft.entity.ai.pathing
Class EntityNavigation
java.lang.Object
net.minecraft.entity.ai.pathing.EntityNavigation
- Direct Known Subclasses:
BirdNavigation,MobNavigation,SwimNavigation
public abstract class EntityNavigation extends Object
-
Field Summary
Fields Modifier and Type Field Description private intcurrentDistanceprotected longcurrentNodeMsprotected doublecurrentNodeTimeoutprotected PathcurrentPathprivate BlockPoscurrentTargetprotected MobEntityentityprotected longlastActiveTickMsprotected Vec3ilastNodePositionprotected longlastRecalculateTimeprivate booleannearPathStartPosprotected PathNodeMakernodeMakerprotected floatnodeReachProximityIf the Chebyshev distance from the entity to the next node is less than or equal to this value, the entity is considered "reached" the node.private PathNodeNavigatorpathNodeNavigatorprotected Vec3dpathStartPosprotected intpathStartTimeprivate floatrangeMultiplierprotected booleanshouldRecalculateprotected doublespeedprotected inttickCountprotected Worldworld -
Constructor Summary
Constructors Constructor Description EntityNavigation(MobEntity mob, World world) -
Method Summary
Modifier and Type Method Description protected voidadjustPath()Adjusts the current path according to various special obstacles that may be in the way, for example sunlightprotected abstract booleancanPathDirectlyThrough(Vec3d origin, Vec3d target, int sizeX, int sizeY, int sizeZ)booleancanSwim()protected voidcheckTimeouts(Vec3d currentPos)protected voidcontinueFollowingPath()protected abstract PathNodeNavigatorcreatePathNodeNavigator(int range)PathfindPathTo(double x, double y, double z, int distance)PathfindPathTo(Entity entity, int distance)PathfindPathTo(BlockPos target, int distance)protected PathfindPathToAny(Set<BlockPos> positions, int range, boolean bool, int distance)PathfindPathToAny(Stream<BlockPos> positions, int distance)PathgetCurrentPath()PathNodeMakergetNodeMaker()protected abstract Vec3dgetPos()The position to act as if the entity is at for pathfinding purposesBlockPosgetTargetPos()protected abstract booleanisAtValidPosition()booleanisFollowingPath()booleanisIdle()protected booleanisInLiquid()booleanisNearPathStartPos()booleanisValidPosition(BlockPos pos)private booleanmethod_27799(Vec3d vec3d)Pathmethod_29934(Set<BlockPos> set, int int2)voidonBlockChanged(BlockPos pos)voidrecalculatePath()private voidresetNode()private voidresetNodeAndStop()voidresetRangeMultiplier()voidsetCanSwim(boolean canSwim)voidsetRangeMultiplier(float rangeMultiplier)voidsetSpeed(double speed)booleanshouldRecalculatePath()booleanstartMovingAlong(Path path, double speed)booleanstartMovingTo(double x, double y, double z, double speed)booleanstartMovingTo(Entity entity, double speed)voidstop()voidtick()
-
Field Details
-
entity
-
world
-
currentPath
-
speed
protected double speed -
tickCount
protected int tickCount -
pathStartTime
protected int pathStartTime -
pathStartPos
-
lastNodePosition
-
currentNodeMs
protected long currentNodeMs -
lastActiveTickMs
protected long lastActiveTickMs -
currentNodeTimeout
protected double currentNodeTimeout -
nodeReachProximity
protected float nodeReachProximityIf the Chebyshev distance from the entity to the next node is less than or equal to this value, the entity is considered "reached" the node. -
shouldRecalculate
protected boolean shouldRecalculate -
lastRecalculateTime
protected long lastRecalculateTime -
nodeMaker
-
currentTarget
-
currentDistance
private int currentDistance -
rangeMultiplier
private float rangeMultiplier -
nearPathStartPos
private boolean nearPathStartPos
-
-
Constructor Details
-
EntityNavigation
-
-
Method Details
-
resetRangeMultiplier
public void resetRangeMultiplier() -
setRangeMultiplier
public void setRangeMultiplier(float rangeMultiplier) -
getTargetPos
-
setSpeed
public void setSpeed(double speed) -
shouldRecalculatePath
public boolean shouldRecalculatePath() -
recalculatePath
public void recalculatePath() -
findPathTo
-
findPathToAny
-
method_29934
-
findPathTo
-
findPathTo
-
findPathToAny
-
startMovingTo
public boolean startMovingTo(double x, double y, double z, double speed) -
startMovingTo
-
startMovingAlong
-
getCurrentPath
-
tick
public void tick() -
continueFollowingPath
protected void continueFollowingPath() -
method_27799
-
checkTimeouts
-
resetNodeAndStop
private void resetNodeAndStop() -
resetNode
private void resetNode() -
isIdle
public boolean isIdle() -
isFollowingPath
public boolean isFollowingPath() -
stop
public void stop() -
getPos
The position to act as if the entity is at for pathfinding purposes -
isAtValidPosition
protected abstract boolean isAtValidPosition() -
isInLiquid
protected boolean isInLiquid() -
adjustPath
protected void adjustPath()Adjusts the current path according to various special obstacles that may be in the way, for example sunlight -
canPathDirectlyThrough
-
isValidPosition
-
getNodeMaker
-
setCanSwim
public void setCanSwim(boolean canSwim) -
canSwim
public boolean canSwim() -
onBlockChanged
-
isNearPathStartPos
public boolean isNearPathStartPos()
-