CustomScale
Index
Constructors
constructor
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
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
Gets a maximum value that scale can reach, scale cannot get a value above maximum or below zero, default is
20
.Returns number
getPointer
Returns number
getScaleId
Returns unique named identifier used when registering scale.
Returns string
getTextureEmpty
Gets relative texture path to single part empty state for local player (0, empty part).
Returns string
getTextureFull
Gets relative texture path to single part filled state for local player (2, full part).
Returns string
getTextureHalf
Gets relative texture path to single part half state for local player (1, half part).
Returns string
hasDisplay
Whether scale display is enabled on local player's screen, enabled by default.
Returns boolean
hasLeft
Gets whether scale is inverted, minimum value will visually become maximum and maximum value will become minimum, disabled by default.
Returns boolean
hasResetAfterDeath
Whether scale is reset after player death, enabled by default.
Returns boolean
setDefaultValue
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
Enables or disables displaying scale on local player's screen, enabled by default.
Parameters
displayed: boolean
Returns void
setLeft
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
Sets a maximum value that scale can reach, scale cannot get a value above maximum or below zero, default is
20
.More about capabilitiesRemember to change CustomScale.setDefaultValue.
Parameters
value: number
Returns void
setResetAfterDeath
Enables or disables resetting scale after player death, enabled by default.
Parameters
reset: boolean
Returns void
setTextureEmpty
Sets relative texture path to single part empty state for local player (0, empty part).
Parameters
texture: string
Returns void
setTextureFull
Sets relative texture path to single part filled state for local player (2, full part).
Parameters
texture: string
Returns void
setTextureHalf
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
Interface for registering and customizing custom scales, including getting and modifying them from other mods. Vanilla scales cannot be obtained in this way.