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

Texture

Class representing texture that can be animated.

@deprecated

Represents deprecated render type, should be performed in texture packs.

Index

Constructors

constructor

  • Creates new Texture object using specified file path.


    Parameters

    • path: string

    Returns Texture

Methods

getResolution

  • getResolution(): { h: number; w: number }

  • Returns { h: number; w: number }

    Texture resolution after recalculating it with pixel scale.

    • h: number
    • w: number

getTexture

  • getTexture(token: number): string

  • Parameters

    • token: number

    Returns string

    Current animation frame.

resetAnimation

  • resetAnimation(token: number): Texture
  • Resets animation.


    Parameters

    • token: number

    Returns Texture

    Reference to itself to be used in sequential calls.

setAnimation

  • setAnimation(animation: string[], delay: number): Texture
  • Makes texture animated.


    Parameters

    • animation: string[]

      array of paths to the animation frames. Each frame should be stored in a separate file

    • delay: number

      specifies each frame delay in ticks

    Returns Texture

    Reference to itself to be used in sequential calls.

setPixelScale

  • setPixelScale(scale: number): Texture
  • Sets pixel scale for the texture.


    Parameters

    • scale: number

    Returns Texture

setResolution

  • setResolution(w: number, h: number): Texture
  • Specifies texture resolution. If not equal to file dimensions, the image will be stretched to fit the resolution.


    Parameters

    • w: number
    • h: number

    Returns Texture

    Reference to itself to be used in sequential calls.

setTexture

  • Sets texture file path.


    Parameters

    • path: string

    Returns Texture

    Reference to itself to be used in sequential calls.