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

CustomScale

since: 3.1.0b125

Interface for registering and customizing custom scales, including getting and modifying them from other mods. Vanilla scales cannot be obtained in this way.

Index

Constructors

constructor

  • new CustomScale(id: string, fullTexture: string, halfTexture: string, emptyTexture: string): CustomScale
  • Registers a new scale according to given identifier (also quantifies as name) and textures for hotbar.


    Parameters

    • id: string

      unique identifier, should include project definition, such as insomnia.thirst

    • fullTexture: string

      relative texture path to single part filled state (2, full part)

    • halfTexture: string

      relative texture path to single part half state (1, half part)

    • emptyTexture: string

      relative texture path to single part empty state (0, empty part)

    Returns CustomScale

Methods

getDefaultValue

  • getDefaultValue(): number
  • Gets a default value that scale will get after first entry to world, or death if such options are enabled. Cannot be less than zero or greater than CustomScale.getMaxValue, default value is 20.


    Returns number

getMaxValue

  • getMaxValue(): number
  • Gets a maximum value that scale can reach, scale cannot get a value above maximum or below zero, default is 20.


    Returns number

getPointer

  • getPointer(): number
  • Returns number

getScaleId

  • getScaleId(): string
  • Returns unique named identifier used when registering scale.


    Returns string

getTextureEmpty

  • getTextureEmpty(): string
  • Gets relative texture path to single part empty state for local player (0, empty part).


    Returns string

getTextureFull

  • getTextureFull(): string
  • Gets relative texture path to single part filled state for local player (2, full part).


    Returns string

getTextureHalf

  • getTextureHalf(): string
  • Gets relative texture path to single part half state for local player (1, half part).


    Returns string

hasDisplay

  • hasDisplay(): boolean
  • Whether scale display is enabled on local player's screen, enabled by default.


    Returns boolean

hasLeft

  • hasLeft(): boolean
  • Gets whether scale is inverted, minimum value will visually become maximum and maximum value will become minimum, disabled by default.


    Returns boolean

hasResetAfterDeath

  • hasResetAfterDeath(): boolean
  • Whether scale is reset after player death, enabled by default.


    Returns boolean

setDefaultValue

  • setDefaultValue(value: number): void
  • Sets a default value that scale will get after first entry to world, or death if such options are enabled. Cannot be less than zero or greater than CustomScale.getMaxValue, default value is 20.


    Parameters

    • value: number

    Returns void

setDisplay

  • setDisplay(displayed: boolean): void
  • Enables or disables displaying scale on local player's screen, enabled by default.


    Parameters

    • displayed: boolean

    Returns void

setLeft

  • setLeft(inverse: boolean): void
  • If scale is inverted, minimum value will visually become maximum and maximum value will visually become minimum, disabled by default.


    Parameters

    • inverse: boolean

    Returns void

setMaxValue

  • setMaxValue(value: number): void
  • Sets a maximum value that scale can reach, scale cannot get a value above maximum or below zero, default is 20.

    More about capabilities

    Remember to change CustomScale.setDefaultValue.


    Parameters

    • value: number

    Returns void

setResetAfterDeath

  • setResetAfterDeath(reset: boolean): void
  • Enables or disables resetting scale after player death, enabled by default.


    Parameters

    • reset: boolean

    Returns void

setTextureEmpty

  • setTextureEmpty(texture: string): void
  • Sets relative texture path to single part empty state for local player (0, empty part).


    Parameters

    • texture: string

    Returns void

setTextureFull

  • setTextureFull(texture: string): void
  • Sets relative texture path to single part filled state for local player (2, full part).


    Parameters

    • texture: string

    Returns void

setTextureHalf

  • setTextureHalf(texture: string): void
  • Sets relative texture path to single part half state for local player (1, half part).


    Parameters

    • texture: string

    Returns void

staticgetAllScales

  • Returns all custom scales ever registered, vanilla in-game scales are not counted.


    Returns CustomScale[]

staticgetScaleByName

  • Returns scale by unique named identifier, or null if it does not exist, vanilla in-game scales is not counted.


    Parameters

    • id: string

    Returns CustomScale