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

ItemModel

Namespace used to change item models in player's hand and/or inventory. By default, if the block has an ICRender, it is automatically applied as item's model.

@since

2.0.2b20

Index

Interfaces

IconRebuildListener

  • IconRebuildListener(model: ItemModel, newIcon: Bitmap): void
  • Parameters

    Returns void

ModelOverrideFunction

Functions

getAllModels

  • getAllModels(): java.util.Collection<ItemModel>

  • Returns java.util.Collection<ItemModel>

    A collection of all existing item models.

getEmptyMeshFromPool


  • Returns RenderMesh

    Empty RenderMesh from the pool or creates an empty one. Used to reduce constructors/destructors calls.

getFor

  • Gets ItemModel object for the specified ID and data.


    Parameters

    • id: number

      item or block ID

    • data: number

      item or block data

    Returns ItemModel

    Exist ItemModel object used to manipulate item's model.

getForWithFallback

  • getForWithFallback(id: number, data: number): ItemModel
  • Gets ItemModel object for the specified ID and data. If no ItemModel for specified data exist, uses default data 0.


    Parameters

    • id: number
    • data: number

    Returns ItemModel

    Any ItemModel object used to manipulate item's model.

getItemMeshTextureFor

  • getItemMeshTextureFor(id: number, data: number): string

  • Parameters

    • id: number

      item or block numeric ID

    • data: number

      item or block data

    Returns string

    Texture name for the specified item or block.

getItemRenderMeshFor

  • getItemRenderMeshFor(id: number, count: number, data: number, randomize: boolean): RenderMesh

  • Parameters

    • id: number
    • count: number
    • data: number
    • randomize: boolean

      if true, item mesh position is randomized

    Returns RenderMesh

    New RenderMesh generated for specified item.

newStandalone

releaseMesh

  • Releases RenderMesh and returns it to the pool. Used to reduce constructors/destructors calls.


    Parameters

    Returns void

setCurrentCacheGroup

  • setCurrentCacheGroup(mod: string, version: string): void
  • Run it at start of your mod to create new group, it will be applied to all models, created at the root of your mod (including default mod).

    @remarks

    If specified version does not match cache version, whole group will be re-created.

    @since

    2.1.0b56


    Parameters

    • mod: string
    • version: string

    Returns void

tryReleaseModelBitmapsOnLowMemory

  • tryReleaseModelBitmapsOnLowMemory(bytes: number): void
  • Releases some of the bitmaps to free up memory by run garbage cleaner.


    Parameters

    • bytes: number

      bytes count to be released

    Returns void