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 interchangable. 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

Const BLOCK_ID_OFFSET

BLOCK_ID_OFFSET: number

Defines the numeric id of the first user-defined block

Const ITEM_ID_OFFSET

ITEM_ID_OFFSET: number

Defines the numeric id of the first user-defined item

Const MAX_ID

MAX_ID: number

Defines maximum item/block id

Functions

ensureBlockId

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

    Parameters

    • id: number

      block or tile id

    Returns number

    tile id

ensureItemId

  • 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

  • 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

  • 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

getNameByID

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

    Parameters

    • id: number

      numeric item or block id

    Returns string

Generated using TypeDoc