Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CompoundTag

List tags represent NBT map-like data structure (key-value pairs). Its values may be of any type, so check the type before calling the appropriate getter

Hierarchy

  • CompoundTag

Index

Constructors

constructor

Methods

clear

  • clear(): void

contains

  • contains(key: string): boolean
  • Parameters

    • key: string

    Returns boolean

    true if specified key exists in compound tag

containsValueOfType

  • containsValueOfType(key: string, type: number): boolean
  • Parameters

    • key: string

      key to verify for the type

    • type: number

      tag type to verify for, one of the Native.NbtDataType constants

    Returns boolean

    true if specified key exists in compound tag and its value is of specified type

getAllKeys

  • getAllKeys(): Array<string>
  • Returns Array<string>

    Java-array containing all the keys of the compound tag

getByte

  • getByte(key: string): number

getCompoundTag

getCompoundTagNoClone

  • Parameters

    • key: string

    Returns CompoundTag

    directly editable NBT tag of byte type by its key. Don't save reference for future usage since they get destroyed when the parent object is destroyed

getDouble

  • getDouble(key: string): number
  • Parameters

    • key: string

    Returns number

    NBT tag of double type by its key

getFloat

  • getFloat(key: string): number
  • Parameters

    • key: string

    Returns number

    NBT tag of float type by its key

getInt

  • getInt(key: string): number
  • Parameters

    • key: string

    Returns number

    NBT tag of 32-bit integer type by its key

getInt64

  • getInt64(key: string): number
  • Parameters

    • key: string

    Returns number

    NBT tag of 64-bit integer type by its key

getListTag

  • Parameters

    • key: string

    Returns ListTag

    NBT tag of list type by its key. Note that a copy of existing list tag is created so you cannot edit it directly. Use setCompoundTag method to apply changes or use CompoundTag.getListTagNoClone to edit it directly

getListTagNoClone

  • getListTagNoClone(key: string): ListTag
  • Parameters

    • key: string

    Returns ListTag

    directly editable NBT tag of byte type by its key. Don't save reference for future usage since they get destroyed when the parent object is destroyed

getShort

  • getShort(key: string): number
  • Parameters

    • key: string

    Returns number

    NBT tag of short type by its key

getString

  • getString(key: string): string
  • Parameters

    • key: string

    Returns string

    NBT tag of string type by its key

getValueType

  • getValueType(key: string): number

putByte

  • putByte(key: string, value: number): void
  • Puts value of byte type into compound tag

    Parameters

    • key: string
    • value: number

    Returns void

putCompoundTag

  • putCompoundTag(key: string, value: CompoundTag): void

putDouble

  • putDouble(key: string, value: number): void
  • Puts value of double type into compound tag

    Parameters

    • key: string
    • value: number

    Returns void

putFloat

  • putFloat(key: string, value: number): void
  • Puts value of float type into compound tag

    Parameters

    • key: string
    • value: number

    Returns void

putInt

  • putInt(key: string, value: number): void
  • Puts value of 32-bit integer type into compound tag

    Parameters

    • key: string
    • value: number

    Returns void

putInt64

  • putInt64(key: string, value: number): void
  • Puts value of 64-bit integer type into compound tag

    Parameters

    • key: string
    • value: number

    Returns void

putListTag

  • putListTag(key: string, value: ListTag): void

putShort

  • putShort(key: string, value: number): void
  • Puts value of short type into compound tag

    Parameters

    • key: string
    • value: number

    Returns void

putString

  • putString(key: string, value: string): void
  • Puts value of string type into compound tag

    Parameters

    • key: string
    • value: string

    Returns void

remove

  • remove(key: string): void

toScriptable

  • toScriptable(): {}
  • Converts compound tag to JavaScript object for easier reading

    Returns {}

    valid JavaScript representation of compound tag

    • [key: string]: any

Generated using TypeDoc