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 int
currentDistance
protected long
currentNodeMs
protected double
currentNodeTimeout
protected Path
currentPath
private BlockPos
currentTarget
protected MobEntity
entity
protected long
lastActiveTickMs
protected Vec3i
lastNodePosition
protected long
lastRecalculateTime
private boolean
nearPathStartPos
protected PathNodeMaker
nodeMaker
protected float
nodeReachProximity
If 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 PathNodeNavigator
pathNodeNavigator
protected Vec3d
pathStartPos
protected int
pathStartTime
private float
rangeMultiplier
protected boolean
shouldRecalculate
protected double
speed
protected int
tickCount
protected World
world
-
Constructor Summary
Constructors Constructor Description EntityNavigation(MobEntity mob, World world)
-
Method Summary
Modifier and Type Method Description protected void
adjustPath()
Adjusts the current path according to various special obstacles that may be in the way, for example sunlightprotected abstract boolean
canPathDirectlyThrough(Vec3d origin, Vec3d target, int sizeX, int sizeY, int sizeZ)
boolean
canSwim()
protected void
checkTimeouts(Vec3d currentPos)
protected void
continueFollowingPath()
protected abstract PathNodeNavigator
createPathNodeNavigator(int range)
Path
findPathTo(double x, double y, double z, int distance)
Path
findPathTo(Entity entity, int distance)
Path
findPathTo(BlockPos target, int distance)
protected Path
findPathToAny(Set<BlockPos> positions, int range, boolean bool, int distance)
Path
findPathToAny(Stream<BlockPos> positions, int distance)
Path
getCurrentPath()
PathNodeMaker
getNodeMaker()
protected abstract Vec3d
getPos()
The position to act as if the entity is at for pathfinding purposesBlockPos
getTargetPos()
protected abstract boolean
isAtValidPosition()
boolean
isFollowingPath()
boolean
isIdle()
protected boolean
isInLiquid()
boolean
isNearPathStartPos()
boolean
isValidPosition(BlockPos pos)
private boolean
method_27799(Vec3d vec3d)
Path
method_29934(Set<BlockPos> set, int int2)
void
onBlockChanged(BlockPos pos)
void
recalculatePath()
private void
resetNode()
private void
resetNodeAndStop()
void
resetRangeMultiplier()
void
setCanSwim(boolean canSwim)
void
setRangeMultiplier(float rangeMultiplier)
void
setSpeed(double speed)
boolean
shouldRecalculatePath()
boolean
startMovingAlong(Path path, double speed)
boolean
startMovingTo(double x, double y, double z, double speed)
boolean
startMovingTo(Entity entity, double speed)
void
stop()
void
tick()
-
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()
-