Skip to content

@minecraft/server


@minecraft/server / MolangVariableMap

Class: MolangVariableMap ​

Defined in: @minecraft/server/index.d.ts:16126

Contains a set of additional variable values for further defining how rendering and animations function.

Constructors ​

Constructor ​

new MolangVariableMap(): MolangVariableMap

Returns ​

MolangVariableMap

Methods ​

setColorRGB() ​

setColorRGB(variableName, color): void

Defined in: @minecraft/server/index.d.ts:16136

Parameters ​

variableName ​

string

color ​

RGB

Returns ​

void

Remarks ​

Adds the following variables to Molang:

  • <variable_name>.r - Red color value [0-1]
  • <variable_name>.g - Green color value [0-1]
  • <variable_name>.b - Blue color value [0-1]

Throws ​

This function can throw errors.


setColorRGBA() ​

setColorRGBA(variableName, color): void

Defined in: @minecraft/server/index.d.ts:16148

Parameters ​

variableName ​

string

color ​

RGBA

Returns ​

void

Remarks ​

Adds the following variables to Molang:

  • <variable_name>.r - Red color value [0-1]
  • <variable_name>.g - Green color value [0-1]
  • <variable_name>.b - Blue color value [0-1]
  • <variable_name>.a - Alpha (transparency) color value [0-1]

Throws ​

This function can throw errors.


setFloat() ​

setFloat(variableName, number): void

Defined in: @minecraft/server/index.d.ts:16160

Parameters ​

variableName ​

string

Name of the float-based number to set.

number ​

number

Value for the Molang-based variable to set.

Returns ​

void

Remarks ​

Sets a numeric (decimal) value within the Molang variable map.

Throws ​

This function can throw errors.


setSpeedAndDirection() ​

setSpeedAndDirection(variableName, speed, direction): void

Defined in: @minecraft/server/index.d.ts:16174

Parameters ​

variableName ​

string

speed ​

number

direction ​

Vector3

Returns ​

void

Remarks ​

Adds the following variables to Molang:

  • <variable_name>.speed - Speed number provided
  • <variable_name>.direction_x - X value from the Vector3 provided
  • <variable_name>.direction_y - Y value from the Vector3 provided
  • <variable_name>.direction_z - Z value from the Vector3 provided

Throws ​

This function can throw errors.


setVector3() ​

setVector3(variableName, vector): void

Defined in: @minecraft/server/index.d.ts:16187

Parameters ​

variableName ​

string

vector ​

Vector3

Returns ​

void

Remarks ​

Adds the following variables to Molang:

  • <variable_name>.x - X value from the Vector3 provided
  • <variable_name>.y - Y value from the Vector3 provided
  • <variable_name>.z - Z value from the Vector3 provided

Throws ​

This function can throw errors.