How to use debugger

A debugger is a tool that allows mod developer to monitor the execution of the mod, stop it on breakpoints, check how many times something executed, see running threads, and more. MCreator provides a system to run the client in debug mode. To do this, you can use the toolbar debug icon (bug icon), or the menu bar "Build & run" -> "Debug client". From there, debugging can be done in two ways.

This tutorial explains how to debug Minecraft mods using MCreator's debugger capabilities

Procedure debugger

This functionality targets all users of MCreator that use procedures. It helps one to determine if, where, and how many times a certain procedure section is executed.

The process is the following:

  • Add a debug marker in the procedure setup (located in the Advanced procedure toolbox) and give it a name
  • Run client in debug mode
  • A panel will load and display detected procedure debug markers
  • When the procedure executes to the point where the debug marker is enabled, the counter in the debug marker will increase and flash red

Debugging custom Minecraft procedures using MCreator's procedure debugger with client and server side detection

There are separate counters for client/server/other executions, meaning one can check on what side the procedure is called and how many times using debug markers.

This makes it very easy to diagnose if a procedure is called, and on what side it is called and replaces the need to print into the console.

Debug markers also have minimal performance impact, meaning high-performance every-tick procedures can also be debugged and counted/monitored.

Double-clicking the marker counter in debug panel resets the counter, if one wants to start the count again.

A debugger in IDE sense

MCreator also adds a standard Java debugger that utilizes Java DBI to function. Debugger allows Minecraft mod developer to view threads of the JVM and their status, put breakpoints, view stack frames on a breakpoint hit, and step into/out/over when stepping execution in a breakpoint mode.

The thread list opens automatically on the bottom part of the workspace window when the debug session is initiated.

Breakpoints can be added in the code editor view and are preserved for the duration of the code editor view being open. MCreator will mark breakpoints with gray fill if they are not loaded, and with red fill if the breakpoint is armed and ready to be fired. Once the breakpoint is fired, MCreator will also indicate current breakpoint stack frames with their type and value indicated.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.