Namespace Item

Module used to define items and their properties.

Functions

  • Creates group of creative items.

    Parameters

    • name: string

      name of group

    • displayedName: string

      name of group in game

    • ids: number[]

      array of items in group

    Returns void

  • Specifies what items can be used to repair this item in the anvil.

    Parameters

    • id: string | number

      string or numeric item ID

    • items: number[]

      array of numeric item IDs to be used as repair items

    Returns void

  • Adds item to creative inventory.

    Parameters

    • id: string | number

      string or numeric item ID

    • count: number

      amount of the item to be added, generally should be 1

    • data: number

      item data

    • Optionalextra: ItemExtraData

    Returns void

  • Creates armor item using specified parameters.

    Parameters

    • nameID: string

      string ID of the item; you should register it via IDRegistry.genItemID call first

    • name: string

      item name in English; add translations to the name using Translation module, all translation to the item and block names are applied automatically

    • texture: TextureData

      texture data used to create item

    • params: ArmorParams

      general armor item parameters object, the armor type there is required

    Returns NativeItem

  • Creates eatable item using specified parameters.

    Parameters

    • nameID: string

      string ID of the item. You should register it via IDRegistry.genItemID call first

    • name: string

      item name in English; add translations to the name using Translation module, all translation to the item and block names are applied automatically

    • texture: TextureData

      texture data used to create item

    • Optionalparams: FoodParams

      additional item parameters

    Returns NativeItem

  • Creates new item using specified parameters.

    Parameters

    • nameID: string

      string ID of the item; you should register it via IDRegistry.genItemID call first

    • name: string

      item name in English; add translations to the name using Translation module, all translation to the item and block names are applied automatically

    • texture: TextureData

      texture data used to create item

    • Optionalparams: ItemParams

      additional item parameters

    Returns NativeItem

  • Creates throwable item using specified parameters.

    Parameters

    • nameID: string

      string ID of the item; you should register it via IDRegistry.genItemID call first

    • name: string

      item name in English; add translations to the name using Translation module, all translation to the item and block names are applied automatically

    • texture: TextureData

      texture data used to create item

    • Optionalparams: ItemParams

      additional item parameters

    Returns NativeItem

  • Applies several properties via one method call.

    Parameters

    • numericID: number

      numeric item ID

    • description: object

    Returns void

    Consider using appropriate setters instead.

  • Natural armor points, that also is displayed above hotbar.

    Parameters

    • id: number

      numeric item ID

    Returns number

    Natural armor half points.

    2.4.0b119

  • Gets NativeItem instance that can be used to apply some properties to the item.

    Parameters

    • id: string

      string ID of the item

    Returns NativeItem

    NativeItem instance associated with this item.

  • Parameters

    • id: number

      numeric item ID

    Returns number

    Maximum damage value for the specified item.

  • Parameters

    • id: number

      numeric item ID

    Returns number

    Maximum stack size for the specified item.

    Use same function with data parameter.

  • Parameters

    • id: number

      numeric item ID

    • data: number

    Returns number

    Maximum stack size for the specified item.

    2.2.0b1 pre-alpha

  • Parameters

    • id: number

      numeric item ID

    • data: number

      item data

    Returns string

    Current item name.

  • Parameters

    • id: number

      numeric item ID

    • data: number

      item data

    • encode: any

      no longer supported, do not use this parameter

    Returns string

    Current item name.

    Use same method without last parameter.

  • Parameters

    • id: string | number

      string ID of the item

    Returns number

    Item numeric ID by it's string ID or just returns it's numeric ID if input was a numeric ID.

  • Internal

    Invoke click on the block in world without target.

    Parameters

    • item: ItemInstance

      item which used on the block

    • noModCallback: boolean

      if true, mod ItemUse callback will be not executed

    Returns void

  • Internal

    Invoke click on the block in world.

    Parameters

    • coords: ItemUseCoordinates

      coords of click on the block

    • item: ItemInstance

      item which used on the block

    • noModCallback: boolean

      if true, mod ItemUse callback will be not executed

    • entity: number

      player which clicked on the block

    Returns void

  • Parameters

    • id: number

      numeric item ID

    Returns boolean

    true if given item is vanilla item, false otherwise.

  • Parameters

    • id: number

      numeric item ID

    Returns boolean

    true, if an item with such ID exists, false otherwise.

    2.2.1b94 (not worked before)

  • Parameters

    • id: number

      numeric item ID

    • data: number

      no longer supported, do not use this parameter

    Returns boolean

    true, if an item with such ID exists, false otherwise.

    Use same method without last parameter.

  • Registers function to be called when item is dispensed from dispenser.

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • func: ItemDispensedFunction

      function that is called when such an event occurs

    Returns void

  • Registers item ID as requiring item icon override and registers function to perform such an override.

    Parameters

    Returns void

  • Registers function to perform item name override.

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • func: ItemNameOverrideFunction

      function that is called to override item name. Should return string to be used as new item name

    Returns void

  • Registers function to be called when player uses item in the air (not on the block).

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • func: ItemUseNoTargetFunction

      function that is called when such an event occurs

    Returns void

  • Registers function that is called when throwable item with specified ID hits block or entity.

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • useFunc: ProjectileHitFunction

      function that is called when such an event occurs

    Returns void

  • Registers function that is called when user touches some block in the world with specified item.

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • useFunc: ItemUseFunction

      function that is called when such an event occurs

    Returns void

  • Registers function to be called when player completes using item that has maximum use time set with Item.setMaxUseDuration function.

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • func: ItemUsingCompleteFunction

      function that is called when such an event occurs

    Returns void

  • Registers function to be called when player doesn't complete using item that has maximum use time set with Item.setMaxUseDuration function. Vanilla bow uses this function with max use duration of 72000 ticks.

    Parameters

    • nameID: string | number

      string or numeric ID of the item

    • func: ItemUsingReleasedFunction

      function that is called when such an event occurs

    Returns void

  • Allows item to be put in offhand slot.

    Parameters

    • id: string | number

      string or numeric item ID

    • allowed: boolean

    Returns void

    2.0.4b35

  • Parameters

    • damageable: boolean

    Returns void

  • Sets item creative category.

    Parameters

    • id: string | number

      string or numeric item ID

    • category: number

      item category, should be one of the EItemCategory values

    Returns void

  • Specifies how the item can be enchanted.

    Parameters

    • id: string | number

      string or numeric item ID

    • enchant: number

      enchant type defining when enchants can or cannot be applied to this item, one of the EEnchantType

    • value: number

      quality of the enchants that are applied, the higher this value is, the better enchants you get with the same level

    Returns void

  • Parameters

    • id: string | number
    • explodable: boolean

    Returns void

    2.4.0b119

  • Parameters

    • id: string | number
    • resistant: boolean

    Returns void

    2.4.0b119

  • Sets item as glint (like enchanted tools or golden apple).

    Parameters

    • id: string | number

      string or numeric item ID

    • enabled: boolean

      if true, the item will be displayed as glint item

    Returns void

  • Allows to click with item on liquid blocks.

    Parameters

    • id: string | number

      string or numeric item ID

    • enabled: boolean

      if true, liquid blocks can be selected on click

    Returns void

  • Sets item maximum data value.

    Parameters

    • id: string | number

      string or numeric item ID

    • maxdamage: number

      maximum data value for the item

    Returns void

  • Limits maximum use duration. This is useful to create such items as bows.

    Parameters

    • id: string | number

      string or numeric item ID

    • duration: number

      maximum use duration in ticks

    Returns void

  • Sets additional properties for the item, uses Minecraft mechanisms to set them. Full list of properties is currently unavailable.

    Parameters

    • id: string | number

      string or numeric item ID

    • props: string

      JSON string containing some of the properties

    Returns void

  • Parameters

    Returns void

    Should not be used in new mods, consider using Item properties setters instead.

  • Parameters

    • id: string | number
    • should: boolean

    Returns void

    2.4.0b119

  • Parameters

    • id: string | number
    • enabled: boolean

    Returns void

    No longer supported.

  • Specifies how the player should hold the item.

    Parameters

    • id: string | number

      string or numeric item ID

    • enabled: boolean

      if true, player holds the item as a tool, not as a simple item

    Returns void

  • Sets animation type for the item.

    Parameters

    • id: string | number

      string or numeric item ID

    • animType: number

      use animation type, one of the EItemAnimation values

    Returns void

Variables

iconOverrideFunctions: {
    [key: number]: ItemIconOverrideFunction;
}

All items icon override functions object.

nameOverrideFunctions: {
    [key: number]: ItemNameOverrideFunction;
}

All items name override functions object.

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.