Options
All
  • Public
  • Public/Protected
  • All
Menu

Module used to define items and their properties

Index

Variables

iconOverrideFunctions: {}

All items icon override functions object for internal use

Type declaration

nameOverrideFunctions: {}

All items name override functions object for internal use

Type declaration

Functions

  • addCreativeGroup(name: string, displayedName: string, ids: number[]): void
  • 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

  • addRepairItemIds(id: string | number, items: number[]): 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

  • addToCreative(id: string | number, count: number, data: number, extra?: ItemExtraData): 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

    • Optional extra: 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

  • createFoodItem(nameID: string, name: string, texture: TextureData, params?: { food?: number; isTech?: boolean; stack?: number }): 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

    • Optional params: { food?: number; isTech?: boolean; stack?: number }

      additional item parameters

      • Optional food?: number

        amount of hunger restored by this food. Default value is 1

      • Optional isTech?: boolean

        if true, the item will not be added to creative. Default value is false

      • Optional stack?: number

        maximum item stack size. Default value is 64

    Returns NativeItem

  • createFuelItem(nameID: string, name: string, texture: TextureData, params: object): void
  • createItem(nameID: string, name: string, texture: TextureData, params?: { isTech?: boolean; stack?: number }): 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

    • Optional params: { isTech?: boolean; stack?: number }

      additional item parameters

      • Optional isTech?: boolean

        if true, the item will not be added to creative. Default value is false

      • Optional stack?: number

        maximum item stack size. Default value is 64

    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

    • params: any

      additional item parameters

    Returns NativeItem

  • describeItem(numericID: number, description: { category?: any }): void
  • Applies several properties via one method call

    deprecated

    Consider using appropriate setters instead

    Parameters

    • numericID: number

      numeric item id

    • description: { category?: any }
      • Optional category?: any

    Returns void

  • 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

  • getMaxDamage(id: number): number
  • Parameters

    • id: number

      numeric item id

    Returns number

    maximum damage value for the specified item

  • getMaxStack(id: number): number
  • Parameters

    • id: number

      numeric item id

    Returns number

    maximum stack size for the specified item

  • getName(id: number, data: number, encode?: any): string
  • Parameters

    • id: number

      numeric item id

    • data: number

      item data

    • Optional encode: any

      no longer supported, do not use this parameter

    Returns string

    current item name

  • getNumericId(id: string | number): number
  • Parameters

    • id: string | number

      string id of the item

    Returns number

    item numeric id by its string id or just returns its numeric id if input was a numeric id

  • 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 who clicked on the block

    Returns void

  • isNativeItem(id: number): boolean
  • Parameters

    • id: number

      numeric item id

    Returns boolean

    true if given item is vanilla item, false otherwise

  • isValid(id: number, data?: number): boolean
  • Parameters

    • id: number

      numeric item id

    • Optional data: number

      no longer supported, do not use this parameter

    Returns boolean

    true, if an item with such id exists, false otherwise

  • 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 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: ItemUseLocalFunction

      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

  • setAllowedInOffhand(id: string | number, allowed: boolean): void
  • Allows item to be put in offhand slot

    Parameters

    • id: string | number

      string or numeric item id

    • allowed: boolean

    Returns void

  • setCategory(id: string | number, category: number): void
  • Sets item creative category

    Parameters

    • id: string | number

      string or numeric item id

    • category: number

      item category, should be one of the Native.ItemCategory values

    Returns void

  • setEnchantType(id: string | number, enchant: number, value: number): 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 Native.EnchantType

    • 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

  • setGlint(id: string | number, enabled: boolean): void
  • 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

  • setLiquidClip(id: string | number, enabled: boolean): 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

  • setMaxDamage(id: string | number, maxdamage: number): 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

  • setMaxUseDuration(id: string | number, duration: number): 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

  • setProperties(id: string | number, props: string): 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

  • setPrototype(nameID: any, Prototype: any): void
  • deprecated

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

    Parameters

    • nameID: any
    • Prototype: any

    Returns void

  • setStackedByData(id: string | number, enabled: boolean): void
  • deprecated

    No longer supported

    Parameters

    • id: string | number
    • enabled: boolean

    Returns void

  • setToolRender(id: string | number, enabled: boolean): void
  • 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

  • setUseAnimation(id: string | number, animType: number): void
  • Sets animation type for the item

    Parameters

    • id: string | number

      string or numeric item id

    • animType: number

      use animation type, one of the Native.ItemAnimation values

    Returns void

Generated using TypeDoc