Перейти к основному содержанию

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

constBLOCK_ID_OFFSET

BLOCK_ID_OFFSET: number

Defines the numeric ID of the first user-defined block.

constITEM_ID_OFFSET

ITEM_ID_OFFSET: number

Defines the numeric ID of the first user-defined item.

constMAX_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_

      <name>
      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_

      <name>
      as minecraft vanilla item ID to avoid string ID clashes

    Returns number

    Numeric item ID.

getIdInfo

  • getIdInfo(id: number): string
  • Gets type of item ("block" or "item") and it's string ID in Minecraft.

    @deprecated

    Parameters

    • id: number

      numeric item or block ID

    Returns string

    String in format "type:string_id" or "type:string_id#extra_information".

getNameByID

  • getNameByID(id: number): string
  • Gets known modded item or block string ID by it's numeric ID.


    Parameters

    • id: number

      numeric item or block ID

    Returns string

getStringIdAndTypeForIntegerId

  • getStringIdAndTypeForIntegerId(id: number): string
  • Gets type of item ("block" or "item") and it's string ID in Minecraft.

    @since

    2.2.1b94


    Parameters

    • id: number

      numeric item or block ID

    Returns string

    String in format "type:string_id".

getStringIdAndTypeForItemId

  • getStringIdAndTypeForItemId(id: number): Nullable<string>
  • Gets unique identifier of item or block string ID by it's numeric ID. IDs represented in format type:identifier#extra, e.g. item:ruby_shovel or block:ancient_debris#negative,

    @since

    2.2.1b94


    Parameters

    • id: number

      numeric item or block ID

    Returns Nullable<string>

getStringIdForIntegerId

  • getStringIdForIntegerId(id: number): string
  • Gets item string ID in Minecraft.

    @since

    2.2.1b94


    Parameters

    • id: number

      numeric item or block ID

    Returns string

    Represent of named identifier.

getStringIdForItemId

  • getStringIdForItemId(id: number): Nullable<string>
  • Gets item or block string ID by it's numeric ID.

    @since

    2.2.1b94


    Parameters

    • id: number

      numeric item or block ID

    Returns Nullable<string>

getTypeForIntegerId

  • getTypeForIntegerId(id: number): string
  • Gets type of item ("block" or "item").

    @since

    2.2.1b94


    Parameters

    • id: number

      numeric item or block ID

    Returns string

    Represent of type.

getTypeForItemId

  • getTypeForItemId(id: number): Nullable<block | item>
  • Gets ID type by specific numeric ID.

    @since

    2.2.1b94


    Parameters

    • id: number

      numeric item or block ID

    Returns Nullable<block | item>

isVanilla

  • isVanilla(id: number): boolean
  • @since

    2.2.1b102


    Parameters

    • id: number

      numeric item or block ID

    Returns boolean

    true if item is vanilla Minecraft item, false otherwise.