Experience element
Display the stored xp or add buttons to store/take xp.
The experience gui element is used to display the amount of xp stored in the machine's experience component.
It can also be used as a button that will take/give xp from/to the player when pressed.
The behavior of the experience element depends of its mode
property (see below).
Experience elements are defined in json with "type": "custommachinery:experience"
.
Properties
The experience gui element has 4 mandatory properties and 7 optional properties :
Mandatory properties
"type": "custommachinery:experience" //Mandatory to define an experience gui element.
Mode
Name : mode
mode
Description :
The mode define the behavior of the element, valid values are :
"input_one" : The player who press the button will give 1 level of their xp to the machine.
"input_ten" : The player who press the button will give 10 levels of their xp to the machine.
"input_all" : The player who press the button will give all their xp to the machine.
"output_one" : The player who press the button will be given 1 level from the machine.
"output_ten" : The player who press the button will be given 10 levels from the machine.
"output_all" : The player who press the button will be given all the xp in the machine.
"display" : The element will only display a texture and, when hovered, will show the amount of xp stored in the machine.
"display_bar" : The element will show a bar representing the amount of xp stored in the machine.
Example :
When pressing this gui element the player will give one level of xp to the machine.
"mode": "input_one"
Optional properties
Priority
Name : priority
priority
Description :
An integer property that define the priority of the Element to be rendered.
Elements with higher priority will be rendered first. If 2 elements are at the same position the first to be rendered will be under and the last will be above.
Default : 0
Example :
The element will be rendered under each element that have a priority lower than 1000.
"priority": 1000
Texture
Name : texture
texture
Description :
The location of the texture that will be rendered into the GUI.
The location must be referenced by : namespace:path/file.png
The texture loader will search for textures in the assets/namespace
folder, the .png extension is required or the file will not be found.
The texture can be any size, if the texture size is different from the default size the width and height properties of the element will be automatically changed to fit the texture size if not provided.
If the width and/or height properties of the element are provided, the texture will be stretched to fit the dimensions of the element (it can render weirdly in that case).
Default :
"texture": "custommachinery:textures/gui/base_dump.png"
Example :
The file assets/textures/my_texture.png
will be used for the dump element.
"texture": "namespace:textures/my_texture.png"
Texture hovered
Name : texture_hovered
texture_hovered
Description :
The location of the texture that will be rendered into the GUI when the players mouse cursor is hovering the element.
The location must be referenced by : namespace:path/file.png
The texture loader will search for textures in the assets/namespace
folder, the .png extension is required or the file will not be found.
The texture can be any size, if the texture size is different from the default size the width and height properties of the element will be automatically changed to fit the texture size if not provided.
If the width and/or height properties of the element are provided, the texture will be stretched to fit the dimensions of the element (it can render weirdly in that case).
Default :
"texture_hovered": "custommachinery:textures/gui/base_dump_hovered.png"
Example :
The file assets/textures/my_texture.png
will be used.
"texture_hovered": "namespace:textures/my_texture.png"
Tooltips
Name : tooltips
tooltips
Description :
A list of Text components that will be shown as tooltips when the player mouse cursor hover the element.
Each tooltips of the list will be a new line.
Example :
Replace the default tooltips with a single line that say "Click me !" :
"tooltips": "Click me !"
Display
Name : display
display
Description :
Only used when the mode
property is set to display
or display_bar`
.
This define if the tooltips of this component should show the stored amount of xp as literal or level xp values.
Valid values are :
"literal" : Display the amount of xp points stored in the machine.
"level" : Display the equivalent amount of xp levels stored in the machine, rounded down.
"both" : Display both.
Default : level
level
The experience gui element's tooltip will display the stored xp as levels.
Example :
The experience gui element's tooltip will display the stored xp as xp points.
Example
A series of experience gui elements to make a machine similar to EnderIO's experience obelisk :
"gui": [
{
"x": 85,
"y": 35,
"width": 86,
"type": "custommachinery:experience",
"mode": "display_bar",
"display": "both"
},
{
"x": 80,
"y": 55,
"type": "custommachinery:experience",
"mode": "input_one"
},
{
"x": 95,
"y": 55,
"type": "custommachinery:experience",
"mode": "input_ten"
},
{
"x": 110,
"y": 55,
"type": "custommachinery:experience",
"mode": "input_all"
},
{
"x": 130,
"y": 55,
"type": "custommachinery:experience",
"mode": "output_one"
},
{
"x": 145,
"y": 55,
"type": "custommachinery:experience",
"mode": "output_ten"
},
{
"x": 160,
"y": 55,
"type": "custommachinery:experience",
"mode": "output_all"
}
]