Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ItemExtraData

Class representing item extra data. Used to store additional information about item other then just item id and data

Hierarchy

  • ItemExtraData

Index

Constructors

constructor

Methods

addEnchant

  • addEnchant(id: number, level: number): void
  • Adds a new enchantment to the item

    Parameters

    • id: number

      enchantment id, one of the Native.Enchantment constants

    • level: number

      enchantment level, generally between 1 and 5

    Returns void

copy

getAllEnchantNames

  • getAllEnchantNames(): string

getBoolean

  • getBoolean(name: string, fallback?: boolean): boolean
  • Parameters

    • name: string

      parameter name

    • Optional fallback: 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

getCompoundTag

getCustomName

  • getCustomName(): string

getEnchantCount

  • getEnchantCount(): number

getEnchantLevel

  • getEnchantLevel(id: number): number

getEnchantName

  • getEnchantName(id: number, level: number): string
  • Parameters

    • id: number

      enchantment id, one of the Native.Enchantment constants

    • level: number

      enchantment level, generally between 1 and 5

    Returns string

    enchantment name by its id and level

getEnchants

  • getEnchants(): {}
  • Returns {}

    all the enchantments of the item in the readable format

    • [key: number]: number

getFloat

  • getFloat(name: string, fallback?: number): number
  • Parameters

    • name: string

      parameter name

    • Optional fallback: 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

getInt

  • getInt(name: string, fallback?: number): number
  • Parameters

    • name: string

      parameter name

    • Optional fallback: 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

getLong

  • getLong(name: string, fallback?: number): number
  • Parameters

    • name: string

      parameter name

    • Optional fallback: 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

getString

  • getString(name: string, fallback?: string): string
  • Parameters

    • name: string

      parameter name

    • Optional fallback: 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

isEmpty

  • isEmpty(): boolean

isEnchanted

  • isEnchanted(): boolean

putBoolean

  • Puts some custom boolean parameter to the extra data of the item

    Parameters

    • name: string

      parameter name

    • value: boolean

      parameter value

    Returns ItemExtraData

    reference to itself to be used in sequential calls

putFloat

  • Puts some custom number parameter to the extra data of the item

    Parameters

    • name: string

      parameter name

    • value: 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

    • value: 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

    • value: number

      parameter value

    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

  • removeAllEnchants(): void

removeCustomData

  • removeCustomData(): void

removeEnchant

  • removeEnchant(id: number): void

setCompoundTag

setCustomName

  • setCustomName(name: string): void

Generated using TypeDoc