Options
All
  • Public
  • Public/Protected
  • All
Menu

Class IDMap<T>

A mapping from ID to T.

Internally, this is stored as a Map<(namespace) string, Map<(path)string, T>>

Type parameters

  • T

Hierarchy

  • IDMap

Index

Properties

Private data

data: Map<string, Map<string, T>> = new Map()

Accessors

size

  • get size(): number
  • Get the total number of ID=>T mappings in this map.

    Returns number

Methods

__@iterator

  • __@iterator(): IterableIterator<[ID, T]>
  • Iterate through the [ID, T] pairs of this map

    Returns IterableIterator<[ID, T]>

clear

  • clear(): void
  • Remove all data from this IDMap.

    Returns void

delete

  • delete(id: ID): boolean
  • Remove id from this map

    Parameters

    Returns boolean

    whether id was in the map

get

  • get(id: ID): T | undefined
  • Get the value of id from the map, if it exists.

    Parameters

    Returns T | undefined

has

  • has(id: ID): boolean
  • Test if the map has a value for id.

    Parameters

    Returns boolean

Private namespaceMap

  • namespaceMap(namespace?: string): Map<string, T> | undefined
  • Parameters

    • Default value namespace: string = ID.DEFAULT_NAMESPACE

    Returns Map<string, T> | undefined

Private namespaceMapOrDefault

  • namespaceMapOrDefault(namespace?: string): Map<string, T>
  • Parameters

    • Default value namespace: string = ID.DEFAULT_NAMESPACE

    Returns Map<string, T>

set

  • set(id: ID, value: T): this
  • Add a mapping from id=>value.

    This will use the default namespace if not specified, i.e IDMap::set(new ID("stone"), ...) and IDMap::set(new ID("minecraft:stone"), ...) are equivalent and indistinguishable.

    Parameters

    • id: ID
    • value: T

    Returns this

Generated using TypeDoc