Class AbstractAdvancedPathNavigate
java.lang.Object
net.minecraft.world.entity.ai.navigation.PathNavigation
net.minecraft.world.entity.ai.navigation.GroundPathNavigation
com.minecolonies.core.entity.pathfinding.navigation.AbstractAdvancedPathNavigate
- Direct Known Subclasses:
MinecoloniesAdvancedPathNavigate
public abstract class AbstractAdvancedPathNavigate
extends net.minecraft.world.entity.ai.navigation.GroundPathNavigation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Nullable net.minecraft.core.BlockPosprotected final net.minecraft.world.entity.Mobprotected doubleFields inherited from class net.minecraft.world.entity.ai.navigation.PathNavigation
hasDelayedRecomputation, lastStuckCheck, lastStuckCheckPos, lastTimeoutCheck, level, maxDistanceToWaypoint, mob, nodeEvaluator, path, speedModifier, tick, timeLastRecompute, timeoutCachedNode, timeoutLimit, timeoutTimer -
Constructor Summary
ConstructorsConstructorDescriptionAbstractAdvancedPathNavigate(net.minecraft.world.entity.Mob entityLiving, net.minecraft.world.level.Level worldIn) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.entity.MobGet the entity of this navigatorGet the pathing optionsabstract PathResultGets the current path resultprotected abstract PathResult<? extends IPathJob> moveAwayFromLivingEntity(net.minecraft.world.entity.Entity target, double distance, double combatMovementSpeed) Used to path away from a ourEntity.protected abstract voidsetPauseTicks(int pauseTicks) Sets the navigation to not accept new jobs for a timeabstract voidsetSafeDestinationPos(net.minecraft.core.BlockPos pos) Sets the desired position to reach, used also for stuckhandlingabstract voidsetStuckHandler(IStuckHandler stuckHandler) Sets the stuck handler for this navigatorabstract voidsetSwimSpeedFactor(double factor) protected abstract PathResult<? extends IPathJob> walkAwayFrom(net.minecraft.core.BlockPos currentPosition, double range, double speed, boolean safeDestination) Used to path away from a position.protected abstract PathResult<PathJobMoveCloseToXNearY> walkCloseToXNearY(net.minecraft.core.BlockPos desiredPosition, net.minecraft.core.BlockPos nearbyPosition, int distToDesired, double speedFactor, boolean safeDestination) Walks towards the desired position, while trying to not steer too far from the nearby positionprotected abstract booleanwalkTo(net.minecraft.core.BlockPos position, double speed) Attempt to move to a specific pos.protected abstract PathResult<? extends IPathJob> walkTo(net.minecraft.core.BlockPos pos, double speed, boolean safeDestination) Try to move to a certain position.protected abstract PathResult<? extends IPathJob> walkToEntity(@NotNull net.minecraft.world.entity.Entity e, double speed) Used to walk a living ourEntity with a speed.protected abstract PathResult<? extends IPathJob> walkToRandomPos(int range, double speed) Used to path towards a random pos.protected abstract PathResult<? extends IPathJob> walkToRandomPos(int range, double speed, net.minecraft.util.Tuple<net.minecraft.core.BlockPos, net.minecraft.core.BlockPos> corners) Used to path towards a random pos within some restrictionsprotected abstract PathResult<PathJobRandomPos> walkToRandomPos(int range, double speed, net.minecraft.util.Tuple<net.minecraft.core.BlockPos, net.minecraft.core.BlockPos> corners, boolean preferInside) Used to path towards a random pos within some restrictionsprotected abstract PathResult<? extends IPathJob> walkToRandomPosAround(int range, double speed, net.minecraft.core.BlockPos pos) Used to path towards a random pos.abstract TreePathResultwalkToTree(int range, double speed, List<ItemStorage> excludedTrees, int dyntreesize, IColony colony) Used to find a tree.abstract TreePathResultwalkToTree(net.minecraft.core.BlockPos startRestriction, net.minecraft.core.BlockPos endRestriction, double speed, List<ItemStorage> excludedTrees, int dyntreesize, IColony colony) Used to find a tree.protected abstract @Nullable PathResult<AbstractPathJob> walkTowards(net.minecraft.core.BlockPos towards, double range, double speedFactor) Attemps to move in the given direction, walking at least range blocksMethods inherited from class net.minecraft.world.entity.ai.navigation.GroundPathNavigation
canOpenDoors, canPassDoors, canUpdatePath, createPath, createPath, createPathFinder, getTempMobPos, hasValidPathType, setAvoidSun, setCanOpenDoors, setCanPassDoors, setCanWalkOverFences, trimPathMethods inherited from class net.minecraft.world.entity.ai.navigation.PathNavigation
canCutCorner, canFloat, canMoveDirectly, createPath, createPath, createPath, createPath, createPath, createPath, doStuckDetection, followThePath, getGroundY, getMaxDistanceToWaypoint, getNodeEvaluator, getPath, getTargetPos, isClearForMovementBetween, isDone, isInProgress, isStableDestination, isStuck, moveTo, moveTo, moveTo, moveTo, recomputePath, resetMaxVisitedNodesMultiplier, setCanFloat, setMaxVisitedNodesMultiplier, setSpeedModifier, shouldRecomputePath, stop, tick
-
Field Details
-
ourEntity
protected final net.minecraft.world.entity.Mob ourEntity -
walkSpeedFactor
protected double walkSpeedFactor -
originalDestination
@Nullable protected @Nullable net.minecraft.core.BlockPos originalDestination
-
-
Constructor Details
-
AbstractAdvancedPathNavigate
public AbstractAdvancedPathNavigate(net.minecraft.world.entity.Mob entityLiving, net.minecraft.world.level.Level worldIn)
-
-
Method Details
-
walkAwayFrom
protected abstract PathResult<? extends IPathJob> walkAwayFrom(net.minecraft.core.BlockPos currentPosition, double range, double speed, boolean safeDestination) Used to path away from a position.- Parameters:
currentPosition- the position to avoid.range- the range he should move out of.speed- the speed to run at.safeDestination- if the destination is save and should be set.- Returns:
- the result of the pathing.
-
walkTo
protected abstract PathResult<? extends IPathJob> walkTo(net.minecraft.core.BlockPos pos, double speed, boolean safeDestination) Try to move to a certain position.- Parameters:
speed- the speed to walk.x- the x target.y- the y target.z- the z target.- Returns:
- the PathResult.
-
moveAwayFromLivingEntity
protected abstract PathResult<? extends IPathJob> moveAwayFromLivingEntity(net.minecraft.world.entity.Entity target, double distance, double combatMovementSpeed) Used to path away from a ourEntity.- Parameters:
target- the ourEntity.distance- the distance to move to.combatMovementSpeed- the speed to run at.- Returns:
- the result of the pathing.
-
walkTo
protected abstract boolean walkTo(net.minecraft.core.BlockPos position, double speed) Attempt to move to a specific pos.- Parameters:
position- the position to move to.speed- the speed.- Returns:
- true if successful.
-
walkTowards
@Nullable protected abstract @Nullable PathResult<AbstractPathJob> walkTowards(net.minecraft.core.BlockPos towards, double range, double speedFactor) Attemps to move in the given direction, walking at least range blocks- Parameters:
towards-range-speedFactor-- Returns:
-
walkToRandomPos
Used to path towards a random pos.- Parameters:
range- the range he should move out of.speed- the speed to run at.- Returns:
- the result of the pathing.
-
walkToRandomPosAround
protected abstract PathResult<? extends IPathJob> walkToRandomPosAround(int range, double speed, net.minecraft.core.BlockPos pos) Used to path towards a random pos.- Parameters:
range- the range he should move out of.speed- the speed to run at.pos- the pos to circle around.- Returns:
- the result of the pathing.
-
walkCloseToXNearY
protected abstract PathResult<PathJobMoveCloseToXNearY> walkCloseToXNearY(net.minecraft.core.BlockPos desiredPosition, net.minecraft.core.BlockPos nearbyPosition, int distToDesired, double speedFactor, boolean safeDestination) Walks towards the desired position, while trying to not steer too far from the nearby position- Parameters:
desiredPosition-nearbyPosition-distToDesired-speedFactor-safeDestination-- Returns:
-
walkToRandomPos
protected abstract PathResult<? extends IPathJob> walkToRandomPos(int range, double speed, net.minecraft.util.Tuple<net.minecraft.core.BlockPos, net.minecraft.core.BlockPos> corners) Used to path towards a random pos within some restrictions- Parameters:
range- the range he should move out of.speed- the speed to run at.corners- the corners they can't leave.- Returns:
- the result of the pathing.
-
walkToRandomPos
protected abstract PathResult<PathJobRandomPos> walkToRandomPos(int range, double speed, net.minecraft.util.Tuple<net.minecraft.core.BlockPos, net.minecraft.core.BlockPos> corners, boolean preferInside) Used to path towards a random pos within some restrictions- Parameters:
range- the range he should move out of.speed- the speed to run at.corners- the corners they can't leave.- Returns:
- the result of the pathing.
-
walkToTree
public abstract TreePathResult walkToTree(net.minecraft.core.BlockPos startRestriction, net.minecraft.core.BlockPos endRestriction, double speed, List<ItemStorage> excludedTrees, int dyntreesize, IColony colony) Used to find a tree.- Parameters:
startRestriction- the start of the restricted area.endRestriction- the end of the restricted area.speed- walking speed.excludedTrees- the trees which should be cut.- Returns:
- the result of the search.
-
walkToTree
public abstract TreePathResult walkToTree(int range, double speed, List<ItemStorage> excludedTrees, int dyntreesize, IColony colony) Used to find a tree.- Parameters:
range- in the range.speed- walking speed.excludedTrees- the trees which should be cut.- Returns:
- the result of the search.
-
walkToEntity
protected abstract PathResult<? extends IPathJob> walkToEntity(@NotNull @NotNull net.minecraft.world.entity.Entity e, double speed) Used to walk a living ourEntity with a speed.- Parameters:
e- the ourEntity.speed- the speed.- Returns:
- the result.
-
getPathingOptions
Get the pathing options- Returns:
- the pathing options.
-
getOurEntity
public net.minecraft.world.entity.Mob getOurEntity()Get the entity of this navigator- Returns:
- mobentity
-
setSafeDestinationPos
public abstract void setSafeDestinationPos(net.minecraft.core.BlockPos pos) Sets the desired position to reach, used also for stuckhandling- Parameters:
pos-
-
setStuckHandler
Sets the stuck handler for this navigator- Parameters:
stuckHandler- handler to use
-
setSwimSpeedFactor
public abstract void setSwimSpeedFactor(double factor) -
setPauseTicks
protected abstract void setPauseTicks(int pauseTicks) Sets the navigation to not accept new jobs for a time- Parameters:
pauseTicks-
-
getPathResult
Gets the current path result- Returns:
-