Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace IDRegistry

Module used to manage item and block ids. Items and blocks have the same underlying nature, so their ids are interchangeable. Though, the blocks are defined "twice", as an item (in player's hand or inventory) and as a tile (a block placed in the world)

Index

Variables

BLOCK_ID_OFFSET: number

Defines the numeric id of the first user-defined block

ITEM_ID_OFFSET: number

Defines the numeric id of the first user-defined item

MAX_ID: number

Defines maximum item/block id

Functions

  • ensureBlockId(id: number): number
  • ensureItemId(id: number): number
  • Ensures given id is a block id, not a tile id. It is generally recommended to use Block.convertBlockToItemId since it performs less calculations

    Parameters

    • id: number

      block or tile id

    Returns number

    block id

  • genBlockID(name: string): number
  • Generates a new numeric block id

    Parameters

    • name: string

      string block id. Used in Block module functions and in some other block-related functions. Inner Core converts it to block_ as minecraft vanilla block id to avoid string id clashes

    Returns number

    numeric block id

  • genItemID(name: string): number
  • Generates a new numeric item id

    Parameters

    • name: string

      string item id. Used in Item module functions and in some other item-related functions. Inner Core converts it to item_ as minecraft vanilla item id to avoid string id clashes

    Returns number

    numeric item id

  • getIdInfo(id: number): string
  • Gets type of item ("block" or "item") and its string id in Minecraft

    Parameters

    • id: number

      numeric item or block id

    Returns string

    string in format "type:string_id" or "type:string_id#extra_information"

  • getNameByID(id: number): string
  • Gets item or block string id by its numeric id

    Parameters

    • id: number

      numeric item or block id

    Returns string

  • isVanilla(id: number): boolean
  • Parameters

    • id: number

      numeric item or block id

    Returns boolean

    true if item is vanilla Minecraft item, false otherwise

Generated using TypeDoc