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

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.

2.0.2b20

interface ItemModel {
    data: number;
    id: number;
    addToMesh(mesh: RenderMesh, x: number, y: number, z: number): void;
    getCacheKey(): string;
    getIconBitmap(): Bitmap;
    getIconBitmapNoReload(): Bitmap;
    getItemRenderMesh(count: number, randomize: boolean): RenderMesh;
    getMeshTextureName(): string;
    getModelForItemInstance(id: number, count: number, data: number, extra: ItemExtraData): ItemModel;
    getShaderUniforms(): ShaderUniformSet;
    getSpriteMesh(): RenderMesh;
    getUiGlintMaterialName(): string;
    getUiMaterialName(): string;
    getUiTextureName(): string;
    getWorldGlintMaterialName(): string;
    getWorldMaterialName(): string;
    getWorldTextureName(): string;
    isEmpty(): boolean;
    isEmptyInUi(): boolean;
    isEmptyInWorld(): boolean;
    isNonExistant(): boolean;
    isSpriteInUi(): boolean;
    isSpriteInWorld(): boolean;
    isUsingOverrideCallback(): boolean;
    newTexture(): Bitmap;
    occupy(): ItemModel;
    overridesHand(): boolean;
    overridesUi(): boolean;
    queueReload(listener?: IconRebuildListener): Bitmap;
    releaseIcon(): void;
    reloadIcon(): void;
    reloadIconIfDirty(): void;
    removeModUiSpriteTexture(): ItemModel;
    setCacheKey(key: string): void;
    setGlintMaterial(material: string): ItemModel;
    setHandGlintMaterial(material: string): ItemModel;
    setHandMaterial(texture: string): ItemModel;
    setHandModel(model: RenderMesh | BlockRenderer.Model | ICRender.Model, texture?: string, material?: string): ItemModel;
    setHandTexture(texture: string): ItemModel;
    setItemTexture(name: string, index: number): ItemModel;
    setItemTexturePath(path: string): ItemModel;
    setMaterial(texture: string): ItemModel;
    setModel(model: RenderMesh | BlockRenderer.Model | ICRender.Model, texture?: string, material?: string): ItemModel;
    setModelOverrideCallback(callback: ModelOverrideFunction): ItemModel;
    setModUiSpriteBitmap(bitmap: Bitmap): ItemModel;
    setModUiSpriteName(name: string, index: number): ItemModel;
    setModUiSpritePath(path: string): ItemModel;
    setSpriteHandRender(isSprite: boolean): ItemModel;
    setSpriteUiRender(isSprite: boolean): ItemModel;
    setTexture(texture: string): ItemModel;
    setUiGlintMaterial(material: string): ItemModel;
    setUiMaterial(texture: string): ItemModel;
    setUiModel(model: RenderMesh | BlockRenderer.Model | ICRender.Model, texture?: string, material?: string): ItemModel;
    setUiTexture(texture: string): ItemModel;
    updateForBlockVariant(variant: any): void;
}

Methods

  • Returns boolean

    true, if the model is empty.

  • Returns boolean

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

  • Returns boolean

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

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

    Parameters

    • texture: string

      material name to be used for the model

    Returns ItemModel

  • 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

  • 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

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

    Parameters

    • isSprite: boolean

    Returns ItemModel

    2.3.1b115

  • 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

  • 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

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

    Parameters

    • texture: string

      material name to be used for the model

    Returns ItemModel

  • 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

  • Parameters

    • variant: any

    Returns void

Properties

data: number

Item or block data current ItemModel relates to.

id: number

Item or block ID current ItemModel relates to.

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