Package net.minecraftforge.common
Interface IForgeShearable
- All Known Subinterfaces:
Shearable
- All Known Implementing Classes:
Bogged
,CherryLeavesBlock
,DeadBushBlock
,LeavesBlock
,MangroveLeavesBlock
,MushroomCow
,SeagrassBlock
,Sheep
,SnowGolem
,TallGrassBlock
,VineBlock
,WebBlock
,Wolf
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 TypeMethodDescriptiondefault boolean
isShearable
(@NotNull ItemStack item, Level level, BlockPos pos) Checks if the object is currently shearable Example: Sheep return false when they have no woolPerforms the shear function on this object.
-
Method Details
-
isShearable
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
@NotNull default @NotNull List<ItemStack> onSheared(@Nullable @Nullable Player player, @NotNull @NotNull 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.
-