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.ItemStackasCraftMirror(org.bukkit.inventory.ItemStack itemStack) static StringbukkitItemToCompoundStr(org.bukkit.inventory.ItemStack bukkitItem) static ObjectbukkitItemToNmsCompound(org.bukkit.inventory.ItemStack itemStack) static ObjectbukkitItemToNmsItem(org.bukkit.inventory.ItemStack itemStack) static @Nullable org.bukkit.inventory.ItemStackcompoundStrToBukkitItem(String compoundString) static @Nullable org.bukkit.inventory.ItemStackcompoundToBukkitItem(NCompound compound) org.bukkit.inventory.ItemStackgetItem()static booleanhasNBT(org.bukkit.inventory.ItemStack itemStack) booleanItems in inventories and in the world are already implementing CraftItemStack NMS class.static booleanvoidbooleanvoidmerge(org.bukkit.inventory.ItemStack b) static org.bukkit.inventory.ItemStacknmsCompoundToBukkitItem(Object internalCompound) static @Nullable NItemof(org.bukkit.inventory.ItemStack itemStack) voidRefreshes copy if needed.voidsave()Applies changes to the original ItemStack if needed.voidsetCustomName(String compoundString) voidsetItemName(String compoundString) voidvoidsetType(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
-