Interface IForgeShearable

All Known Implementing Classes:
DeadBushBlock, LeavesBlock, MushroomCow, SeagrassBlock, Sheep, SnowGolem, TallGrassBlock, VineBlock, WebBlock

public interface IForgeShearable
This allows for mods to create there own Shear-like items and have them interact with Blocks/Entities without extra work. Also, if your block/entity supports the Shears, this allows you to support mod-shears as well.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    isShearable(ItemStack item, Level level, BlockPos pos)
    Checks if the object is currently shearable Example: Sheep return false when they have no wool
    default List<ItemStack>
    onSheared(Player player, ItemStack item, Level level, BlockPos pos, int fortune)
    Performs the shear function on this object.
  • Method Details

    • isShearable

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

      @Nonnull default List<ItemStack> onSheared(@Nullable Player player, @Nonnull ItemStack item, Level level, BlockPos pos, int fortune)
      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.
      Parameters:
      item - The ItemStack that is being used, may be empty.
      level - 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.