Class LimitedUseItem
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem<ItemUseHandler>
io.github.thebusybiscuit.slimefun4.implementation.items.LimitedUseItem
- All Implemented Interfaces:
Placeable
- Direct Known Subclasses:
StormStaff
This class represents an item with a limited number of uses.
When the item runs out of "uses", it breaks.
- Author:
- Linox, Walshy, TheBusyBiscuit, martinbrom
- See Also:
-
Field Summary
Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLimitedUseItem(ItemGroup group, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddamageItem(Player p, ItemStack item) final intReturns the number of times this item can be used.protected NamespacedKeyReturns theNamespacedKeyunder which will the amount of uses left stored.voidregister(SlimefunAddon addon) This method registers thisSlimefunItem.final LimitedUseItemsetMaxUseCount(int count) Sets the maximum number of times this item can be used.Methods inherited from class io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem
getItemHandler, preRegisterMethods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addItemHandler, addItemSetting, addOfficialWikipage, callItemHandler, canUse, 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, postRegister, 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
-
LimitedUseItem
@ParametersAreNonnullByDefault protected LimitedUseItem(ItemGroup group, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe)
-
-
Method Details
-
getMaxUseCount
public final int getMaxUseCount()Returns the number of times this item can be used.- Returns:
- The number of times this item can be used.
-
setMaxUseCount
Sets the maximum number of times this item can be used. The number must be greater than zero.- Parameters:
count- The maximum number of times this item can be used.- Returns:
- The
LimitedUseItemfor chaining of setters
-
getStorageKey
Returns theNamespacedKeyunder which will the amount of uses left stored.- Returns:
- The
NamespacedKeyto store/load the amount of uses
-
register
Description copied from class:SlimefunItemThis method registers thisSlimefunItem. Always call this method after yourSlimefunItemhas been initialized. Never call it more than once!- Overrides:
registerin classSlimefunItem- Parameters:
addon- TheSlimefunAddonthat thisSlimefunItembelongs to.
-
damageItem
-