Class MultiBlockMachine

java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine
All Implemented Interfaces:
ItemAttribute, NotPlaceable, Placeable, RecipeDisplayItem
Direct Known Subclasses:
ArmorForge, AutomatedPanningMachine, Compressor, EnhancedCraftingTable, GrindStone, IndustrialMiner, Juicer, MagicWorkbench, MakeshiftSmeltery, OreCrusher, OreWasher, PressureChamber, Smeltery, TableSaw

public abstract class MultiBlockMachine extends SlimefunItem implements NotPlaceable, RecipeDisplayItem
A MultiBlockMachine is a SlimefunItem that is built in the World. It holds recipes and a MultiBlock object which represents its structure.
Author:
TheBusyBiscuit
See Also:
  • Field Details

    • recipes

      protected final List<org.bukkit.inventory.ItemStack[]> recipes
    • displayRecipes

      protected final List<org.bukkit.inventory.ItemStack> displayRecipes
    • multiblock

      protected final MultiBlock multiblock
  • Constructor Details

    • MultiBlockMachine

      @ParametersAreNonnullByDefault protected MultiBlockMachine(ItemGroup itemGroup, SlimefunItemStack item, org.bukkit.inventory.ItemStack[] recipe, org.bukkit.inventory.ItemStack[] machineRecipes, org.bukkit.block.BlockFace trigger)
    • MultiBlockMachine

      @ParametersAreNonnullByDefault protected MultiBlockMachine(ItemGroup itemGroup, SlimefunItemStack item, org.bukkit.inventory.ItemStack[] recipe, org.bukkit.block.BlockFace trigger)
  • Method Details

    • registerDefaultRecipes

      protected void registerDefaultRecipes(@Nonnull List<org.bukkit.inventory.ItemStack> recipes)
    • getRecipes

      @Nonnull public List<org.bukkit.inventory.ItemStack[]> getRecipes()
    • getDisplayRecipes

      @Nonnull public List<org.bukkit.inventory.ItemStack> getDisplayRecipes()
      Description copied from interface: RecipeDisplayItem
      This is the list of items to display alongside this SlimefunItem. Note that these items will be filled in from top to bottom first. So if you want it to express a recipe, add your input ItemStack and then your output ItemStack.
      Specified by:
      getDisplayRecipes in interface RecipeDisplayItem
      Returns:
      The recipes to display in the SlimefunGuide
    • getMultiBlock

      @Nonnull public MultiBlock getMultiBlock()
    • addRecipe

      public void addRecipe(org.bukkit.inventory.ItemStack[] input, org.bukkit.inventory.ItemStack output)
    • clearRecipe

      public void clearRecipe()
    • register

      public void register(@Nonnull SlimefunAddon addon)
      Description copied from class: SlimefunItem
      This method registers this SlimefunItem. Always call this method after your SlimefunItem has been initialized. Never call it more than once!
      Overrides:
      register in class SlimefunItem
      Parameters:
      addon - The SlimefunAddon that this SlimefunItem belongs to.
    • postRegister

      public void postRegister()
      Description copied from class: SlimefunItem
      This method is called after SlimefunItem.register(SlimefunAddon). Override this method to add any additional setup that needs to happen after the original registration of this SlimefunItem.
      Overrides:
      postRegister in class SlimefunItem
    • load

      public void load()
      Description copied from class: SlimefunItem
      This method is used for internal purposes only.
      Overrides:
      load in class SlimefunItem
    • getInteractionHandler

      @Nonnull protected MultiBlockInteractionHandler getInteractionHandler()
    • onInteract

      public abstract void onInteract(org.bukkit.entity.Player p, org.bukkit.block.Block b)
    • findOutputInventory

      @ParametersAreNonnullByDefault @Nullable protected org.bukkit.inventory.Inventory findOutputInventory(org.bukkit.inventory.ItemStack adding, org.bukkit.block.Block dispBlock, org.bukkit.inventory.Inventory dispInv)
      Overloaded method for finding a potential output chest. Fallbacks to the old system of putting the adding back into the dispenser. Optional last argument Inventory placeCheckerInv is for a MultiBlockMachine that create a dummy inventory to check if there's a space for the adding, i.e. Enhanced crafting table
      Parameters:
      adding - The ItemStack that should be added
      dispBlock - The Block of our Dispenser
      dispInv - The Inventory of our Dispenser
      Returns:
      The target Inventory
    • findOutputInventory

      @ParametersAreNonnullByDefault @Nullable protected org.bukkit.inventory.Inventory findOutputInventory(org.bukkit.inventory.ItemStack product, org.bukkit.block.Block dispBlock, org.bukkit.inventory.Inventory dispInv, org.bukkit.inventory.Inventory placeCheckerInv)
    • handleCraftedItem

      @ParametersAreNonnullByDefault protected void handleCraftedItem(org.bukkit.inventory.ItemStack outputItem, org.bukkit.block.Block block, org.bukkit.inventory.Inventory blockInv)
      This method handles an output ItemStack from the MultiBlockMachine which has a crafting delay
      Parameters:
      outputItem - A crafted ItemStack from MultiBlockMachine
      block - Main Block of our Container from MultiBlockMachine
      blockInv - The Inventory of our Container