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, PROBABILITY

    Fields inherited from class net.minecraft.world.entity.ai.goal.RandomStrollGoal

    DEFAULT_INTERVAL, forceTrigger, interval, mob, speedModifier, wantedX, wantedY, wantedZ
  • Constructor Summary

    Constructors
    Constructor
    Description
    CavalryStrollGoal(CavalryHorseEntity horse, double speed)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
    Returns whether the goal can be used.
    protected net.minecraft.world.phys.Vec3
    Returns the position of the horse to move to.
    protected boolean
    Checks if the horse is free to roam, meaning it has no passenger, no reservation, and has a valid animal data object.
    void
    Called when the goal is started.
    void
    Resets the stall position to null and stops the goal.

    Methods inherited from class net.minecraft.world.entity.ai.goal.RandomStrollGoal

    setInterval, trigger

    Methods inherited from class net.minecraft.world.entity.ai.goal.Goal

    adjustedTickDelay, getFlags, isInterruptable, reducedTickDelay, requiresUpdateEveryTick, setFlags, tick, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • 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:
      canUse in class net.minecraft.world.entity.ai.goal.RandomStrollGoal
      Returns:
      true if the goal can be used, false otherwise
    • canContinueToUse

      public boolean canContinueToUse()
      Overrides:
      canContinueToUse in class net.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:
      start in class net.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:
      getPosition in class net.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:
      stop in class net.minecraft.world.entity.ai.goal.RandomStrollGoal