MolangVariableMap Class
Contains a set of additional variable values for further defining how rendering and animations function.
Methods
constructor
new MolangVariableMap()
An constructor for creating a new MolangVariableMap object.
Returns MolangVariableMap
setColorRGB
setColorRGB(variableName: string, color: RGB): void
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]
Parameters
- variableName: string
- color: RGB
Warning
This function can throw errors.
setColorRGBA
setColorRGBA(variableName: string, color: RGBA): void
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]
Parameters
- variableName: string
- color: RGBA
Warning
This function can throw errors.
setFloat
setFloat(variableName: string, number: number): void
Sets a numeric (decimal) value within the Molang variable map.
Parameters
variableName: string
Name of the float-based number to set.
number: number
Value for the Molang-based variable to set.
Warning
This function can throw errors.
setSpeedAndDirection
setSpeedAndDirection(variableName: string, speed: number, direction: Vector3): void
Adds the following variables to Molang:
<variable_name>.speed
- Speed number provided<variable_name>.direction_x
- X value from the @minecraft/server.Vector3 provided<variable_name>.direction_y
- Y value from the @minecraft/server.Vector3 provided<variable_name>.direction_z
- Z value from the @minecraft/server.Vector3 provided
Parameters
- variableName: string
- speed: number
- direction: Vector3
Warning
This function can throw errors.
setVector3
setVector3(variableName: string, vector: Vector3): void
Adds the following variables to Molang:
<variable_name>.x
- X value from the @minecraft/server.Vector3 provided<variable_name>.y
- Y value from the @minecraft/server.Vector3 provided<variable_name>.z
- Z value from the @minecraft/server.Vector3 provided
Parameters
- variableName: string
- vector: Vector3
Warning
This function can throw errors.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for