WolfyScript / viewportl

A Minecraft Inventory GUI framework, designed to easily create reactive GUIs. Based on the well known Signal Reactivity System.
GNU General Public License v3.0
68 stars 12 forks source link

CustomItem Events & Actions #68

Closed WolfyScript closed 2 years ago

WolfyScript commented 2 years ago

CustomItems can be configured with Events and Actions now, that are called and executed accordingly.

The settings can be written straight into the json root of the CustomItem:

"actionSettings": {
    "events": [
      {
        "key": "<event_namespaced_key>",
        "<event_settings>": <value>,
        "actions": [
          {
            "key": "<action_namespaced_key>",
            "<action_settings>": <value>
          },
          ... more
        ]
      },
      ... more
    ]
  }

Each CustomItem can have multiple Events with multiple Actions.

Events added so far:

Actions added so far:

When applying actions to an event you need to make sure they are using the same or sub type. Usually the data type is visible in the key of the actions and events like player or location

Data structure:

From this structure you can see that you can use Actions with the DataLocation in Events using the DataPlayer or DataPlayerEvent. But not the other way around!