All events in Mixson leverage the MixsonEvent
interface. The interface is defined as follows:
public interface MixsonEvent {void runEvent(EventContext context);default int ordinal() {return -1;}}
The interface is a FunctionalInterface
, meaning it can be represented with a lambda expression.
Ordinals
Not all resource types are susceptible to a broad event. For instance, tags (like #axes
) can have multiple files
declared for the same identifier. To fix this, events can declare an ordinal value.
The ordinal value specifies which resource from a list of resources under the same identifier gets the event applied to.
By default, the default ordinal value is -1
, which means that the event is run on all resources of the given identifier.
The order in which resources are placed in the list is determined by their priority in the resourcepack / datapack selector menu. For mods, this order is determined by when the mod is loaded.
Heads up!
Resources that do not support ordinals (like "data/loot_table
") will throw a MixsonError
if the ordinal is
changed from -1
.