Class MenuBlock
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
-
Field Summary
Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMenuBlock(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 ofMenuBlock. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 givenItemStack.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 differentItemTransportFlow.protected voidonBreak(org.bukkit.event.block.BlockBreakEvent e, me.mrCookieSlime.Slimefun.api.inventory.BlockMenu menu) The default handler when block breaks.protected voidonNewInstance(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 voidonPlace(org.bukkit.event.block.BlockPlaceEvent e, org.bukkit.block.Block b) The default handler when block places.voidBe sure to callsuper.postRegister()if you override this method.protected abstract voidsetup(me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset preset) Set up theBlockMenuPresetof 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, warnMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 ofMenuBlock. Add events on break and place
-
-
Method Details
-
postRegister
public void postRegister()Be sure to callsuper.postRegister()if you override this method.- Overrides:
postRegisterin classio.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
-
setup
@ParametersAreNonnullByDefault protected abstract void setup(me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset preset) Set up theBlockMenuPresetof this block.- Parameters:
preset- TheBlockMenuPresetof 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 differentItemTransportFlow. For insert, return input slots. For withdraw, return output slots.- Parameters:
menu- TheDirtyChestMenuof this block.flow- TheItemTransportFlow.item- TheItemStackto 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 givenItemStack. By default, it returns all the input slots.- Parameters:
menu- TheDirtyChestMenuof this block.item- TheItemStackto 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- TheBlockMenuof this block.b- TheBlock.
-
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- TheBlockBreakEvent.menu- TheBlockMenuof 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- TheBlockPlaceEvent.b- TheBlockplaced.
-