#minecraft #datapack #vanilla #minecraft-mod #mcfunction

bin+lib mcfunction-debug-adapter

A debugger for Minecraft's *.mcfunction files that does not require any Minecraft mods

2 stable releases

1.0.3 Feb 3, 2023
1.0.2 Jan 29, 2023

#5 in #vanilla

44 downloads per month

GPL-3.0-or-later

115KB
2.5K SLoC

McFunction-Debug-Adapter

The Debug Adapter Protocol implementation of McFunction-Debugger.

McFunction-Debug-Adapter only supports the single session mode with communication via stdin and stdout. To start executing an mcfunction file the development tool needs to send a launch request (the attach request is not supported).

Execution Context

The debugged function will be executed with a schedule command, so it runs without an @s entity at the world's origin position.

Launch Arguments

In order for the debug adapter to connect to Minecraft it needs a few arguments as part of the launch request:

program

Path to the mcfunction file to debug. The mcfunction file must be contained in a datapack with a pack.mcmeta file.

minecraftWorldDir

The directory containing the Minecraft world the debug adapter should connect to.

For single player this is typically a directory within the saves directory:

  • Windows: %appdata%\.minecraft\saves\
  • GNU/Linux: ~/.minecraft/saves/
  • Mac: ~/Library/Application Support/minecraft/saves/

For servers it is specified in server.properties.

minecraftLogFile

The path to Minecraft's log file.

For single player this is typically at these locations:

  • Windows: %appdata%\.minecraft\logs\latest.log
  • GNU/Linux: ~/.minecraft/logs/latest.log
  • Mac: ~/Library/Application Support/minecraft/logs/latest.log

For servers it is at logs/latest.log in the server directory.

Example

{
  "program": "C:/Users/Herobrine/my_datapack/data/my_namespace/functions/main.mcfunction",
  "minecraftWorldDir": "C:/Users/Herobrine/AppData/Roaming/.minecraft/saves/New World",
  "minecraftLogFile": "C:/Users/Herobrine/AppData/Roaming/.minecraft/logs/latest.log"
}

Command Line Interface

mcfunction-debug-adapter [FLAGS] [OPTIONS] --input <DATAPACK> --output <DATAPACK>

Flags

--help

Prints help information.

--version

Prints version information.

Options

--log-file

Path to a log file. If specified the debug adapter will create this file on startup and write log messages to it.

--log-level

The log level can also be configured via the environment variable LOG_LEVEL. Defaults to INFO.

Dependencies

~12–24MB
~378K SLoC