tutorial:mixin_hotswaps

Hotswapping Mixins

Mixins can't be hot-swapped in a default Fabric environment. To enable this functionality, you'll have to specify the -javaagent flag inside your VM options.

The only pre-requisite is having a copy of the sponge mixin jar. Fabric pulls this by default, so you should be able to locate it within your Gradle cache folder. IDEA users can look at the bottom of their project view on the left side of the screen to find the library:

Copy the full path to the jar and open up your run configurations. Under Minecraft Client, expand the VM options tab. You'll need to set the -javaagent flag to the path of the mixin jar.

Optionally, you can add the -XX:+AllowEnhancedClassRedefinition flag to enable parameters to be changed, and fields or methods to be added/removed:

You can do these things if you also add the -XX:+AllowEnhancedClassRedefinition VM option.

To recompile your mixin in IntelliJ, use the Recompile option in the Build menu. The default keybind for this is Ctrl+Shift+F9.

Notes

DCEVM does not officially support mixin swapping:

  • When run on Java 1.8:181, DCEVM and Mixin reloads do not work.
  • When run on DCEVM Java 11, you can reload, but the hot swap task freezes.
  • When run on JetBrains Runtime's Java 17 fork (with DCEVM), Mixin hotswapping and DCEVM work properly.
tutorial/mixin_hotswaps.txt · Last modified: 2025/04/11 13:23 by cph101