Sniffer is a debug adapter for Minecraft datapacks that allows you to debug your .mcfunction
files directly from Visual Studio Code. It provides features like breakpoints, step execution, and variable inspection to make datapack development easier and more efficient.
- Set breakpoints in
.mcfunction
files - Connect to a running Minecraft instance
- Inspect game state during debugging
- Step through command execution
- Path mapping between Minecraft and local files
- Minecraft with Fabric Loader
- Visual Studio Code
The mod can be configured through the in-game configuration screen, accessible via Mod Menu.
You can also configure the mod in the config/sniffer.json
file.
The following options are available:
- Server Port: The port number for the debug server (default: 25599)
- Server path: The path to the debug server (default:
/dap
)
- Open your datapack project in VSCode
- Create a
.vscode/launch.json
file with the following configuration:
{
"version": "0.2.0",
"configurations": [
{
"type": "sniffer",
"request": "attach",
"name": "Connect to Minecraft",
"address": "ws://localhost:25599/dap"
}
]
}
- Start Minecraft with the Sniffer mod installed
- In VSCode, press F5 or click the "Run and Debug" button
- Select "Connect to Minecraft" from the dropdown menu
You can now place breakpoints in your .mcfunction
files and execute it from the game to step through the code.
The debugger can be controlled directly from Minecraft using the following commands:
/breakpoint continue
: Resume execution after hitting a breakpoint/breakpoint step
: Execute the next command and pause/breakpoint step_over
: Skip to the next command in the current function/breakpoint step_out
: Continue execution until the current function returns
All commands require operator permissions (level 2) to use.
When execution is paused at a breakpoint, the gametick will be freezed.
src/main
: Main mod code for Minecraftsrc/client
: Client-side mod codevscode
: VSCode extension source code
To build the Minecraft mod:
./gradlew build
To build the VSCode extension:
cd vscode
npm install
npm run build
This project is licensed under the MPL-2.0 License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fabric - Mod loader for Minecraft
- VSCode Debug Adapter - VSCode debugging API
- Datapack Debugger by Alumopper - Original implementation of the debugger, without the DAP layer