001 package net.minecraftforge.common;
002
003 import java.util.ArrayList;
004
005 import net.minecraft.entity.player.EntityPlayer;
006 import net.minecraft.item.ItemStack;
007 import net.minecraft.util.MovingObjectPosition;
008 import net.minecraft.world.World;
009
010 /**
011 *
012 * This allows for mods to create there own Shear-like items
013 * and have them interact with Blocks/Entities without extra work.
014 * Also, if your block/entity supports the Shears, this allows you
015 * to support mod-shears as well.
016 *
017 */
018 public interface IShearable
019 {
020 /**
021 * Checks if the object is currently shearable
022 * Example: Sheep return false when they have no wool
023 *
024 * @param item The itemstack that is being used, Possible to be null
025 * @param world The current world
026 * @param x The X Position
027 * @param y The Y Position
028 * @param z The Z Position
029 * @return If this is shearable, and onSheared should be called.
030 */
031 public boolean isShearable(ItemStack item, World world, int x, int y, int z);
032
033 /**
034 * Performs the shear function on this object.
035 * This is called for both client, and server.
036 * The object should perform all actions related to being sheared,
037 * except for dropping of the items.
038 *
039 * Returns a list of items that resulted from the shearing process.
040 *
041 * For entities, they should trust there internal location information
042 * over the values passed into this function.
043 *
044 * @param item The itemstack that is being used, Possible to be null
045 * @param world The current world
046 * @param x The X Position
047 * @param y The Y Position
048 * @param z The Z Position
049 * @param fortune The fortune level of the shears being used
050 * @return A ArrayList containing all items from this shearing. Possible to be null.
051 */
052 public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune);
053 }