User Tools

Site Tools


Sidebar

← Go back to the homepage

Fabric Tutorials

Setup

Basics

These pages are essential must-reads when modding with Fabric, and modding Minecraft in general, if you are new to modding, it is recommended you read the following.

Items

Blocks and Block Entities

Data Generation

World Generation

Commands

These pages will guide you through Mojang's Brigadier library which allows you to create commands with complex arguments and actions.

Events

These pages will guide you through using the many events included in Fabric API, and how to create your own events for you or other mods to use.

Entities

Fluids

Mixins & ASM

These pages will guide you through the usage of SpongePowered's Mixin library, which is a highly complex topic. We recommend you read these pages thoroughly.

Miscellaneous

Yarn

Contribute to Fabric

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:

Run your game in debug mode. You can now reload mixins using the same rules as normal:

  • no adding or removing methods
  • no changing method parameters
  • no adding or removing fields

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: 2022/05/05 18:26 (external edit)