45 lines
1.5 KiB
Markdown
45 lines
1.5 KiB
Markdown
![]() |
# Conditional Resources
|
||
|
Conditional resoures are the simplest use case of respackopts.
|
||
|
To add one, you will need to create an rpo file for your resource.
|
||
|
It needs to be titled by appending `.rpo` to the files name.
|
||
|
For example: If you want `/assets/minecraft/lang/en_us.json` to be configurable, you will need to create `/assets/minecraft/lang/en_us.json.rpo`
|
||
|
If you only want a simple condition, you can use the following template:
|
||
|
```json
|
||
|
{
|
||
|
"conditions": [
|
||
|
"<your pack id>:<your entry>"
|
||
|
]
|
||
|
}
|
||
|
```
|
||
|
You can simply copy the id from your conf.json. The entry will be the name of the entry for things directly under `conf`,
|
||
|
otherwise it will be `category.entry`. For nested categories, names will follow the same schema.
|
||
|
If you have an enum entry ("Select from list"), it will be `category.entry.option`
|
||
|
## Logic
|
||
|
You may also use logic to determine whether conditions are met.
|
||
|
This might look like the following example:
|
||
|
```json
|
||
|
"conditions": [
|
||
|
"example:option1",
|
||
|
{
|
||
|
"or": [
|
||
|
"example:option2",
|
||
|
"example:option3",
|
||
|
{
|
||
|
"and": [
|
||
|
"example:option4",
|
||
|
"example:option5"
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
```
|
||
|
The follwing conditions are supported:
|
||
|
| Name | Function |
|
||
|
--|--
|
||
|
| and | True if all subconditions are met |
|
||
|
| or | True if at least one subcondition is met |
|
||
|
| xor | True if an uneven number of subconditions is met |
|
||
|
| nor | True if none od the subconditions are met |
|
||
|
| eq | True if all of the subconditions have the same result |
|