Class Sheep

All Implemented Interfaces:
CommandSource, Attackable, Shearable, Targeting, EntityAccess, Nameable, ICapabilityProvider, ICapabilityProviderImpl<Entity>, ICapabilitySerializable<CompoundTag>, IForgeEntity, IForgeLivingEntity, IForgeShearable, INBTSerializable<CompoundTag>

public class Sheep extends Animal implements Shearable, IForgeShearable
  • Field Details

    • EAT_ANIMATION_TICKS

      private static final int EAT_ANIMATION_TICKS
      See Also:
    • DATA_WOOL_ID

      private static final EntityDataAccessor<Byte> DATA_WOOL_ID
    • ITEM_BY_DYE

      private static final Map<DyeColor,ItemLike> ITEM_BY_DYE
    • COLORARRAY_BY_COLOR

      private static final Map<DyeColor,float[]> COLORARRAY_BY_COLOR
    • eatAnimationTick

      private int eatAnimationTick
    • eatBlockGoal

      private EatBlockGoal eatBlockGoal
  • Constructor Details

  • Method Details

    • createSheepColor

      private static float[] createSheepColor(DyeColor p_29866_)
    • getColorArray

      public static float[] getColorArray(DyeColor p_29830_)
    • registerGoals

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

      protected void customServerAiStep()
      Overrides:
      customServerAiStep in class Animal
    • aiStep

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

      public static AttributeSupplier.Builder createAttributes()
    • defineSynchedData

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

      public ResourceLocation getDefaultLootTable()
      Overrides:
      getDefaultLootTable in class Mob
    • handleEntityEvent

      public void handleEntityEvent(byte p_29814_)
      Overrides:
      handleEntityEvent in class Animal
    • getHeadEatPositionScale

      public float getHeadEatPositionScale(float p_29881_)
    • getHeadEatAngleScale

      public float getHeadEatAngleScale(float p_29883_)
    • mobInteract

      public InteractionResult mobInteract(Player p_29853_, InteractionHand p_29854_)
      Overrides:
      mobInteract in class Animal
    • shear

      public void shear(SoundSource p_29819_)
      Specified by:
      shear in interface Shearable
    • readyForShearing

      public boolean readyForShearing()
      Specified by:
      readyForShearing in interface Shearable
    • addAdditionalSaveData

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

      public void readAdditionalSaveData(CompoundTag p_29845_)
      Overrides:
      readAdditionalSaveData in class Animal
    • getAmbientSound

      protected SoundEvent getAmbientSound()
      Overrides:
      getAmbientSound in class Mob
    • getHurtSound

      protected SoundEvent getHurtSound(DamageSource p_29872_)
      Overrides:
      getHurtSound in class LivingEntity
    • getDeathSound

      protected SoundEvent getDeathSound()
      Overrides:
      getDeathSound in class LivingEntity
    • playStepSound

      protected void playStepSound(BlockPos p_29861_, BlockState p_29862_)
      Overrides:
      playStepSound in class Entity
    • getColor

      public DyeColor getColor()
    • setColor

      public void setColor(DyeColor p_29856_)
    • isSheared

      public boolean isSheared()
    • setSheared

      public void setSheared(boolean p_29879_)
    • getRandomSheepColor

      public static DyeColor getRandomSheepColor(RandomSource p_218262_)
    • getBreedOffspring

      @Nullable public Sheep getBreedOffspring(ServerLevel p_149044_, AgeableMob p_149045_)
      Specified by:
      getBreedOffspring in class AgeableMob
    • ate

      public void ate()
      Overrides:
      ate in class Mob
    • finalizeSpawn

      @Nullable public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_29835_, DifficultyInstance p_29836_, MobSpawnType p_29837_, @Nullable SpawnGroupData p_29838_, @Nullable CompoundTag p_29839_)
      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
    • getOffspringColor

      private DyeColor getOffspringColor(Animal p_29824_, Animal p_29825_)
    • makeContainer

      private static CraftingContainer makeContainer(DyeColor p_29832_, DyeColor p_29833_)
    • getStandingEyeHeight

      protected float getStandingEyeHeight(Pose p_29850_, EntityDimensions p_29851_)
      Overrides:
      getStandingEyeHeight in class LivingEntity
    • isShearable

      public boolean isShearable(@NotNull @NotNull ItemStack item, Level world, BlockPos pos)
      Description copied from interface: IForgeShearable
      Checks if the object is currently shearable Example: Sheep return false when they have no wool
      Specified by:
      isShearable in interface IForgeShearable
      Parameters:
      item - The ItemStack that is being used, may be empty.
      world - The current level.
      pos - Block's position in level.
      Returns:
      If this is shearable, and onSheared should be called.
    • onSheared

      @NotNull public List<ItemStack> onSheared(@Nullable Player player, @NotNull @NotNull ItemStack item, Level world, BlockPos pos, int fortune)
      Description copied from interface: IForgeShearable
      Performs the shear function on this object. This is called for both client, and server. The object should perform all actions related to being sheared, except for dropping of the items, and removal of the block. As those are handled by ItemShears itself. Returns a list of items that resulted from the shearing process. For entities, they should trust there internal location information over the values passed into this function.
      Specified by:
      onSheared in interface IForgeShearable
      item - The ItemStack that is being used, may be empty.
      world - The current level.
      pos - If this is a block, the block's position in level.
      fortune - The fortune level of the shears being used.
      Returns:
      A List containing all items from this shearing. May be empty.