https://github.com/jaffe2718/command-debug-devkit
This project is written for debugging Minecraft command.
https://github.com/jaffe2718/command-debug-devkit
idea-plugin minecraft minecraft-mod
Last synced: about 1 year ago
JSON representation
This project is written for debugging Minecraft command.
- Host: GitHub
- URL: https://github.com/jaffe2718/command-debug-devkit
- Owner: Jaffe2718
- License: mit
- Created: 2023-08-12T14:00:49.000Z (almost 3 years ago)
- Default Branch: 4.x
- Last Pushed: 2025-03-23T10:50:35.000Z (over 1 year ago)
- Last Synced: 2025-04-14T02:06:27.142Z (about 1 year ago)
- Topics: idea-plugin, minecraft, minecraft-mod
- Language: Java
- Homepage: https://modrinth.com/mod/command-debug-service/
- Size: 14 MB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Command Debug DevKit





by Jaffe2718
## Introduction 📖
This project is written for debugging Minecraft commands. In this project, there are serveral subprojects:
- `fabric`: The mod for Fabric and Quilt, used to be a connection kit for IDE. It can create two socket server to provide code completion and code execution service.
- `ide-debug-tool`: This is a command line tool which can connect to the socket server opened by the mod. It can send code to the server and get the result. It can be a debug tool for IDE or a command line tool to execute *.mcfunction file directly.
- `idea-plugin`: This is a plugin for IntelliJ IDEA. It can connect to the socket server opened by the mod. It provides code completion and code execution service for IDE. The plugin contains a compiled `ide-debug-tool` so you don't need to install it manually.
## Setup 🛠️
### Mods




[](https://modrinth.com/mod/command-debug-service)
#### Fabric/Quilt Mod
1. Install Minecraft with`Fabric/Quilt Loader` and
[](https://modrinth.com/mod/fabric-api)
or [](https://modrinth.com/mod/qsl)for your Minecraft version.
2. Install dependencies for the mod, please check `fabric.mod.json` for the dependencies.
3. Download the mod from [](https://github.com/Jaffe2718/Command-Debug-DevKit/releases) or [](https://modrinth.com/mod/command-debug-service).
4. Put the mod into your `mods` folder.
### IDE Debug Tool
[](https://github.com/Jaffe2718/Command-Debug-DevKit/releases)
[](ide-debug-tool/README.md)
* The tool is a `jar` file, you can just download it from [](https://github.com/Jaffe2718/Command-Debug-DevKit/releases) and you can use it without any installation steps.
* For more information, please see [](ide-debug-tool/README.md).
### Idea Plugin



[](https://plugins.jetbrains.com/plugin/22587-minecraft-command-devkit)
1. Download the tool from [](https://github.com/Jaffe2718/Command-Debug-DevKit/releases) or [](https://plugins.jetbrains.com/plugin/22587-minecraft-command-devkit), choose the version suitable for the mod.
2. Install the plugin in your IDEA: click `File` -> `Settings` -> `Plugins` -> `⚙️` -> `Install Plugin from Disk...` -> choose the downloaded file, or install it directly from JetBrains Marketplace inside IDE.
## Usage 📖
> **Note**: The Author's most recommended way to use this mod is to use the plugin.
### Mod
* The mod creates 3 socket servers to provide code completion, code execution service and datapack management service.
* The mod should work with other tools like [IDE Debug Tool](#ide-debug-tool) or [IDEA Plugin](#idea-plugin) or [other tools](DEV.md) you write by yourself.
#### Security Configuration of Mod
##### Ports
- **Command Execution Socket Port**: The port for the command execution service socket binding. The default value is `0`, which means the service will be disabled. If you modify this value, it will be applied when the program restarts.
##### Show Socket Info
Boolean value, if true, the server socket info will be shown in the message field for the trusted clients.
##### Trust Mode
The client socket trust mode for the Command Debug Service.
- **ALL_ALLOWED**: All clients are allowed to connect.
- **WHITE_LIST**: Only clients recorded in the `Trusted IPv4 Addresses` are allowed to connect.
##### Trusted IPv4 Addresses
The white list for the Command Debug Service. Only clients recorded in this list are allowed to connect in `WHITE_LIST` mode, otherwise, all clients are trusted.
### IDEA Plugin
#### Create a New Datapack Project
1. Setup a new datapack project in IDEA.
1. At the welcome page of IDEA, click `New Project`;
2. Choose `Minecraft Datapack`;
3. Fill in the metadata of the datapack project;
fill in metadata
4. Click `Create`, and the project will be automatically created with the default structure, and it will create `data//functions/demo.mcfunction` as example.
The new datapack project
2. Import an existing datapack as a project.
1. At the welcome page of IDEA, click `New Project`;
2. Choose `Import Minecraft Datapack`;
3. Choose the datapack you want to import and fill the project name and extract path;
Choose the datapack you want to import
Filling the project name and extract path
> **Note**: The plugin will automatically check if the datapack is valid by these rules:
1. The datapack must be a zip file;
2. The zip file must contain a `pack.mcmeta` file;
3. The zip file must contain a `data` folder.
If the datapack is invalid, the plugin will prevent you from importing it.
The plugin will prevent you from importing an invalid datapack
4. Click `Create`, and the datapack will be automatically imported as a project.
The new project based on the imported datapack
#### Edit & Debug Minecraft Function
1. Open or create a project;
2. Open or create a Minecraft function file;
create a Minecraft function file
3. Start the Minecraft game with the [mod](#mods) installed, and open the world you want to debug;
4. Start edit the `*.mcfunction` file, connect to the socket servers and start debug;
Click the function buttons at the toolbar of the editor to get debug services
Connect to the code execution service
Connect to the completion service
5. Now you can start edit the `*.mcfunction` file and get code completion and code execution service.
Code completion
6. You can click `Execute Without Log` to execute the command without logging the result to the console.
Execute the command without logging
7. You can click `Execute` to execute the command and log the result to the console.
Execute the command and log the result to the console
> **Note**: Remember to configure the project JDK. Click `File` -> `Project Structure` to choose the JDK you want to use.
Congigure the project JDK
#### Custom Syntax Highlighting
* Click `File` -> `Settings` -> `Editor` -> `Color Scheme` -> `Minecraft Function` to customize the syntax highlighting.
Click File -> Settings -> Editor -> Color Scheme -> Minecraft Function to customize the syntax highlighting
#### Minecraft Command Console
1. Launch the Minecraft game with the [mod](#mods) installed, and open the world you want to debug;
2. Click `Tools` -> `Minecraft Command DecKit` -> `Minecraft Command Console` and fill the host and port of the command execution socket server.
Click Tools -> Minecraft Command DecKit -> Minecraft Command Console to open the console
Fill the host and port of the command execution socket server
3. You can write your commands line by line press `Enter` to execute the command.
Write your commands line by line press Enter to execute the command
#### Generate Minecraft Datapack
1. There are two ways to start the task to generate a datapack:
- Right click the project view and click `Minecraft Command DevKit` -> `Generate Minecraft Datapack` in the context menu.
Right click the project view and click Generate Minecraft Datapack in the context menu
- Click `Tools` -> `Minecraft Command DecKit` -> `Generate Minecraft Datapack` from the main menu bar:
Click Generate Minecraft Datapack from the main menu bar
2. Click `Generate` to start the task, and the datapack will be generated in the `build` folder of the project named `.zip`.
Click Generate to start the task
> Tips: `Generate and Import/Link Datapact to Minecraft` are similar to `Generate Minecraft Datapack`,
> but they require the user to fill in the host and port of the `Datapack Management Service` socket server.
> For `Import`, the generated datapack will be copied to the current world's datapack folder,
> and for `Link`, the generated datapack will be linked to the current world's datapack folder and expired when the world is closed.
#### Datapack Management
1. There are two ways to start the task to manage the datapack:
- Click `Tools` -> `Minecraft Command DecKit` -> `Datapack Management` from the main menu bar:
Click Manage Datapack from the main menu bar
- Right click the project view and click `Minecraft Command DevKit` -> `Datapack Managment` in the context menu.
Right click the project view and click Manage Datapack in the context menu
2. Input the host and port of `Datapack Management Service` socket server shown in the Minecraft game.
Input the host and port of Datapack Management Service socket server
3. Do your operations.
1. Right-click the item in `Datapacks` -> `Status` -> `Enabled` and click `Disable` to disable the datapack.
2. Right-click the item in `Datapacks` -> `Status` -> `Available` and click `Enable` to enable the datapack.
3. Right-click `Datapacks` -> `Type` -> `Common` and click `Import...` to import a datapack.
4. Right-click `Datapacks` -> `Type` -> `Common` and click `Link...` to link a datapack.
Datapack Management View
> Tips:
> This feature is with the requirement `3.x` version of the mod.
> Only the world is opened, the `Datapack Management Service` socket server will be valid.
> The linked datapack will be expired when the world is closed, and the imported datapack will be copied to the world's datapack folder.
> * For more info, please visit [DEV.md](DEV.md#concepts).
### Command Line Tool
* You can also use the [IDE Debug Tool](#ide-debug-tool) to connect to the socket server and execute the code.
Command Line Tool
## Warning ⚠️
When you use this mod, you should be careful.
Because it can execute any command.
Do not send the host and port to any untrusted program to avoid being attacked.
Do not install this mod on your multiplayer server to avoid being attacked by DDOS or other attacks.
## Development 🔧
### Overview
This is the document for developers.
We will introduce how to develop external tools to work with this mod.
Programing language is not limited, you can use any language you like,
the only thing you need to do is make your tool has the ability to connect to the socket server and interact with it.
### Concepts
- For `4.x` version, the mod will create 3 socket servers, for code completion, code execution and datapack management.
| Server | Type | Description | Accepted Message | Returned Message |
|:-------------------:|:-------------:|:---------------------------------------------:|:-----------------------------------------------------------------------------------------------------------:|:--------------------:|
| Code Completion | Socket Server | The server for code completion | single line command or unfinished command | multiple line result |
| Code Execution | Socket Server | The server for command execution in Minecraft | single line command | execution feedbacks |
| Datapack Management | Socket Server | The server for receive datapack from client | json string without `\n` like `{ "name": "[name].zip", "data": "[base64 encoded data]", "flag": "import" }` | None |
- Tips: the message sent is a single line of text, you should add `\n` at the end of the message or auto flush the buffer to send the message to the server.
### More Information
For more information, please visit [](DEV.md).
## License 📜
[](LICENSE)
This project is licensed under the MIT License.
You can use this project for any purpose for free.
See the [](LICENSE) file for details.
## Update and Cooperation 🤝
Currently, this project is still in development.
If you have any idea or suggestion,
please open an issue or pull request.
And the plugin is only for `IntelliJ Platform IDEs`,
if you want to use other IDEs such as `Eclipse` and `VS Code`,
you can create a plugin for it and pull request to this project.
What's more, the mod is only for `Fabric` and `Quilt` currently,
you can rewrite it for `Forge` or other mod loaders and pull request to this project.
I will be very grateful if you can help me to improve this project.