Class ItemStackWrapper
java.lang.Object
org.bukkit.inventory.ItemStack
io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper
- All Implemented Interfaces:
Cloneable,ConfigurationSerializable,Translatable
This
Please be very careful when using this.
ItemStack, which is not intended for actual usage, caches its ItemMeta.
This significantly speeds up any ItemStack comparisons a lot.
You cannot invoke equals(Object), hashCode() or any of its setter on an
ItemStackWrapper.Please be very careful when using this.
- Author:
- TheBusyBiscuit, md5sha256
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddUnsafeEnchantment(Enchantment ench, int level) clone()booleanstatic ItemStackWrapperCreates anItemStackWrapperof anItemStack.intinthashCode()booleanvoidsetAmount(int amount) booleansetItemMeta(ItemMeta itemMeta) voidstatic ItemStackWrapperCreates anItemStackWrapperof anItemStack.static ItemStackWrapper[]This creates anItemStackWrapperarray from a givenItemStackarray.static List<ItemStackWrapper>Methods inherited from class org.bukkit.inventory.ItemStack
addEnchantment, addEnchantments, addUnsafeEnchantments, containsEnchantment, deserialize, getData, getDurability, getEnchantmentLevel, getEnchantments, getMaxStackSize, getTranslationKey, getType, isSimilar, removeEnchantment, removeEnchantments, serialize, setData, setDurability, toString
-
Method Details
-
hasItemMeta
public boolean hasItemMeta()- Overrides:
hasItemMetain classItemStack
-
getItemMeta
- Overrides:
getItemMetain classItemStack
-
getAmount
public int getAmount() -
equals
-
hashCode
public int hashCode() -
clone
-
setType
-
setAmount
public void setAmount(int amount) -
setItemMeta
- Overrides:
setItemMetain classItemStack
-
addUnsafeEnchantment
- Overrides:
addUnsafeEnchantmentin classItemStack
-
forceWrap
Creates anItemStackWrapperof anItemStack. This method will not check if the passedItemStackhas already been wrapped- Parameters:
itemStack- TheItemStackto wrap- Returns:
- Returns an
ItemStackWrapperof the passedItemStack - See Also:
-
wrap
Creates anItemStackWrapperof anItemStack. This method will return the the casted reference of the passedItemStackif it is already anItemStackWrapper- Parameters:
itemStack- TheItemStackto wrap- Returns:
- Returns an
ItemStackWrapperof the passedItemStack - See Also:
-
wrapArray
This creates anItemStackWrapperarray from a givenItemStackarray.- Parameters:
items- The array ofItemStacksto transform- Returns:
- An
ItemStackWrapperarray
-
wrapList
- Parameters:
items- TheListofItemStacksto transform- Returns:
- An
ItemStackWrapperarray
-