mixson

Debugging

When working with many events, it can become difficult to ensure everything is working as intended. To help, Mixson includes several resources for debugging.

There are three debug states for Mixson that are stored as the enum DebugMode inside of Mixson:

enum DebugMode {
OFF, // ordinal: 0
LOG, // 1
EXPORT // 2
}

To change the state of Mixson, use the following method from the Mixson class:

void setDebugMode(Mixson.DebugMode debugMode);

Note that the debug state is applied to all events, not just the events in the mod that Mixson was bundled with. How Mixson responds to a state is dependent on the ordinal of the state, not just the state itself. This means that states will inherit the effects of states with lower ordinal values.

OFF

This is the default state. No information is extra information is displayed.

LOG

This state sends extra information to the log. There will be two message types, registering and running. Registering messages are sent when an event is registered (how surprising). It will output the eventName and priority. Running messages are sent when an event finds its associated resource and attempts to run.

The message will output the eventName, and resourceId.

LOG Output Templates

Registering Message

Registering '[eventName]' with priority [priority]

Running Message

Running '[eventName]' on resource '[resourceId]'

EXPORT

This state will save a copy of a resource after each event associated with it runs. These copies are saved to the .mixson inside of the game directory. Inside this directory will be directories. These directories will be named the resource that at least one event was associated with. Inside these directories will be the individual snapshots of the resource file after the event in question applied the necessary modifications.

EXPORT Example

In this example, it will be assumed that there are two events associated with minecraft:models/item/iron_chestplate. Their event names will be test_event and other_test_event. The follow is a visual of the folder path:

- .mixson
\ minecraft~models-item-iron_chestplate
| test_event.json
\ other_test_event.json

Mixson Command

Another debugging tool is the Mixson command. The /Mixson is available on both the server and client. When run, it will dump a report that states what events ran, how many times, and on how many files into the log. The report will resemble as follows:

Event ID | Calls | File Operations
----------------------------------------------------------
change axe tag | 1 | 2
modify wooden pickaxe | 1 | 1
modify golden pickaxe | 1 | 1
----------------------------------------------------------

The Calls section refers to how many times the resource the event targets was discovered which lead to a triggering of the event. The File Operations section states how many cumulative files the event changed through each call.

This report does not clear on its own since there is no definite way of knowing when that should occur. Instead, the command /mixson clear can be used to clear the report. Without clearing the report, the call counts and operation counts will continue to add onto one another as reloads occur.