Single States
When creating a new state, you can optionally set a type parameter. If this parameter isn’t set, the default value will be taken from default_state_type, which is set to standard in settings.json. Standard type is the correct choice in 90% of all applications. It is the best documented, and it contains very useful features like sub-states and set-lang.
However, in some cases, the standard state type can be annoying to use. The single state type was developed for use in non-NPC entities, such as for bossfights, game-managers, or any other application that doesn’t need sub-states, and doesn’t need easy dialogue options.
Creating single states
You can mix and match between standard states and single states. To create a single state, simple define "type": "single" in the state.
Formtat
Single states are significantly simpler than standard states. Single states do no allow sub-states, which means that each single state only contains information about a single state. This means that the “decorators”, such as commands, components, and transitions don’t need any set-lang complexity. Instead, simply create a list for each decorator type. The entirety of that list will be added/triggered on the state.
Format Example
{
"name": "single_example",
"type": "single", //Give the correct type
//Commands, transitions, etc etc are ALL lists
"commands": [
"/say This commands will run",
"/say So will this command",
"/say Everything in the `commands` list will be run",
"/say The list-elements don't match sub-states like in standard",
"/say Its literally just a list of commands to run"
],
"transitions": [
"also_a_list",
"all_transitions_are_applied"
],
"components": {
"minecraft:scale": {
"value": "example"
}
},
"custom_components": [
"all_custom_components_will_be_added",
"including this one"
]
}
Events first
Another big difference between single states and standard states is that in single states, the events run first. This means that when you ENTER a single state, the commands list will fire, then the components will be added. When you transition out of a single state, nothing happens.