Skip to content

1.97.0: Macros

Pre-release
Pre-release

Choose a tag to compare

@FLDebug10 FLDebug10 released this 26 Sep 18:23
· 7 commits to NeoForge-1.21.1 since this release
1d2a40a

btw the jar has contents from latest github (version 1.97.0) but was compiled so it works with latest modrinth origins release

Doc

The Macros are defined as a power for the sake of convenience yet they aren't powers. They can be used in apoli:multiple and stuff but can never be granted or anything. They are read once and then removed internally.

The power (type is "apoli:macro")

This is where you define a Macro to use it later, Fields:

Field | Type | Description | Default
"parameters" | List of Strings | Parameters used by the macro (same as function basically) | All used ones
"value" | ANY Json | The json template to use for the macro | Required

Example:

"type": "apoli:macro",
  "parameters" : [
    "a"
  ],
  "value": {
    "type": "apoli:print",
    "text": "A macro with one parameter, [a]!"
  }

The usage (type also is "apoli:macro")

This is how to use the macros, instead of any object you can use a macro call, Fields:
Field | Type | Description | Default
"macro" | Identifier | The identifier of the macro 'power' | Required
"arguments" | Object that contains the arguments (see example) | The values to insert into the macro | Optional (Defaults to empty)

Example:

{
  "type": "apoli:action_over_time",
  "interval": 20,
  "entity_action": {
    "type": "apoli:macro",
    "macro": "test:macro",
    "arguments": {
      "a": "Greetings"
    }
  }
}

Notes

The macros can be used recursively (well not really): You can do A -> B -> C -> D and so on as long as you want, you can't loop tho: A -> B -> A is invalid!