Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
mcfunction-debugger
mcfunction-debugger is a debugger for Minecraft's *.mcfunction files that does not require any Minecraft mods.
Status
This project has reached a minimum-viable product level of quality. It offers a command line interface but does not integrate with an editor. We already started implementing the Debug Adapter Protocol to provide an extension for Visual Studio Code which will also include additional features like stepping through the code and showing current scoreboard values, but this will take some time.
Usage
You can debug any datapack with the following five steps:
- Add
# breakpoint
lines in your *.mcfunction files - Generate a debug datapack
- Load the debug datapack in Minecraft
- Start debugging any of your functions with:
/function debug:<your_namespace>/<your_function>
- When finished, uninstall the debug datapack with:
/function debug:uninstall
A more detailed description can be found here.
Installation
Using precompiled binaries
Precompiled binaries are available under releases.
We recommend saving the mcfunction-debugger
binary to Minecraft's saves
directory for ease of use.
On Windows this is located at %APPDATA%\.minecraft\saves
.
Installing from source
mcfunction-debugger is written in Rust so to build it from source you need to install Rust.
You can then install it from crates.io by running:
cargo install mcfunction-debugger
Or from GitHub by running:
cargo install --git https://github.com/vanilla-technologies/mcfunction-debugger.git
To uninstall run:
cargo uninstall mcfunction-debugger
Planned features
These features are planned, but not yet implemented:
- Support function tags #12
- Allow users to supply a
commands.json
file for newer or older versions of Minecraft #42 - Freezing the
gametime
while suspended #18 - Freezing the age of all entities while suspended (this is currently only done for area_effect_clouds) #24
- Support debugging multiple datapacks at once #9
- Support debugging
load.json
andtick.json
#8 - Support storing the
result
/success
of afunction
command withexecute store
#11 - Setting
randomTickSpeed
to 0 while suspended #14
Caveats
Unfortunately a program can always behave slightly differently when being debugged. Here are some problems you might encounter with mcfunction-debugger.
Operating on Dead Entities
In a Minecraft function you can kill an entity and then continue using it. For example, consider the following datapack:
example:sacrifice_pig
:
summon pig ~ ~ ~ {Tags: [sacrifice]}
execute as @e[type=pig,tag=sacrifice] run function example:perform_necromancy
example:perform_necromancy
:
say I am still alive
function example:kill_me
say I am dead inside
example:kill_me
:
kill @s
After the function example:kill_me
is executed the pig is dead, yet it speaks to us from the other side.
This cannot be handled by the debugger.
If you try to debug the function example:sacrifice_pig
it will crash:
[Pig] I am still alive
Selected entity was killed!
Start a new debugging session with '/function debug:<your_namespace>/<your_function>'
Executed 145 commands from function 'debug:example/sacrifice_pig'
Hitting the Maximum Command Chain Length
By default Minecraft only executes up to 65536 commands per tick. Since the debug datapack needs to run many commands in addition to the commands of your datapack, you might hit this limit when debugging a very large datapack. You can tell by looking at how many commands where executed from the function. When you see something like:
Executed 65536 commands from function 'debug:resume'
You should stop the debug session with /function debug:stop
and add more breakpoints to avoid running so many commands at once or increase the command limit with:
/gamerule maxCommandChainLength 2147483647
Chunkloading
If a chunk that contains an entity required for debugging is unloaded, while a function is suspended on a breakpoint, the debug session will crash, if you try to resume the execution.
This can for example happen if you go far away or if the function operates in a chunk that is only loaded temporarily (for instance by a teleport
command or by going through a portal).