Class BlockMenuPreset
java.lang.Object
me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset
-
Nested Class Summary
Nested classes/interfaces inherited from class me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
ChestMenu.AdvancedMenuClickHandler, ChestMenu.MenuClickHandler, ChestMenu.MenuCloseHandler, ChestMenu.MenuOpeningHandler
-
Constructor Summary
ModifierConstructorDescriptionprotected
BlockMenuPreset
(String id, String title) protected
BlockMenuPreset
(String id, String title, boolean universal) -
Method Summary
Modifier and TypeMethodDescriptionAdds an Item to the Inventory in that SlotaddMenuClickHandler
(int slot, ChestMenu.MenuClickHandler handler) Executes a certain Action upon clicking an Item in the Menuabstract boolean
protected void
clone
(DirtyChestMenu menu) void
drawBackground
(int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.void
drawBackground
(ItemStack item, int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.getID()
This returns the id of the associatedSlimefunItem
.static BlockMenuPreset
int
getSize()
This method returns the size of thisBlockMenuPreset
.This returns theSlimefunItem
associated with thisBlockMenuPreset
.int[]
getSlotsAccessedByItemTransport
(DirtyChestMenu menu, ItemTransportFlow flow, ItemStack item) abstract int[]
getTitle()
This returns the title of thisBlockMenuPreset
, the title will be visible in everyInventoryView
for any menu created using thisBlockMenuPreset
.abstract void
init()
static boolean
isInventory
(String id) boolean
This method returns whether thisBlockMenuPreset
will spawn aUniversalBlockMenu
.static boolean
void
newInstance
(BlockMenu menu, Block b) void
newInstance
(BlockMenu menu, Location l) protected ItemStack
onItemStackChange
(DirtyChestMenu menu, int slot, ItemStack previous, ItemStack next) This method is called whenever anItemStack
changes.void
replaceExistingItem
(int slot, ItemStack item) Modifies an ItemStack in an ALREADY OPENED ChestMenusetSize
(int size) Methods inherited from class me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
addItem, addMenuCloseHandler, addMenuOpeningHandler, addPlayerInventoryClickHandler, build, getContents, getItemInSlot, getMenuClickHandler, getMenuCloseHandler, getMenuOpeningHandler, getPlayerInventoryClickHandler, isEmptySlotsClickable, isPlayerInventoryClickable, open, reset, setEmptySlotsClickable, setPlayerInventoryClickable, toInventory
-
Constructor Details
-
BlockMenuPreset
-
BlockMenuPreset
-
-
Method Details
-
init
public abstract void init() -
canOpen
-
getSlotsAccessedByItemTransport
-
onItemStackChange
@Nullable protected ItemStack onItemStackChange(@Nonnull DirtyChestMenu menu, int slot, @Nullable ItemStack previous, @Nullable ItemStack next) This method is called whenever anItemStack
changes. You can override this as necessary if you need to listen to these events -
newInstance
-
getSlotsAccessedByItemTransport
public int[] getSlotsAccessedByItemTransport(DirtyChestMenu menu, ItemTransportFlow flow, ItemStack item) -
replaceExistingItem
Description copied from class:ChestMenu
Modifies an ItemStack in an ALREADY OPENED ChestMenu- Overrides:
replaceExistingItem
in classChestMenu
- Parameters:
slot
- The Slot of the Item which will be replaceditem
- The new Item
-
drawBackground
This method will draw unclickable background items into thisBlockMenuPreset
.- Parameters:
item
- TheItemStack
that should be used as backgroundslots
- The slots which should be treated as background
-
drawBackground
public void drawBackground(@Nonnull int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.- Parameters:
slots
- The slots which should be treated as background
-
addItem
Description copied from class:ChestMenu
Adds an Item to the Inventory in that Slot -
addMenuClickHandler
Description copied from class:ChestMenu
Executes a certain Action upon clicking an Item in the Menu- Overrides:
addMenuClickHandler
in classChestMenu
- Parameters:
slot
- The Slot in the Inventoryhandler
- The MenuClickHandler- Returns:
- The ChestMenu Instance
-
setSize
-
getSize
public int getSize()This method returns the size of thisBlockMenuPreset
. If the size has not been determined yet, this will return -1.- Returns:
- The size of this
BlockMenuPreset
-
getTitle
This returns the title of thisBlockMenuPreset
, the title will be visible in everyInventoryView
for any menu created using thisBlockMenuPreset
.- Returns:
- The inventory title for this
BlockMenuPreset
-
isUniversal
public boolean isUniversal()This method returns whether thisBlockMenuPreset
will spawn aUniversalBlockMenu
.- Returns:
- Whether this
BlockMenuPreset
is universal
-
getPresetSlots
-
getInventorySlots
-
clone
-
newInstance
-
getID
This returns the id of the associatedSlimefunItem
. It also doubles as the id for thisBlockMenuPreset
.- Returns:
- Our identifier
-
getSlimefunItem
This returns theSlimefunItem
associated with thisBlockMenuPreset
.- Returns:
- The associated
SlimefunItem
-
getPreset
-
isInventory
-
isUniversalInventory
-