Class CavalryStrollGoal
java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
net.minecraft.world.entity.ai.goal.RandomStrollGoal
net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal
com.minecolonies.core.entity.ai.cavalry.CavalryStrollGoal
public class CavalryStrollGoal
extends net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.ai.goal.Goal
net.minecraft.world.entity.ai.goal.Goal.Flag -
Field Summary
Fields inherited from class net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal
probability, PROBABILITYFields inherited from class net.minecraft.world.entity.ai.goal.RandomStrollGoal
DEFAULT_INTERVAL, forceTrigger, interval, mob, speedModifier, wantedX, wantedY, wantedZ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancanUse()Returns whether the goal can be used.protected net.minecraft.world.phys.Vec3Returns the position of the horse to move to.protected booleanChecks if the horse is free to roam, meaning it has no passenger, no reservation, and has a valid animal data object.voidstart()Called when the goal is started.voidstop()Resets the stall position to null and stops the goal.Methods inherited from class net.minecraft.world.entity.ai.goal.RandomStrollGoal
setInterval, triggerMethods inherited from class net.minecraft.world.entity.ai.goal.Goal
adjustedTickDelay, getFlags, isInterruptable, reducedTickDelay, requiresUpdateEveryTick, setFlags, tick, toString
-
Constructor Details
-
CavalryStrollGoal
-
-
Method Details
-
canUse
public boolean canUse()Returns whether the goal can be used.Conditions to return false:
- The horse is on the client side.
- The horse is not an instance of
CavalryHorseEntity. - The horse has a passenger.
- The horse has a reservation.
- The horse does not have a valid animal data object.
If the goal is usable, the horse will continue to move towards the stable block position.
- Overrides:
canUsein classnet.minecraft.world.entity.ai.goal.RandomStrollGoal- Returns:
- true if the goal can be used, false otherwise
-
canContinueToUse
public boolean canContinueToUse()- Overrides:
canContinueToUsein classnet.minecraft.world.entity.ai.goal.RandomStrollGoal
-
isFreeToRoam
protected boolean isFreeToRoam()Checks if the horse is free to roam, meaning it has no passenger, no reservation, and has a valid animal data object.- Returns:
- true if the horse is free to roam, false otherwise
-
start
public void start()Called when the goal is started. This goal will first check if the horse is in a stable building. If it is, it will set the stall position to the next available stall position in the building. If the horse is not in a stable building, or if the stall position is already set, it will call the superclass method to start the goal.- Overrides:
startin classnet.minecraft.world.entity.ai.goal.RandomStrollGoal
-
getPosition
protected net.minecraft.world.phys.Vec3 getPosition()Returns the position of the horse to move to. If the horse is in a stable, this will return the next available stall position. Otherwise, it will call the superclass method to get the position.- Overrides:
getPositionin classnet.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal- Returns:
- the position to move to
-
stop
public void stop()Resets the stall position to null and stops the goal.- Overrides:
stopin classnet.minecraft.world.entity.ai.goal.RandomStrollGoal
-