User Tools

Site Tools


tutorial:hotswapping

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:hotswapping [2024/06/30 00:02] – removed - external edit (Unknown date) 127.0.0.1tutorial:hotswapping [2024/11/03 17:26] (current) – [Hotswapping Mixins] modmuss50
Line 1: Line 1:
 +~~REDIRECT>https://docs.fabricmc.net/develop/getting-started/launching-the-game#hotswapping-classes~~
  
 +====== Applying changes without restarting Minecraft ======
 +Restarting Minecraft can take a hefty amount of time. Thankfully, there are tools that allow you to apply some changes while the game is running, also called hotswapping.
 +
 +===== Reload changed classes =====
 +In Eclipse or IntelliJ IDEA, run Minecraft in debug mode. To apply changes in code, click the "Build" button in IntelliJ IDEA or save in Eclipse.
 +Note: this only allows you to change method bodies. If you do any other kind of change, you will have to restart.
 +However, if you use a special JDK, [[https://dcevm.github.io/|DCEVM]] (up to Java 11), you will be able to do most changes, including adding and removing methods and classes.
 +For Java 11+ use the [[https://github.com/JetBrains/JetBrainsRuntime|JetBrains Runtime]] and add ''-XX:+AllowEnhancedClassRedefinition'' as a VM option to your run configuration:
 +
 +{{https://i.imgur.com/SuW9MlV.png}}
 +
 +===== Reload resources =====
 +
 +==== Reload assets ====
 +After you make changes to assets such as textures and block/item models, you can rebuild the project and press ''F3 + T'' to apply changes without restarting Minecraft. More specifically, this is how to reload anything the mod provides as a resource pack.
 +
 +==== Reload data ====
 +You can apply any changes made in the ''data/'' directory such as recipes, loot tables and tags by rebuilding the project and then using the in-game command ''/reload''. More specifically, this reloads anything the mod provides as a data pack.
 +
 +===== Hotswapping Mixins =====
 +
 +You can also hotswap mixins by using Mixin Java agent. For how to achieve that, see [[https://docs.fabricmc.net/develop/getting-started/launching-the-game#hotswapping-mixins|Fabric Docs page]] and [[mixin_hotswaps]].