Class AbstractHorse

All Implemented Interfaces:
CommandSource, ContainerListener, Attackable, HasCustomInventoryScreen, OwnableEntity, PlayerRideable, PlayerRideableJumping, Saddleable, Targeting, EntityAccess, Nameable, ICapabilityProvider, ICapabilityProviderImpl<Entity>, ICapabilitySerializable<CompoundTag>, IForgeEntity, IForgeLivingEntity, INBTSerializable<CompoundTag>
Direct Known Subclasses:
AbstractChestedHorse, Camel, Horse, SkeletonHorse, ZombieHorse

public abstract class AbstractHorse extends Animal implements ContainerListener, HasCustomInventoryScreen, OwnableEntity, PlayerRideableJumping, Saddleable
  • Field Details

    • EQUIPMENT_SLOT_OFFSET

      public static final int EQUIPMENT_SLOT_OFFSET
      See Also:
    • CHEST_SLOT_OFFSET

      public static final int CHEST_SLOT_OFFSET
      See Also:
    • INVENTORY_SLOT_OFFSET

      public static final int INVENTORY_SLOT_OFFSET
      See Also:
    • BREEDING_CROSS_FACTOR

      public static final double BREEDING_CROSS_FACTOR
      See Also:
    • MIN_MOVEMENT_SPEED

      private static final float MIN_MOVEMENT_SPEED
    • MAX_MOVEMENT_SPEED

      private static final float MAX_MOVEMENT_SPEED
    • MIN_JUMP_STRENGTH

      private static final float MIN_JUMP_STRENGTH
    • MAX_JUMP_STRENGTH

      private static final float MAX_JUMP_STRENGTH
    • MIN_HEALTH

      private static final float MIN_HEALTH
    • MAX_HEALTH

      private static final float MAX_HEALTH
    • BACKWARDS_MOVE_SPEED_FACTOR

      private static final float BACKWARDS_MOVE_SPEED_FACTOR
      See Also:
    • SIDEWAYS_MOVE_SPEED_FACTOR

      private static final float SIDEWAYS_MOVE_SPEED_FACTOR
      See Also:
    • PARENT_HORSE_SELECTOR

      private static final Predicate<LivingEntity> PARENT_HORSE_SELECTOR
    • MOMMY_TARGETING

      private static final TargetingConditions MOMMY_TARGETING
    • FOOD_ITEMS

      private static final Ingredient FOOD_ITEMS
    • DATA_ID_FLAGS

      private static final EntityDataAccessor<Byte> DATA_ID_FLAGS
    • FLAG_TAME

      private static final int FLAG_TAME
      See Also:
    • FLAG_SADDLE

      private static final int FLAG_SADDLE
      See Also:
    • FLAG_BRED

      private static final int FLAG_BRED
      See Also:
    • FLAG_EATING

      private static final int FLAG_EATING
      See Also:
    • FLAG_STANDING

      private static final int FLAG_STANDING
      See Also:
    • FLAG_OPEN_MOUTH

      private static final int FLAG_OPEN_MOUTH
      See Also:
    • INV_SLOT_SADDLE

      public static final int INV_SLOT_SADDLE
      See Also:
    • INV_SLOT_ARMOR

      public static final int INV_SLOT_ARMOR
      See Also:
    • INV_BASE_COUNT

      public static final int INV_BASE_COUNT
      See Also:
    • eatingCounter

      private int eatingCounter
    • mouthCounter

      private int mouthCounter
    • standCounter

      private int standCounter
    • tailCounter

      public int tailCounter
    • sprintCounter

      public int sprintCounter
    • isJumping

      protected boolean isJumping
    • inventory

      protected SimpleContainer inventory
    • temper

      protected int temper
    • playerJumpPendingScale

      protected float playerJumpPendingScale
    • allowStandSliding

      protected boolean allowStandSliding
    • eatAnim

      private float eatAnim
    • eatAnimO

      private float eatAnimO
    • standAnim

      private float standAnim
    • standAnimO

      private float standAnimO
    • mouthAnim

      private float mouthAnim
    • mouthAnimO

      private float mouthAnimO
    • canGallop

      protected boolean canGallop
    • gallopSoundCounter

      protected int gallopSoundCounter
    • owner

      @Nullable private UUID owner
    • itemHandler

      private LazyOptional<?> itemHandler
  • Constructor Details

  • Method Details

    • registerGoals

      protected void registerGoals()
      Overrides:
      registerGoals in class Mob
    • addBehaviourGoals

      protected void addBehaviourGoals()
    • defineSynchedData

      protected void defineSynchedData()
      Overrides:
      defineSynchedData in class AgeableMob
    • getFlag

      protected boolean getFlag(int p_30648_)
    • setFlag

      protected void setFlag(int p_30598_, boolean p_30599_)
    • isTamed

      public boolean isTamed()
    • getOwnerUUID

      @Nullable public UUID getOwnerUUID()
      Specified by:
      getOwnerUUID in interface OwnableEntity
    • setOwnerUUID

      public void setOwnerUUID(@Nullable UUID p_30587_)
    • isJumping

      public boolean isJumping()
    • setTamed

      public void setTamed(boolean p_30652_)
    • setIsJumping

      public void setIsJumping(boolean p_30656_)
    • onLeashDistance

      protected void onLeashDistance(float p_30660_)
      Overrides:
      onLeashDistance in class PathfinderMob
    • isEating

      public boolean isEating()
    • isStanding

      public boolean isStanding()
    • isBred

      public boolean isBred()
    • setBred

      public void setBred(boolean p_30658_)
    • isSaddleable

      public boolean isSaddleable()
      Specified by:
      isSaddleable in interface Saddleable
    • equipSaddle

      public void equipSaddle(@Nullable SoundSource p_30546_)
      Specified by:
      equipSaddle in interface Saddleable
    • equipArmor

      public void equipArmor(Player p_251330_, ItemStack p_248855_)
    • isSaddled

      public boolean isSaddled()
      Specified by:
      isSaddled in interface Saddleable
    • getTemper

      public int getTemper()
    • setTemper

      public void setTemper(int p_30650_)
    • modifyTemper

      public int modifyTemper(int p_30654_)
    • isPushable

      public boolean isPushable()
      Overrides:
      isPushable in class LivingEntity
    • eating

      private void eating()
    • causeFallDamage

      public boolean causeFallDamage(float p_149499_, float p_149500_, DamageSource p_149501_)
      Overrides:
      causeFallDamage in class LivingEntity
    • calculateFallDamage

      protected int calculateFallDamage(float p_30606_, float p_30607_)
      Overrides:
      calculateFallDamage in class LivingEntity
    • getInventorySize

      protected int getInventorySize()
    • createInventory

      protected void createInventory()
    • updateContainerEquipment

      protected void updateContainerEquipment()
    • containerChanged

      public void containerChanged(Container p_30548_)
      Specified by:
      containerChanged in interface ContainerListener
    • getCustomJump

      public double getCustomJump()
    • hurt

      public boolean hurt(DamageSource p_252258_, float p_250984_)
      Overrides:
      hurt in class Animal
    • canPerformRearing

      protected boolean canPerformRearing()
    • getEatingSound

      @Nullable protected SoundEvent getEatingSound()
    • getAngrySound

      @Nullable protected SoundEvent getAngrySound()
    • playStepSound

      protected void playStepSound(BlockPos p_30584_, BlockState p_30585_)
      Overrides:
      playStepSound in class Entity
    • isWoodSoundType

      private boolean isWoodSoundType(SoundType p_278280_)
    • playGallopSound

      protected void playGallopSound(SoundType p_30560_)
    • createBaseHorseAttributes

      public static AttributeSupplier.Builder createBaseHorseAttributes()
    • getMaxSpawnClusterSize

      public int getMaxSpawnClusterSize()
      Overrides:
      getMaxSpawnClusterSize in class Mob
    • getMaxTemper

      public int getMaxTemper()
    • getSoundVolume

      protected float getSoundVolume()
      Overrides:
      getSoundVolume in class LivingEntity
    • getAmbientSoundInterval

      public int getAmbientSoundInterval()
      Overrides:
      getAmbientSoundInterval in class Animal
    • openCustomInventoryScreen

      public void openCustomInventoryScreen(Player p_218808_)
      Specified by:
      openCustomInventoryScreen in interface HasCustomInventoryScreen
    • fedFood

      public InteractionResult fedFood(Player p_30581_, ItemStack p_30582_)
    • handleEating

      protected boolean handleEating(Player p_30593_, ItemStack p_30594_)
    • doPlayerRide

      protected void doPlayerRide(Player p_30634_)
    • isImmobile

      public boolean isImmobile()
      Overrides:
      isImmobile in class LivingEntity
    • isFood

      public boolean isFood(ItemStack p_30644_)
      Overrides:
      isFood in class Animal
    • moveTail

      private void moveTail()
    • dropEquipment

      protected void dropEquipment()
      Overrides:
      dropEquipment in class LivingEntity
    • aiStep

      public void aiStep()
      Overrides:
      aiStep in class Animal
    • followMommy

      protected void followMommy()
    • canEatGrass

      public boolean canEatGrass()
    • tick

      public void tick()
      Overrides:
      tick in class Mob
    • mobInteract

      public InteractionResult mobInteract(Player p_252289_, InteractionHand p_248927_)
      Overrides:
      mobInteract in class Animal
    • openMouth

      private void openMouth()
    • setEating

      public void setEating(boolean p_30662_)
    • setStanding

      public void setStanding(boolean p_30666_)
    • getAmbientStandSound

      @Nullable public SoundEvent getAmbientStandSound()
    • standIfPossible

      public void standIfPossible()
    • makeMad

      public void makeMad()
    • tameWithName

      public boolean tameWithName(Player p_30638_)
    • tickRidden

      protected void tickRidden(Player p_278233_, Vec3 p_275693_)
      Overrides:
      tickRidden in class LivingEntity
    • getRiddenRotation

      protected Vec2 getRiddenRotation(LivingEntity p_275502_)
    • getRiddenInput

      protected Vec3 getRiddenInput(Player p_278278_, Vec3 p_275506_)
      Overrides:
      getRiddenInput in class LivingEntity
    • getRiddenSpeed

      protected float getRiddenSpeed(Player p_278336_)
      Overrides:
      getRiddenSpeed in class LivingEntity
    • executeRidersJump

      protected void executeRidersJump(float p_248808_, Vec3 p_275435_)
    • playJumpSound

      protected void playJumpSound()
    • addAdditionalSaveData

      public void addAdditionalSaveData(CompoundTag p_30589_)
      Overrides:
      addAdditionalSaveData in class Animal
    • readAdditionalSaveData

      public void readAdditionalSaveData(CompoundTag p_30565_)
      Overrides:
      readAdditionalSaveData in class Animal
    • canMate

      public boolean canMate(Animal p_30553_)
      Overrides:
      canMate in class Animal
    • canParent

      protected boolean canParent()
    • getBreedOffspring

      @Nullable public AgeableMob getBreedOffspring(ServerLevel p_149506_, AgeableMob p_149507_)
      Specified by:
      getBreedOffspring in class AgeableMob
    • setOffspringAttributes

      protected void setOffspringAttributes(AgeableMob p_149509_, AbstractHorse p_149510_)
    • setOffspringAttribute

      private void setOffspringAttribute(AgeableMob p_273163_, AbstractHorse p_273784_, Attribute p_273681_, double p_272663_, double p_273405_)
    • createOffspringAttribute

      static double createOffspringAttribute(double p_272685_, double p_273709_, double p_273376_, double p_273030_, RandomSource p_272743_)
    • getEatAnim

      public float getEatAnim(float p_30664_)
    • getStandAnim

      public float getStandAnim(float p_30668_)
    • getMouthAnim

      public float getMouthAnim(float p_30534_)
    • onPlayerJump

      public void onPlayerJump(int p_30591_)
      Specified by:
      onPlayerJump in interface PlayerRideableJumping
    • canJump

      public boolean canJump()
      Specified by:
      canJump in interface PlayerRideableJumping
    • handleStartJump

      public void handleStartJump(int p_30574_)
      Specified by:
      handleStartJump in interface PlayerRideableJumping
    • handleStopJump

      public void handleStopJump()
      Specified by:
      handleStopJump in interface PlayerRideableJumping
    • spawnTamingParticles

      protected void spawnTamingParticles(boolean p_30670_)
    • handleEntityEvent

      public void handleEntityEvent(byte p_30541_)
      Overrides:
      handleEntityEvent in class Animal
    • positionRider

      protected void positionRider(Entity p_289569_, Entity.MoveFunction p_289558_)
      Overrides:
      positionRider in class Entity
    • generateMaxHealth

      protected static float generateMaxHealth(IntUnaryOperator p_272695_)
    • generateJumpStrength

      protected static double generateJumpStrength(DoubleSupplier p_272718_)
    • generateSpeed

      protected static double generateSpeed(DoubleSupplier p_273691_)
    • onClimbable

      public boolean onClimbable()
      Overrides:
      onClimbable in class LivingEntity
    • getStandingEyeHeight

      protected float getStandingEyeHeight(Pose p_30578_, EntityDimensions p_30579_)
      Overrides:
      getStandingEyeHeight in class LivingEntity
    • canWearArmor

      public boolean canWearArmor()
    • isWearingArmor

      public boolean isWearingArmor()
    • isArmor

      public boolean isArmor(ItemStack p_30645_)
    • createEquipmentSlotAccess

      private SlotAccess createEquipmentSlotAccess(int p_149503_, Predicate<ItemStack> p_149504_)
    • getSlot

      public SlotAccess getSlot(int p_149514_)
      Overrides:
      getSlot in class LivingEntity
    • getControllingPassenger

      @Nullable public LivingEntity getControllingPassenger()
      Overrides:
      getControllingPassenger in class Mob
    • getDismountLocationInDirection

      @Nullable private Vec3 getDismountLocationInDirection(Vec3 p_30562_, LivingEntity p_30563_)
    • getDismountLocationForPassenger

      public Vec3 getDismountLocationForPassenger(LivingEntity p_30576_)
      Overrides:
      getDismountLocationForPassenger in class Entity
    • randomizeAttributes

      protected void randomizeAttributes(RandomSource p_218804_)
    • finalizeSpawn

      @Nullable public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_30555_, DifficultyInstance p_30556_, MobSpawnType p_30557_, @Nullable SpawnGroupData p_30558_, @Nullable CompoundTag p_30559_)
      Description copied from class: Mob
      Forge: Override-Only, call via ForgeEventFactory.onFinalizeSpawn.
      Overrides are allowed. Do not wrap super calls within override (as that will cause stack overflows).
      Vanilla calls are replaced with a transformer, and are not visible in source.

      Be certain to either call super.finalizeSpawn or set the Mob.spawnType field from within your override.

      Overrides:
      finalizeSpawn in class AgeableMob
    • getCapability

      public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing)
      Description copied from interface: ICapabilityProvider
      Retrieves the Optional handler for the capability requested on the specific side. The return value CAN be the same for multiple faces. Modders are encouraged to cache this value, using the listener capabilities of the Optional to be notified if the requested capability get lost.
      Specified by:
      getCapability in interface ICapabilityProvider
      Overrides:
      getCapability in class LivingEntity
      Parameters:
      capability - The capability to check
      facing - The Side to check from, CAN BE NULL. Null is defined to represent 'internal' or 'self'
      Returns:
      The requested an optional holding the requested capability.
    • invalidateCaps

      public void invalidateCaps()
      Specified by:
      invalidateCaps in interface ICapabilityProviderImpl<Entity>
      Overrides:
      invalidateCaps in class LivingEntity
    • hasInventoryChanged

      public boolean hasInventoryChanged(Container p_149512_)
    • getAmbientStandInterval

      public int getAmbientStandInterval()