Interface CrafterInteractable

All Known Implementing Classes:
ChestInventoryParser, CrafterSmartPortParser

public interface CrafterInteractable
The interface is for item interacting between inventory and crafter.
Author:
Xzavier0722
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addItem(org.bukkit.inventory.ItemStack item)
     
    boolean
    canOutput(org.bukkit.inventory.ItemStack item)
    Check if the item can be output to inventory.
    org.bukkit.inventory.ItemStack
    getItem(int slot)
     
    boolean
    matchRecipe(AbstractAutoCrafter crafter, Collection<Predicate<org.bukkit.inventory.ItemStack>> recipe, Map<Integer,Integer> itemQuantities)
    Check if the items in inventory match all recipe items.
    default void
    setIngredientCount(org.bukkit.block.Block b, int count)
    This is for updating the count of different ingredient in recipe.
  • Method Details

    • canOutput

      boolean canOutput(org.bukkit.inventory.ItemStack item)
      Check if the item can be output to inventory.
      Parameters:
      item - : the item will check.
      Returns:
      true if there are enough space, else false.
    • matchRecipe

      boolean matchRecipe(AbstractAutoCrafter crafter, Collection<Predicate<org.bukkit.inventory.ItemStack>> recipe, Map<Integer,Integer> itemQuantities)
      Check if the items in inventory match all recipe items. This usually use with #matchesAny() in AbstractAutoCrafter
      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

      org.bukkit.inventory.ItemStack getItem(int slot)
    • addItem

      boolean addItem(org.bukkit.inventory.ItemStack item)
    • setIngredientCount

      default void setIngredientCount(org.bukkit.block.Block b, int count)
      This is for updating the count of different ingredient in recipe. This will be invoked when the recipe is changed. Usually use for controlling the item insertion of cargo.
      Parameters:
      b - : block to update.
      count - : amount of different item.