mixson

Event Handling

Unlike Mixins, Mixson events are only run when the given resource the event is targeting is being loaded. Examples of those times would be on world load, on /reload, and on F3+T. This means that events are not necessarily run in the order they are defined if they are for different resource locations.

For example, an event targeting the file models/item/crossbow will always run before an event targeting enchantment/multishot since the asset folder is loaded before the data folder when running a client and running a singleplayer world.


Resource Locators

When creating events, Resource Locators can be deployed to allow more precise resource targeting than what a string can provide. Resource Locators do not have a dedicated interface. Instead, they are simply implemented as an instance of the Function interface. The definition of the interface is implied to be as follows:

public interface Function<Identifier, Boolean> {
Boolean accept(Identifier id);
}

The accept method provides an Identifier which is the resource id that the event may or may not run.

Autogenerated Locators

When events are registered with a String instead of a Resource Locator, Mixson automatically converts the String to a locator. To invoke the converter manually, call the method MixsonUtil#getLocatorFromString, which returns a Resource Locator function.