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

ItemModel

Class representing item model in player's hand and/or inventory. To get an instance of this class from your code, use ItemModel.getFor static function.

@remarks

The coordinates of the full block in player's hand or inventory is (0, 0, 0), (1, 1, 1), so it is generally recommended to use the models that fit that bound at least for the inventory.

@since

2.0.2b20

Index

Properties

readonlydata

data: number

Item or block data current ItemModel relates to.

readonlyid

id: number

Item or block ID current ItemModel relates to.

Methods

addToMesh

  • addToMesh(mesh: RenderMesh, x: number, y: number, z: number): void
  • Parameters

    Returns void

getCacheKey

  • getCacheKey(): string
  • Returns string

getIconBitmap

  • getIconBitmap(): Bitmap
  • Returns Bitmap

getIconBitmapNoReload

  • getIconBitmapNoReload(): Bitmap
  • Returns Bitmap

getItemRenderMesh

  • getItemRenderMesh(count: number, randomize: boolean): RenderMesh
  • Parameters

    • count: number
    • randomize: boolean

    Returns RenderMesh

getMeshTextureName

  • getMeshTextureName(): string
  • Returns string

getModelForItemInstance

getShaderUniforms

getSpriteMesh

getUiGlintMaterialName

  • getUiGlintMaterialName(): string
  • Returns string

getUiMaterialName

  • getUiMaterialName(): string
  • Returns string

getUiTextureName

  • getUiTextureName(): string
  • Returns string

getWorldGlintMaterialName

  • getWorldGlintMaterialName(): string
  • Returns string

getWorldMaterialName

  • getWorldMaterialName(): string
  • Returns string

getWorldTextureName

  • getWorldTextureName(): string
  • Returns string

isEmpty

  • isEmpty(): boolean

  • Returns boolean

    true, if the model is empty.

isEmptyInUi

  • isEmptyInUi(): boolean
  • Returns boolean

isEmptyInWorld

  • isEmptyInWorld(): boolean
  • Returns boolean

isNonExistant

  • isNonExistant(): boolean
  • Returns boolean

isSpriteInUi

  • isSpriteInUi(): boolean
  • Returns boolean

isSpriteInWorld

  • isSpriteInWorld(): boolean
  • Returns boolean

isUsingOverrideCallback

  • isUsingOverrideCallback(): boolean
  • Returns boolean

newTexture

  • newTexture(): Bitmap
  • Returns Bitmap

occupy

overridesHand

  • overridesHand(): boolean

  • Returns boolean

    true, if this item model overrides the default model in player's hand.

overridesUi

  • overridesUi(): boolean

  • Returns boolean

    true, if this item model overrides the default model in player's inventory.

queueReload

releaseIcon

  • releaseIcon(): void
  • Returns void

reloadIcon

  • reloadIcon(): void
  • Returns void

reloadIconIfDirty

  • reloadIconIfDirty(): void
  • Returns void

removeModUiSpriteTexture

setCacheKey

  • setCacheKey(key: string): void
  • Parameters

    • key: string

    Returns void

setGlintMaterial

  • setGlintMaterial(material: string): ItemModel

setHandGlintMaterial

  • setHandGlintMaterial(material: string): ItemModel

setHandMaterial

  • Sets item model's material only in player's hand.


    Parameters

    • texture: string

      material name to be used for the model

    Returns ItemModel

setHandModel

setHandTexture

  • Sets item model's texture only in player's hand.


    Parameters

    • texture: string

      texture name to be used for the model (use "atlas::terrain" for block textures)

    Returns ItemModel

setItemTexture

  • setItemTexture(name: string, index: number): ItemModel
  • Parameters

    • name: string
    • index: number

    Returns ItemModel

setItemTexturePath

setMaterial

  • Sets item model's material in both player's inventory and in hand.


    Parameters

    • texture: string

      material name to be used for the model.

    Returns ItemModel

setModUiSpriteBitmap

  • setModUiSpriteBitmap(bitmap: Bitmap): ItemModel

setModUiSpriteName

  • setModUiSpriteName(name: string, index: number): ItemModel
  • Parameters

    • name: string
    • index: number

    Returns ItemModel

setModUiSpritePath

setModel

  • Sets item's model to display both in the inventory and in hand.


    Parameters

    Returns ItemModel

setModelOverrideCallback

setSpriteHandRender

  • setSpriteHandRender(isSprite: boolean): ItemModel
  • Determines whether an item being held in the hand should be displayed as a sprite, or if a model should be used instead, which can be particularly relevant for items such as blocks.

    @since

    2.3.1b115


    Parameters

    • isSprite: boolean

    Returns ItemModel

setSpriteUiRender

  • setSpriteUiRender(isSprite: boolean): ItemModel
  • Determines whether an item should be displayed as a sprite within inventory, or if a model should be used instead, which can be particularly relevant for items such as blocks.


    Parameters

    • isSprite: boolean

    Returns ItemModel

setTexture

  • Sets item model's texture in both player's inventory and in hand.


    Parameters

    • texture: string

      texture name to be used for the model (use "atlas::terrain" for block textures)

    Returns ItemModel

setUiGlintMaterial

  • setUiGlintMaterial(material: string): ItemModel

setUiMaterial

  • Sets item model's material only in player's inventory.


    Parameters

    • texture: string

      material name to be used for the model

    Returns ItemModel

setUiModel

setUiTexture

  • Sets item model's texture only in player's inventory.


    Parameters

    • texture: string

      texture name to be used for the model (use "atlas::terrain" for block textures)

    Returns ItemModel

updateForBlockVariant

  • updateForBlockVariant(variant: any): void
  • Parameters

    • variant: any

    Returns void