Class AbstractHorse

All Implemented Interfaces:
CommandSource, ContainerListener, PlayerRideable, PlayerRideableJumping, Saddleable, EntityAccess, Nameable, ICapabilityProvider, ICapabilitySerializable<CompoundTag>, IForgeEntity, INBTSerializable<CompoundTag>
Direct Known Subclasses:
AbstractChestedHorse, Horse, SkeletonHorse, ZombieHorse

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

    • EQUIPMENT_SLOT_OFFSET

      public static final int EQUIPMENT_SLOT_OFFSET
      See Also:
      Constant Field Values
    • CHEST_SLOT_OFFSET

      public static final int CHEST_SLOT_OFFSET
      See Also:
      Constant Field Values
    • INVENTORY_SLOT_OFFSET

      public static final int INVENTORY_SLOT_OFFSET
      See Also:
      Constant Field Values
    • 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:
      Constant Field Values
    • FLAG_SADDLE

      private static final int FLAG_SADDLE
      See Also:
      Constant Field Values
    • FLAG_BRED

      private static final int FLAG_BRED
      See Also:
      Constant Field Values
    • FLAG_EATING

      private static final int FLAG_EATING
      See Also:
      Constant Field Values
    • FLAG_STANDING

      private static final int FLAG_STANDING
      See Also:
      Constant Field Values
    • FLAG_OPEN_MOUTH

      private static final int FLAG_OPEN_MOUTH
      See Also:
      Constant Field Values
    • INV_SLOT_SADDLE

      public static final int INV_SLOT_SADDLE
      See Also:
      Constant Field Values
    • INV_SLOT_ARMOR

      public static final int INV_SLOT_ARMOR
      See Also:
      Constant Field Values
    • INV_BASE_COUNT

      public static final int INV_BASE_COUNT
      See Also:
      Constant Field Values
    • 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

      private 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
    • 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()
    • getEatingSound

      @Nullable protected SoundEvent getEatingSound()
    • getDeathSound

      @Nullable protected SoundEvent getDeathSound()
      Overrides:
      getDeathSound in class LivingEntity
    • getHurtSound

      @Nullable protected SoundEvent getHurtSound(DamageSource p_30609_)
      Overrides:
      getHurtSound in class LivingEntity
    • getAmbientSound

      @Nullable protected SoundEvent getAmbientSound()
      Overrides:
      getAmbientSound in class Mob
    • 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
    • openInventory

      public void openInventory(Player p_30621_)
    • 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

      protected 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
    • openMouth

      private void openMouth()
    • setEating

      public void setEating(boolean p_30662_)
    • setStanding

      public void setStanding(boolean p_30666_)
    • stand

      private void stand()
    • makeMad

      public void makeMad()
    • tameWithName

      public boolean tameWithName(Player p_30638_)
    • travel

      public void travel(Vec3 p_30633_)
      Overrides:
      travel in class LivingEntity
    • 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_)
    • canBeControlledByRider

      public boolean canBeControlledByRider()
      Overrides:
      canBeControlledByRider in class Mob
    • 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

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

      protected float generateRandomMaxHealth()
    • generateRandomJumpStrength

      protected double generateRandomJumpStrength()
    • generateRandomSpeed

      protected double generateRandomSpeed()
    • 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 Entity 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()
    • 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()
      Overrides:
      invalidateCaps in class LivingEntity
    • hasInventoryChanged

      public boolean hasInventoryChanged(Container p_149512_)