Class AbstractHorse

All Implemented Interfaces:
CommandSource, ContainerListener, HasCustomInventoryScreen, PlayerRideable, PlayerRideableJumping, Saddleable, 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, 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:
    • 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
    • DATA_ID_OWNER_UUID

      private static final EntityDataAccessor<Optional<UUID>> DATA_ID_OWNER_UUID
    • 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
    • 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()
    • 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
    • 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_)
    • travel

      public void travel(Vec3 p_30633_)
      Overrides:
      travel in class LivingEntity
    • getDrivenMovementSpeed

      protected float getDrivenMovementSpeed(LivingEntity p_250911_)
    • mountIgnoresControllerInput

      protected boolean mountIgnoresControllerInput(LivingEntity p_248660_)
    • executeRidersJump

      protected void executeRidersJump(float p_248808_, float p_249281_, float p_251655_)
    • 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_)
    • 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(Player p_259395_)
      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

      public void positionRider(Entity p_30642_)
      Overrides:
      positionRider in class Entity
    • generateRandomMaxHealth

      protected float generateRandomMaxHealth(RandomSource p_218806_)
    • generateRandomJumpStrength

      protected double generateRandomJumpStrength(RandomSource p_218810_)
    • generateRandomSpeed

      protected double generateRandomSpeed(RandomSource p_218812_)
    • 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 Entity
    • 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_)
      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()