public class NBTItem extends NBTCompound implements ReadWriteItemNBT
Modifier | Constructor and Description |
---|---|
|
NBTItem(org.bukkit.inventory.ItemStack item)
Deprecated.
|
|
NBTItem(org.bukkit.inventory.ItemStack item,
boolean directApply)
Deprecated.
|
protected |
NBTItem(org.bukkit.inventory.ItemStack item,
boolean directApply,
boolean readOnly,
boolean finalizer) |
Modifier and Type | Method and Description |
---|---|
void |
applyNBT(org.bukkit.inventory.ItemStack item)
Deprecated.
|
void |
clearCustomNBT()
Deprecated.
|
static NBTContainer |
convertItemArraytoNBT(org.bukkit.inventory.ItemStack[] items)
Deprecated.
|
static NBTContainer |
convertItemtoNBT(org.bukkit.inventory.ItemStack item)
Deprecated.
|
static org.bukkit.inventory.ItemStack |
convertNBTtoItem(NBTCompound comp)
Deprecated.
|
static org.bukkit.inventory.ItemStack[] |
convertNBTtoItemArray(NBTCompound comp)
Deprecated.
|
protected void |
finalizeChanges() |
Object |
getCompound() |
org.bukkit.inventory.ItemStack |
getItem() |
boolean |
hasCustomNbtData()
Deprecated.
|
boolean |
hasNBTData()
Returns true if the item has NBT data.
|
protected boolean |
isClosed() |
void |
mergeCustomNBT(org.bukkit.inventory.ItemStack item)
Deprecated.
|
void |
mergeNBT(org.bukkit.inventory.ItemStack item)
Deprecated.
|
void |
modifyMeta(BiConsumer<ReadableNBT,org.bukkit.inventory.meta.ItemMeta> handler)
Gives save access to the
ItemMeta of the internal ItemStack . |
<T extends org.bukkit.inventory.meta.ItemMeta> |
modifyMeta(Class<T> type,
BiConsumer<ReadableNBT,T> handler)
Gives save access to the
ItemMeta of the internal ItemStack . |
protected void |
saveCompound() |
protected void |
setClosed() |
protected void |
setCompound(Object compound) |
protected void |
setItem(org.bukkit.inventory.ItemStack item) |
addCompound, asNBTString, clearNBT, equals, get, getBoolean, getByte, getByteArray, getCompound, getCompoundList, getDouble, getDoubleList, getEnum, getFloat, getFloatList, getIntArray, getIntArrayList, getInteger, getIntegerList, getItemStack, getItemStackArray, getKeys, getListType, getLong, getLongArray, getLongList, getName, getObject, getOrCreateCompound, getOrDefault, getOrNull, getParent, getReadLock, getResolvedObject, getShort, getString, getStringList, getType, getUUID, getUUIDList, getWriteLock, hashCode, hasKey, hasTag, isReadOnly, mergeCompound, mergeCompound, removeKey, resolveCompound, resolveOrCreateCompound, resolveOrDefault, resolveOrNull, set, set, setBoolean, setByte, setByteArray, setDouble, setEnum, setFloat, setIntArray, setInteger, setItemStack, setItemStackArray, setLong, setLongArray, setObject, setResolvedObject, setShort, setString, setUUID, toString, toString, writeCompound
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
clearNBT, getCompound, getCompoundList, getDoubleList, getFloatList, getIntArrayList, getIntegerList, getLongList, getOrCreateCompound, getStringList, getUUIDList, mergeCompound, removeKey, resolveCompound, resolveOrCreateCompound, set, setBoolean, setByte, setByteArray, setDouble, setEnum, setFloat, setIntArray, setInteger, setItemStack, setItemStackArray, setLong, setLongArray, setShort, setString, setUUID
get, getBoolean, getByte, getByteArray, getDouble, getEnum, getFloat, getIntArray, getInteger, getItemStack, getItemStackArray, getKeys, getListType, getLong, getLongArray, getOrDefault, getOrNull, getShort, getString, getType, getUUID, hasTag, hasTag, resolveOrDefault, resolveOrNull, toString, writeCompound
@Deprecated public NBTItem(org.bukkit.inventory.ItemStack item)
item
- protected NBTItem(org.bukkit.inventory.ItemStack item, boolean directApply, boolean readOnly, boolean finalizer)
item
- directApply
- readOnly
- When turned on, no copy of the source item is created.
Modifying the stack in that case is not valid! Also
overwrites directApply@Deprecated public NBTItem(org.bukkit.inventory.ItemStack item, boolean directApply)
item
- directApply
- public Object getCompound()
getCompound
in class NBTCompound
protected void finalizeChanges()
protected void setClosed()
setClosed
in class NBTCompound
protected boolean isClosed()
isClosed
in class NBTCompound
protected void setCompound(Object compound)
setCompound
in class NBTCompound
@Deprecated public void applyNBT(org.bukkit.inventory.ItemStack item)
Note: This will completely override current item's ItemMeta
. If you
still want to keep the original item's NBT tags, see
mergeNBT(ItemStack)
and mergeCustomNBT(ItemStack)
.
item
- ItemStack that should get the new NBT data@Deprecated public void mergeNBT(org.bukkit.inventory.ItemStack item)
item
- ItemStack that should get the new NBT data@Deprecated public void mergeCustomNBT(org.bukkit.inventory.ItemStack item)
item
- ItemStack that should get the new NBT data@Deprecated public boolean hasCustomNbtData()
hasCustomNbtData
in interface ReadWriteItemNBT
@Deprecated public void clearCustomNBT()
clearCustomNBT
in interface ReadWriteItemNBT
public org.bukkit.inventory.ItemStack getItem()
protected void setItem(org.bukkit.inventory.ItemStack item)
public boolean hasNBTData()
hasNBTData
in interface ReadableItemNBT
public void modifyMeta(BiConsumer<ReadableNBT,org.bukkit.inventory.meta.ItemMeta> handler)
ItemMeta
of the internal ItemStack
.
Supported operations while inside this scope: - any get/set method of
ItemMeta
- any getter on NBTItem
All changes made to the NBTItem
during this scope will be reverted at
the end.modifyMeta
in interface ReadWriteItemNBT
handler
- public <T extends org.bukkit.inventory.meta.ItemMeta> void modifyMeta(Class<T> type, BiConsumer<ReadableNBT,T> handler)
ItemMeta
of the internal ItemStack
.
Supported operations while inside this scope: - any get/set method of
ItemMeta
- any getter on NBTItem
All changes made to the NBTItem
during this scope will be reverted at
the end.modifyMeta
in interface ReadWriteItemNBT
handler
- @Deprecated public static NBTContainer convertItemtoNBT(org.bukkit.inventory.ItemStack item)
ItemStack
to NBTContainer
with
all it's data like Material, Damage, Amount and Tags.item
- NBTContainer
with the Item's data@Nullable @Deprecated public static org.bukkit.inventory.ItemStack convertNBTtoItem(NBTCompound comp)
ItemStack
using the NBTCompound
comp
- NBTCompound
's data@Deprecated public static NBTContainer convertItemArraytoNBT(org.bukkit.inventory.ItemStack[] items)
ItemStack
[] to NBTContainer
with
all its data like Material, Damage, Amount and Tags. This is a custom
implementation and won't work with vanilla code(Shulker content etc).items
- NBTContainer
with the Item's data@Nullable @Deprecated public static org.bukkit.inventory.ItemStack[] convertNBTtoItemArray(NBTCompound comp)
ItemStack
[] using the NBTCompound
. This is a custom
implementation and won't work with vanilla code (Shulker content, etc.).
Will return null for invalid data. Empty slots in the array are filled with
AIR Stacks!comp
- NBTCompound
's dataprotected void saveCompound()
saveCompound
in class NBTCompound
Copyright © 2015–2024 tr7zw. All rights reserved.