Class ChestInventoryParser
java.lang.Object
com.xzavier0722.mc.plugin.slimefun4.autocrafter.ChestInventoryParser
- All Implemented Interfaces:
CrafterInteractable
This is the implementation of
CrafterInteractable with vanilla inventory.- Author:
- Xzavier0722
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddItem(org.bukkit.inventory.ItemStack item) booleancanOutput(org.bukkit.inventory.ItemStack item) Check if the item can be output to inventory.org.bukkit.inventory.ItemStackgetItem(int slot) booleanmatchRecipe(AbstractAutoCrafter crafter, Collection<Predicate<org.bukkit.inventory.ItemStack>> recipe, Map<Integer, Integer> itemQuantities) Check if the items in inventory match all recipe items.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.xzavier0722.mc.plugin.slimefun4.autocrafter.CrafterInteractable
setIngredientCount
-
Constructor Details
-
ChestInventoryParser
public ChestInventoryParser(org.bukkit.inventory.Inventory inv)
-
-
Method Details
-
canOutput
public boolean canOutput(org.bukkit.inventory.ItemStack item) Description copied from interface:CrafterInteractableCheck if the item can be output to inventory.- Specified by:
canOutputin interfaceCrafterInteractable- Parameters:
item- : the item will check.- Returns:
- true if there are enough space, else false.
-
matchRecipe
public boolean matchRecipe(AbstractAutoCrafter crafter, Collection<Predicate<org.bukkit.inventory.ItemStack>> recipe, Map<Integer, Integer> itemQuantities) Description copied from interface:CrafterInteractableCheck if the items in inventory match all recipe items. This usually use with #matchesAny() inAbstractAutoCrafter- Specified by:
matchRecipein interfaceCrafterInteractable- Parameters:
crafter- : the crafter that invoked this method.recipe- : the collection of recipe ingredients' predicate to test the item.itemQuantities- : the item's slot and amount after consume.- Returns:
- true if all matched, else false.
-
getItem
public org.bukkit.inventory.ItemStack getItem(int slot) - Specified by:
getItemin interfaceCrafterInteractable
-
addItem
public boolean addItem(org.bukkit.inventory.ItemStack item) - Specified by:
addItemin interfaceCrafterInteractable
-