Package beer.devs.fastnbt.nms.nbt
Class NItem
java.lang.Object
beer.devs.fastnbt.nms.nbt.NCompound
beer.devs.fastnbt.nms.nbt.NItem
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStack
asCraftMirror
(org.bukkit.inventory.ItemStack itemStack) static String
bukkitItemToCompoundStr
(org.bukkit.inventory.ItemStack bukkitItem) static Object
bukkitItemToNmsCompound
(org.bukkit.inventory.ItemStack itemStack) static Object
bukkitItemToNmsItem
(org.bukkit.inventory.ItemStack itemStack) static @Nullable org.bukkit.inventory.ItemStack
compoundStrToBukkitItem
(String compoundString) static @Nullable org.bukkit.inventory.ItemStack
compoundToBukkitItem
(NCompound compound) org.bukkit.inventory.ItemStack
getItem()
static boolean
hasNBT
(org.bukkit.inventory.ItemStack itemStack) boolean
Items in inventories and in the world are already implementing CraftItemStack NMS class.static boolean
void
boolean
void
merge
(org.bukkit.inventory.ItemStack b) static org.bukkit.inventory.ItemStack
nmsCompoundToBukkitItem
(Object internalCompound) static @Nullable NItem
of
(org.bukkit.inventory.ItemStack itemStack) void
Refreshes copy if needed.void
save()
Applies changes to the original ItemStack if needed.void
setCustomName
(String compoundString) void
setItemName
(String compoundString) void
void
setType
(org.bukkit.Material type) Methods inherited from class beer.devs.fastnbt.nms.nbt.NCompound
addCompound, addList, getBoolean, getByte, getByteArray, getCompound, getDouble, getFloat, getInt, getIntArray, getInternal, getKeys, getList, getLong, getLongArray, getOrAddCompound, getOrAddList, getShort, getString, getUUID, hasKey, hasUUID, isEmpty, merge, newNmsInstance, putInternalTag, remove, setBoolean, setByte, setByteArray, setCompound, setDouble, setFloat, setInt, setIntArray, setIntegerList, setList, setLong, setLongArray, setLongList, setShort, setString, setUUID, toBukkitItem, toString
-
Constructor Details
-
NItem
public NItem(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
-
-
Method Details
-
of
-
getItem
public org.bukkit.inventory.ItemStack getItem() -
setType
public void setType(org.bukkit.Material type) -
isConvertedCopy
public boolean isConvertedCopy()Items in inventories and in the world are already implementing CraftItemStack NMS class. Other items created with Bukkit API and in some other cases do not implement CraftItemStack, so we have to use a temporary copy of the item and apply the changes later using save() method.- Returns:
- true if this item wasn't originally a CraftItemStack, otherwise returns false.
-
save
public void save()Applies changes to the original ItemStack if needed. It only saves changes if the original item isn't a CraftItemStack. Items in inventories and in the world are already implementing CraftItemStack NMS class. Other items created with Bukkit API and in some other cases do not implement CraftItemStack. -
refreshCopy
public void refreshCopy()Refreshes copy if needed. Only if it's a CraftItemStack copy. -
hasNBT
public static boolean hasNBT(org.bukkit.inventory.ItemStack itemStack) -
merge
public void merge(org.bukkit.inventory.ItemStack b) -
merge
-
merge
- Throws:
com.google.gson.JsonSyntaxException
-
isValid
-
asCraftMirror
public static org.bukkit.inventory.ItemStack asCraftMirror(org.bukkit.inventory.ItemStack itemStack) -
compoundToBukkitItem
@Nullable public static @Nullable org.bukkit.inventory.ItemStack compoundToBukkitItem(NCompound compound) -
bukkitItemToNmsItem
-
nmsCompoundToBukkitItem
@Internal public static org.bukkit.inventory.ItemStack nmsCompoundToBukkitItem(Object internalCompound) -
bukkitItemToNmsCompound
-
compoundStrToBukkitItem
@Nullable public static @Nullable org.bukkit.inventory.ItemStack compoundStrToBukkitItem(String compoundString) -
bukkitItemToCompoundStr
-
getCustomName
-
getCustomNameJson
-
setCustomName
-
getItemName
-
setItemName
-
getLoreCopy
-
setLore
-