Polytone Configs - MehVahdJukaar/polytone GitHub Wiki
Polytone Configs
Configuration Entries allow you to define adjustable options for Polytone using JSON files. These options can be numeric sliders or string selections, and they are stored in the config_entries folder of your resource pack, for instance in assets/[namespace]/polytone/config_entries/[config name].json.
To access the configs simply click the Paintbrush Button on the Resource Pack Screen bottom right corner.
Configs can be used in Scripting Expressions, Polytone Files Conditions and in Pack Overlays.
This feature is 1.21.11+ only for now.
Example Usage
Here is a quick example of how to use a config in pack.mcmeta.
See the Tweaks section for more info.
{
"pack": {
"description": "some pack",
},
"overlays": {
"entries": [
{
"polytone_condition": {
"require_config": "my_pack:my_config"
},
"directory": "overlay_dir",
"formats": [34, 34]
}
]
}
}
JSON Structure
Configuration entries have two primary formats: NumberConfig and StringConfig.
Number Config
| attribute name | explanation |
|---|---|
value_translation |
Optional translation key for the UI label |
default_value |
Default numeric value |
presets |
Optional set of string to number values representing the value presets |
min |
Optional minimum value (default 0) |
max |
Optional maximum value (default 1) |
step |
Optional increment step for sliders (default 0.1) |
String Config
| attribute name | explanation |
|---|---|
value_translation |
Optional translation key for the UI label |
presets |
Optional set of string to string values representing the value presets |
default_value |
Default string value |
allowed_values |
List of allowed string options. i.e: ["big", "medium", "small"] |
Boolean Config
| attribute name | explanation |
|---|---|
value_translation |
Optional translation key for the UI label |
presets |
Optional set of string to string values representing the value presets |
default_value |
Default booelan value |
Example:
{
"default_value": 0.5,
"min": 0.0,
"max": 1.0,
"step": 0.05,
"presets": {
"performance": 0,
"pretty": 0.9
}
}
Translation Keys
To have proper translation working you'll need to add the following lines to your language file
config.[your_namespace].[your_config_name]for the config titleconfig.[your_namespace].[your_config_name].tooltipfor the config tooltip- additionally whatever key you have added in in
value_translation. This translation can for instance contain something like%s blocksas an example.
General Usage
To use these configs inside your Scripting Expressions, simply use the config(id) global function. This can be used as such
{
"some_exp_value": "5 + config('my_namespace:my_config')"
}
Additionally you can also use these configs DIRECTLY inside the pack overlay system polytone_condition extensions explained on the Tweaks page or as shown on the example here uptop.