ItemExtraData
Index
Constructors
Methods
- addEnchant
- applyTo
- asJson
- copy
- getAllCustomData
- getAllEnchantNames
- getBoolean
- getCompoundTag
- getCustomName
- getEnchantCount
- getEnchantLevel
- getEnchantName
- getEnchants
- getFloat
- getInt
- getLong
- getRawEnchants
- getSerializable
- getString
- getValue
- isEmpty
- isEnchanted
- isFinalizableInstance
- putBoolean
- putFloat
- putInt
- putLong
- putObject
- putSerializable
- putString
- removeAllEnchants
- removeCustomData
- removeEnchant
- setAllCustomData
- setCompoundTag
- setCustomName
- cloneExtra
- fromJson
- getExtraOrNull
- getValueOrNullPtr
- unwrapObject
- unwrapValue
Constructors
constructor
Creates an empty ItemExtraData instance.
Returns ItemExtraData
Methods
addEnchant
Adds a new enchantment to the item.
Parameters
type: number
enchantment ID, one of the EEnchantment constants
level: number
enchantment level, generally between 1 and 5
Returns void
applyTo
Parameters
item: ItemInstance
Returns void
asJson
Returns JSONObject
copy
Creates a copy of current ItemExtraData object.
Returns ItemExtraData
A created copy of the data.
getAllCustomData
Returns string
getAllEnchantNames
Returns string
All enchantments names separated by line breaks.
getBoolean
Parameters
name: string
parameter name
optionalfallback: boolean
default value to be returned if item extra data doesn't contain a parameter with specified name
Returns boolean
Custom boolean parameter value if extra data of the item contains one, fallback value otherwise. If fallback was not specified,
null
is returned.
getCompoundTag
Returns CompoundTag
Compound tag for the specified item.
getCustomName
Returns string
Item's custom name.
getEnchantCount
Returns number
Amount of enchantments applied to the item.
getEnchantLevel
Parameters
type: number
enchantment ID, one of the EEnchantment constants
Returns number
Level of the specified enchantment.
getEnchantName
Parameters
id: number
enchantment ID, one of the EEnchantment constants
level: number
enchantment level, generally between 1 and 5
Returns string
Enchantment name by it's ID and level.
getEnchants
Returns {}
[id number]: number
getFloat
Parameters
name: string
parameter name
optionalfallback: number
default value to be returned if item extra data doesn't contain a parameter with specified name
Returns number
Custom float parameter value if extra data of the item contains one, fallback value otherwise. If fallback was not specified,
null
is returned.
getInt
Parameters
name: string
parameter name
optionalfallback: number
default value to be returned if item extra data doesn't contain a parameter with specified name
Returns number
Custom integer parameter value if extra data of the item contains one, fallback value otherwise. If fallback was not specified,
null
is returned.
getLong
Parameters
name: string
parameter name
optionalfallback: number
default value to be returned if item extra data doesn't contain a parameter with specified name
Returns number
Custom long integer parameter value if extra data of the item contains one, fallback value otherwise. If fallback was not specified,
null
is returned.
getRawEnchants
Returns number[][]
getSerializable
Parameters
name: string
Returns any
getString
Parameters
name: string
parameter name
optionalfallback: string
default value to be returned if item extra data doesn't contain a parameter with specified name
Returns string
Custom string parameter value if extra data of the item contains one, fallback value otherwise. If fallback was not specified,
null
is returned.
getValue
Returns number
isEmpty
Returns boolean
true
, if item extra exists and is not empty.
isEnchanted
Returns boolean
true
if the item is enchanted,false
otherwise.
isFinalizableInstance
Returns boolean
putBoolean
Puts some custom boolean parameter to the extra data of the item.
Parameters
name: string
parameter name
bool: boolean
parameter value
Returns ItemExtraData
Reference to itself to be used in sequential calls.
putFloat
Puts some custom floating point number parameter to the extra data of the item.
Parameters
name: string
parameter name
float: number
parameter value
Returns ItemExtraData
Reference to itself to be used in sequential calls.
putInt
Puts some custom integer parameter to the extra data of the item.
Parameters
name: string
parameter name
int: number
parameter value
Returns ItemExtraData
Reference to itself to be used in sequential calls.
putLong
Puts some custom long integer parameter to the extra data of the item.
Parameters
name: string
parameter name
long: number
parameter value
Returns ItemExtraData
Reference to itself to be used in sequential calls.
putObject
Parameters
name: string
value: any
Returns ItemExtraData
Reference to itself to be used in sequential calls.
putSerializable
Parameters
name: string
serializableObject: any
Returns ItemExtraData
Reference to itself to be used in sequential calls.
putString
Puts some custom string parameter to the extra data of the item.
Parameters
name: string
parameter name
value: string
parameter value
Returns ItemExtraData
Reference to itself to be used in sequential calls.
removeAllEnchants
Removes all the enchantments of the item.
Returns void
removeCustomData
Removes all custom parameters from item extra data.
Returns void
removeEnchant
Removes enchantments by it's ID.
Parameters
type: number
enchantment ID, one of the EEnchantment constants
Returns void
setAllCustomData
Parameters
data: string
Returns void
setCompoundTag
Sets compound tag for the specified item.
Parameters
ent: number
tag: CompoundTag
Returns void
setCustomName
Sets item's custom name.
Parameters
name: string
Returns void
staticcloneExtra
Parameters
extra: ItemExtraData
Returns ItemExtraData
staticfromJson
Parameters
json: JSONObject
Returns ItemExtraData
staticgetExtraOrNull
Parameters
pointer: number
Returns ItemExtraData
staticgetValueOrNullPtr
Parameters
extra: ItemExtraData
Returns number
staticunwrapObject
Parameters
extra: any
Returns ItemExtraData
staticunwrapValue
Parameters
extra: any
Returns number
Class representing item extra data. Used to store additional information about item other then just item ID and data.