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
ModifierConstructorDescriptionprotected
LimitedUseItem
(ItemGroup group, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
damageItem
(Player p, ItemStack item) final int
Returns the number of times this item can be used.protected NamespacedKey
Returns theNamespacedKey
under which will the amount of uses left stored.void
register
(SlimefunAddon addon) This method registers thisSlimefunItem
.final LimitedUseItem
setMaxUseCount
(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, preRegister
Methods 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, 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
-
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
LimitedUseItem
for chaining of setters
-
getStorageKey
Returns theNamespacedKey
under which will the amount of uses left stored.- Returns:
- The
NamespacedKey
to store/load the amount of uses
-
register
Description copied from class:SlimefunItem
This method registers thisSlimefunItem
. Always call this method after yourSlimefunItem
has been initialized. Never call it more than once!- Overrides:
register
in classSlimefunItem
- Parameters:
addon
- TheSlimefunAddon
that thisSlimefunItem
belongs to.
-
damageItem
-