Class ReturnToStableGoal
java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
com.minecolonies.core.entity.ai.cavalry.ReturnToStableGoal
public class ReturnToStableGoal
extends net.minecraft.world.entity.ai.goal.Goal
Goal for a cavalry horse to return to its stable.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.ai.goal.Goal
net.minecraft.world.entity.ai.goal.Goal.Flag -
Constructor Summary
ConstructorsConstructorDescriptionReturnToStableGoal(CavalryHorseEntity horse, double speed, double startDistance) Creates a new ReturnToStableGoal. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the goal can continue to be used.booleancanUse()Check if the goal can be used.voidstart()Resets the return-to-stable state before the goal starts running.voidstop()Stops the horse navigation goal and resets return-to-stable targets.voidtick()Ticks the return-to-stable state machine.Methods inherited from class net.minecraft.world.entity.ai.goal.Goal
adjustedTickDelay, getFlags, isInterruptable, reducedTickDelay, requiresUpdateEveryTick, setFlags, toString
-
Constructor Details
-
ReturnToStableGoal
Creates a new ReturnToStableGoal.- Parameters:
horse- The cavalry horse entity.speed- The speed at which the cavalry horse moves.startDistance- The distance at which the cavalry horse starts returning to the stable.
-
-
Method Details
-
canUse
public boolean canUse()Check if the goal can be used.Conditions to return false:
- The horse has a passenger.
- The horse does not have a stable block position.
- The horse is within the start distance (blocks) of the stable block position.
If the goal is usable, the stable block position is set to be the immutable target block position.
- Specified by:
canUsein classnet.minecraft.world.entity.ai.goal.Goal- Returns:
- true if the goal can be used, false otherwise
-
canContinueToUse
public boolean canContinueToUse()Checks if the goal can continue to be used.- Overrides:
canContinueToUsein classnet.minecraft.world.entity.ai.goal.Goal- Returns:
- true if the state machine is not done and the horse can still be controlled by this goal.
-
start
public void start()Resets the return-to-stable state before the goal starts running.- Overrides:
startin classnet.minecraft.world.entity.ai.goal.Goal
-
stop
public void stop()Stops the horse navigation goal and resets return-to-stable targets.- Overrides:
stopin classnet.minecraft.world.entity.ai.goal.Goal
-
tick
public void tick()Ticks the return-to-stable state machine.- Overrides:
tickin classnet.minecraft.world.entity.ai.goal.Goal
-