Class SlimefunBackpack
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem<ItemUseHandler>
io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.SlimefunBackpack
- All Implemented Interfaces:
DistinctiveItem,ItemAttribute,NotPlaceable,Placeable
- Direct Known Subclasses:
Cooler,RestoredBackpack,SoulboundBackpack
public class SlimefunBackpack
extends SimpleSlimefunItem<ItemUseHandler>
implements DistinctiveItem, NotPlaceable
This class represents a
SlimefunItem that is considered a Backpack.
Right-Clicking will open the Inventory of the currently held Backpack.- Author:
- TheBusyBiscuit
- See Also:
-
Field Summary
Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench -
Constructor Summary
ConstructorsConstructorDescriptionSlimefunBackpack(int size, ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanStack(org.bukkit.inventory.meta.ItemMeta itemMetaOne, org.bukkit.inventory.meta.ItemMeta itemMetaTwo) This method is called bySlimefunUtils.isItemSimilar(org.bukkit.inventory.ItemStack, org.bukkit.inventory.ItemStack, boolean)when twoSlimefunItemStackIDs match on a DistinctiveItem and should return if the two items can stack with one another.This returns theItemHandlerthat will be added to thisSlimefunItem.intgetSize()This returns the size of thisSlimefunBackpack.booleanisItemAllowed(org.bukkit.inventory.ItemStack item, SlimefunItem itemAsSlimefunItem) This method returns whether a givenItemStackis allowed to be stored in thisSlimefunBackpack.Methods inherited from class io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem
preRegisterMethods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addItemHandler, addItemSetting, addOfficialWikipage, addWikiPage, callItemHandler, canUse, disable, enable, equals, error, getAddon, getBlockTicker, getById, 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, isItemStackImmutable, isTicking, isUseableInWorkbench, load, loadDataByDefault, postRegister, 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.ItemAttribute
getIdMethods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.Placeable
useVanillaBlockBreaking
-
Constructor Details
-
SlimefunBackpack
@ParametersAreNonnullByDefault public SlimefunBackpack(int size, ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe)
-
-
Method Details
-
getSize
public int getSize()This returns the size of thisSlimefunBackpack.- Returns:
- The size of this backpack
-
isItemAllowed
public boolean isItemAllowed(@Nonnull org.bukkit.inventory.ItemStack item, @Nullable SlimefunItem itemAsSlimefunItem) This method returns whether a givenItemStackis allowed to be stored in thisSlimefunBackpack.- Parameters:
item- TheItemStackto check foritemAsSlimefunItem- The sameItemStackas aSlimefunItem, might be null- Returns:
- Whether the given
ItemStackis allowed to be put into thisSlimefunBackpack
-
getItemHandler
Description copied from class:SimpleSlimefunItemThis returns theItemHandlerthat will be added to thisSlimefunItem.- Specified by:
getItemHandlerin classSimpleSlimefunItem<ItemUseHandler>- Returns:
- The
ItemHandlerthat should be added to thisSlimefunItem
-
canStack
public boolean canStack(@Nonnull org.bukkit.inventory.meta.ItemMeta itemMetaOne, @Nonnull org.bukkit.inventory.meta.ItemMeta itemMetaTwo) Description copied from interface:DistinctiveItemThis method is called bySlimefunUtils.isItemSimilar(org.bukkit.inventory.ItemStack, org.bukkit.inventory.ItemStack, boolean)when twoSlimefunItemStackIDs match on a DistinctiveItem and should return if the two items can stack with one another.- Specified by:
canStackin interfaceDistinctiveItem- Parameters:
itemMetaOne- TheItemMetaof the first stack being compared.itemMetaTwo- TheItemMetaof the second stack being compared.- Returns:
- Whether the two
ItemMetas are stackable
-