|
|
Conditions can be used to modify HUD appearance based on logical checks against placeholders.
|
|
|
### Condition Formatting
|
|
|
```
|
|
|
conditions:
|
|
|
- <condition type>{<condition arguments>} <outcome> <action> <action variable>
|
|
|
```
|
|
|
#### Condition Type
|
|
|
This is the type of check you are making
|
|
|
|
|
|
| **Type** | **Description** |
|
|
|
| --------------- | ------------------------------------------ |
|
|
|
| [Effect](Conditions/Effect) | Check potion effects active on the user. |
|
|
|
| [gamemode](Conditions/Gamemode) | Check the user's gamemode. |
|
|
|
| [placeholder](Conditions/Placeholder) | Compare placeholders and inputs logically. |
|
|
|
| [progress](Conditions/Progress) | Compare the value output of a listener. |
|
|
|
#### Condition Arguments
|
|
|
Configuration for what the condition is calculating, such as what [Potion Effect](Conditions/Effect) to be checking for.
|
|
|
#### Outcome
|
|
|
This is the condition outcome required for actions to take place. This defaults to `true`.\
|
|
|
`false` may be used to run actions on a false condition outcome.
|
|
|
#### Action
|
|
|
This is what the Condition's Outcome will effect:
|
|
|
|
|
|
| Action | Description | Variable | Example |
|
|
|
| ------- | --------------------------------------------------------------------------- | ------------ | ------------------------------ |
|
|
|
| Hide | If the condition is resolves to false, the hud will be hidden. | N/A | N/A |
|
|
|
| Color | If the condition resolves to true, the hud will be recolored. Supports HEX. | Color | `green` or `#55ff55` |
|
|
|
| Texture | If the condition resolves to true, the hud will be retextured. | Texture Path | `assets/sword/fill_health.png` |
|
|
|
|
|
|
#### Example Conditions
|
|
|
This condition will turn the HUD asset's to the color green if the user has the "luck" effect.
|
|
|
|
|
|
```yaml
|
|
|
conditions: #Hide if the fill layer is empty.
|
|
|
- progress{l=fill;o=>;v=0} true hide
|
|
|
#Color the hud green if the user has the luck effect.
|
|
|
- effect{e=luck} true color green
|
|
|
```
|
|
|
|
|
|
The `default-layout` uses conditions to hide the oxygen bar until its value is in use:
|
|
|
```yaml
|
|
|
vanilla-air:
|
|
|
conditions: #Hide if the fill layer is empty.
|
|
|
- progress{l=fill;o=<;v=100%} true hide
|
|
|
layers:
|
|
|
icon:
|
|
|
texture:
|
|
|
path: assets/vanilla/air.png
|
|
|
offset:
|
|
|
x: -5
|
|
|
y: 2
|
|
|
fill:
|
|
|
texture:
|
|
|
path: assets/vanilla/exp_bar_short_fill.png
|
|
|
color: "#525aff"
|
|
|
offset:
|
|
|
x: 0
|
|
|
y: 0
|
|
|
function:
|
|
|
listener: air
|
|
|
increment: 13
|
|
|
orientation: horizontal
|
|
|
outline:
|
|
|
texture:
|
|
|
path: assets/vanilla/exp_bar_short_outline.png
|
|
|
``` |
|
|
\ No newline at end of file |