-
Notifications
You must be signed in to change notification settings - Fork 1
Details
Events are created in the events.json file in config/AmbientEvents. Each event is a distinct key/value pair within a single JSON object. The key must be unique, due to the way JSON works, but it is only used for indication and error messages, so it should be named descriptively to help with debugging. The value of each event is another JSON object that stores the actual data.
The data object contains two key/value pairs, "conditions" and "actions". The value of both keys is a JSON array containing the condition or action JSON objects, detailed in other sections.
An example of a valid event.json file is given here:
{
"tooclosetothesun": {
"conditions": [
{"type": "playerpos", "dimension": "y", "comparison": ">", "value": 100}
],
"actions": [
{"type": "lightning", "target": "player", "chance": 20}
]
}
}
This file contains one event which creates a 1 in 20 chance of striking the player with lightning every second while the player's Y position is above 100.
All objects have a number of arguments that define how the object functions. Only one argument is common to all objects, and that is "type". The value of this must be a literal string that matches the name of a condition, action, or generic, depending on the location. If an unknown type is entered, then an error will be generated in the console, the event that contains the invalid type will not be created, and Minecraft will continue as usual. Types are specific to the object being represented. For example: a "type" of "playerpos" (a condition) will cause en error if given when the system is expecting an action or generic.