Class: ItemStack
A detached, mutable item stack value owned by QuestScript.
Constructors
Constructor
new ItemStack(
typeId,amount?):ItemStack
Creates a stack for a namespaced item type.
Parameters
typeId
string
Item type identifier.
amount?
number | null
Initial count; defaults to one.
Returns
ItemStack
Properties
amount
amount:
number
Mutable item count.
nameTag
nameTag:
string
Mutable custom display name; use an empty string to clear it.
typeId
readonlytypeId:string
Namespaced item type identifier.
Methods
clone()
clone():
ItemStack
Returns an independent copy of this stack.
Returns
ItemStack
fromData()
staticfromData(data):ItemStack
Restores every declared field from a typed ItemStackData snapshot.
Parameters
data
ItemStackDataInput | ItemStackData
Returns
ItemStack
getData()
getData(
key):DataValue
Reads data in the calling Script's automatic script-name namespace. Known runtime defect: current storage is still shared by every Script.
Parameters
key
string
Returns
getDataKeys()
getDataKeys(): readonly
string[]
Returns the available QuestScript data keys on this stack.
Returns
readonly string[]
getLore()
getLore(): readonly
string[]
Returns a copy of the current lore lines.
Returns
readonly string[]
getTags()
getTags(): readonly
string[]
Returns the immutable item tags provided by Minecraft.
Returns
readonly string[]
hasTag()
hasTag(
tag):boolean
Returns whether the item has a particular Minecraft tag.
Parameters
tag
string
Returns
boolean
setData()
setData(
key,value?):void
Writes data in the calling Script's automatic script-name namespace. Known runtime defect: current storage is still shared by every Script.
Parameters
key
string
value?
Returns
void
setLore()
setLore(
lore?):void
Replaces the lore; null or omission clears it.
Parameters
lore?
readonly string[] | null
Returns
void
toData()
toData():
ItemStackData
Returns a detached, typed snapshot that can be passed to ItemStack.fromData.