Package net.minecraft.entity.ai.goal
Class MoveToTargetPosGoal
java.lang.Object
net.minecraft.entity.ai.goal.Goal
net.minecraft.entity.ai.goal.MoveToTargetPosGoal
- Direct Known Subclasses:
CatSitOnBlockGoal
,DrownedEntity.LeaveWaterGoal
,FoxEntity.EatSweetBerriesGoal
,GoToOwnerAndPurrGoal
,RabbitEntity.EatCarrotCropGoal
,StepAndDestroyBlockGoal
,StriderEntity.GoBackToLavaGoal
,TurtleEntity.LayEggGoal
,TurtleEntity.WanderInWaterGoal
public abstract class MoveToTargetPosGoal extends Goal
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.entity.ai.goal.Goal
Goal.Control
-
Field Summary
Fields Modifier and Type Field Description protected int
cooldown
protected int
lowestY
private int
maxYDifference
protected PathAwareEntity
mob
private int
range
private boolean
reached
private int
safeWaitingTime
double
speed
protected BlockPos
targetPos
protected int
tryingTime
-
Constructor Summary
Constructors Constructor Description MoveToTargetPosGoal(PathAwareEntity mob, double speed, int range)
MoveToTargetPosGoal(PathAwareEntity mob, double speed, int range, int maxYDifference)
-
Method Summary
Modifier and Type Method Description boolean
canStart()
protected boolean
findTargetPos()
double
getDesiredSquaredDistanceToTarget()
protected int
getInterval(PathAwareEntity mob)
protected BlockPos
getTargetPos()
protected boolean
hasReached()
protected abstract boolean
isTargetPos(WorldView world, BlockPos pos)
boolean
shouldContinue()
boolean
shouldResetPath()
void
start()
protected void
startMovingToTarget()
void
tick()
Methods inherited from class net.minecraft.entity.ai.goal.Goal
canStop, getControls, setControls, stop, toString
-
Field Details
-
mob
-
speed
public final double speed -
cooldown
protected int cooldown -
tryingTime
protected int tryingTime -
safeWaitingTime
private int safeWaitingTime -
targetPos
-
reached
private boolean reached -
range
private final int range -
maxYDifference
private final int maxYDifference -
lowestY
protected int lowestY
-
-
Constructor Details
-
MoveToTargetPosGoal
-
MoveToTargetPosGoal
-
-
Method Details
-
canStart
public boolean canStart() -
getInterval
-
shouldContinue
public boolean shouldContinue()- Overrides:
shouldContinue
in classGoal
-
start
public void start() -
startMovingToTarget
protected void startMovingToTarget() -
getDesiredSquaredDistanceToTarget
public double getDesiredSquaredDistanceToTarget() -
getTargetPos
-
tick
public void tick() -
shouldResetPath
public boolean shouldResetPath() -
hasReached
protected boolean hasReached() -
findTargetPos
protected boolean findTargetPos() -
isTargetPos
-