java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
net.guizhanss.guizhanlib.slimefun.machines.MenuBlock
All Implemented Interfaces:
io.github.thebusybiscuit.slimefun4.core.attributes.Placeable
Direct Known Subclasses:
TickingMenuBlock

@ParametersAreNonnullByDefault public abstract class MenuBlock extends io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
A MenuBlock is a SlimefunItem with MenuBlockPreset.

Modified from InfinityLib

  • Field Summary

    Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem

    addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    MenuBlock(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup itemGroup, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack item, io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe)
    Constructor of MenuBlock.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract int[]
    All the input slots.
    protected int[]
    getInputSlots(me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu menu, org.bukkit.inventory.ItemStack item)
    The input slots for the given ItemStack.
    protected abstract int[]
    All the output slots.
    protected final int[]
    getTransportSlots(me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu menu, me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow flow, org.bukkit.inventory.ItemStack item)
    Returns the slots for different ItemTransportFlow.
    protected void
    onBreak(org.bukkit.event.block.BlockBreakEvent e, me.mrCookieSlime.Slimefun.api.inventory.BlockMenu menu)
    The default handler when block breaks.
    protected void
    onNewInstance(me.mrCookieSlime.Slimefun.api.inventory.BlockMenu menu, org.bukkit.block.Block b)
    This method is called when a new instance of this block is created.
    protected void
    onPlace(org.bukkit.event.block.BlockPlaceEvent e, org.bukkit.block.Block b)
    The default handler when block places.
    void
    Be sure to call super.postRegister() if you override this method.
    protected abstract void
    setup(me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset preset)
    Set up the BlockMenuPreset of this block.

    Methods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem

    addItemHandler, addItemSetting, addOfficialWikipage, callItemHandler, canUse, equals, error, getAddon, getBlockTicker, getById, getByItem, getByItem, getDrops, getDrops, getHandlers, getId, getItem, getItemGroup, getItemName, getItemSetting, getItemSettings, getOptionalById, getOptionalByItem, getRecipe, getRecipeOutput, getRecipeType, getResearch, getState, getWikipage, hashCode, hasResearch, info, isDisabled, isDisabledIn, isDisenchantable, isEnchantable, isHidden, isItem, isTicking, isUseableInWorkbench, load, preRegister, register, sendDeprecationWarning, setHidden, setItemGroup, setRecipe, setRecipeOutput, setRecipeType, setResearch, setUseableInWorkbench, toString, warn

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.Placeable

    useVanillaBlockBreaking
  • Constructor Details

    • MenuBlock

      @ParametersAreNonnullByDefault protected MenuBlock(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup itemGroup, io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack item, io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe)
      Constructor of MenuBlock. Add events on break and place
      Parameters:
      itemGroup - the ItemGroup of this MenuBlock
      item - the SlimefunItemStack of this MenuBlock
      recipeType - the RecipeType of this MenuBlock
      recipe - the recipe of this MenuBlock
  • Method Details

    • postRegister

      public void postRegister()
      Be sure to call super.postRegister() if you override this method.
      Overrides:
      postRegister in class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
    • setup

      @ParametersAreNonnullByDefault protected abstract void setup(me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset preset)
      Set up the BlockMenuPreset of this block.
      Parameters:
      preset - The BlockMenuPreset of this block.
    • getTransportSlots

      @ParametersAreNonnullByDefault @Nonnull protected final int[] getTransportSlots(me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu menu, me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow flow, org.bukkit.inventory.ItemStack item)
      Returns the slots for different ItemTransportFlow. For insert, return input slots. For withdraw, return output slots.
      Parameters:
      menu - The DirtyChestMenu of this block.
      flow - The ItemTransportFlow.
      item - The ItemStack to transport.
      Returns:
      The slots for different ItemTransportFlow.
    • getInputSlots

      @ParametersAreNonnullByDefault protected int[] getInputSlots(me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu menu, org.bukkit.inventory.ItemStack item)
      The input slots for the given ItemStack. By default, it returns all the input slots.
      Parameters:
      menu - The DirtyChestMenu of this block.
      item - The ItemStack to transport.
      Returns:
      The input slots for the given ItemStack.
    • getInputSlots

      protected abstract int[] getInputSlots()
      All the input slots.
      Returns:
      All the input slots.
    • getOutputSlots

      protected abstract int[] getOutputSlots()
      All the output slots.
      Returns:
      All the output slots.
    • onNewInstance

      @ParametersAreNonnullByDefault protected void onNewInstance(me.mrCookieSlime.Slimefun.api.inventory.BlockMenu menu, org.bukkit.block.Block b)
      This method is called when a new instance of this block is created. (usually after placed, or after server start)
      Parameters:
      menu - The BlockMenu of this block.
      b - The Block.
    • onBreak

      @ParametersAreNonnullByDefault protected void onBreak(org.bukkit.event.block.BlockBreakEvent e, me.mrCookieSlime.Slimefun.api.inventory.BlockMenu menu)
      The default handler when block breaks. Drop items in input and output slots.
      Parameters:
      e - The BlockBreakEvent.
      menu - The BlockMenu of this block.
    • onPlace

      @ParametersAreNonnullByDefault protected void onPlace(org.bukkit.event.block.BlockPlaceEvent e, org.bukkit.block.Block b)
      The default handler when block places.
      Parameters:
      e - The BlockPlaceEvent.
      b - The Block placed.