by Jaffe2718
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 compiledide-debug-tool
so you don't need to install it manually.
- Install Minecraft with
Fabric/Quilt Loader
and or for your Minecraft version. - Download the mod from or .
- Put the mod into your
mods
folder.
- The tool is a
jar
file, you can just download it from and you can use it without any installation steps. - For more information, please see .
- Download the tool from or , choose the version suitable for the mod.
- 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.
Note: The Author's most recommended way to use this mod is to use the plugin.
- 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 or IDEA Plugin or other tools you write by yourself.
-
Setup a new datapack project in IDEA.
-
At the welcome page of IDEA, click
New Project
; -
Choose
Minecraft Datapack
; -
Fill in the metadata of the datapack project;
-
Click
Create
, and the project will be automatically created with the default structure, and it will createdata/<namespace>/functions/demo.mcfunction
as example.
-
-
Import an existing datapack as a project.
- At the welcome page of IDEA, click
New Project
; - Choose
Import Minecraft Datapack
; - Choose the datapack you want to import and fill 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 apack.mcmeta
file;
3. The zip file must contain adata
folder.
If the datapack is invalid, the plugin will prevent you from importing it.- Click
Create
, and the datapack will be automatically imported as a project.
- At the welcome page of IDEA, click
-
Open or create a project;
-
Open or create a Minecraft function file;
-
Start the Minecraft game with the mod installed, and open the world you want to debug;
-
Start edit the
*.mcfunction
file, connect to the socket servers and start debug; -
Now you can start edit the
*.mcfunction
file and get code completion and code execution service. -
You can click
Execute Without Log
to execute the command without logging the result to the console. -
You can click
Execute
to 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.
- Click
File
->Settings
->Editor
->Color Scheme
->Minecraft Function
to customize the syntax highlighting.
-
Launch the Minecraft game with the mod installed, and open the world you want to debug;
-
Click
Tools
->Minecraft Command DecKit
->Minecraft Command Console
and fill the host and port of the command execution socket server. -
You can write your commands line by line press
Enter
to execute the command.
-
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. -
Click
Tools
->Minecraft Command DecKit
->Generate Minecraft Datapack
from the main menu bar:
-
-
Click
Generate
to start the task, and the datapack will be generated in thebuild
folder of the project named<project_name>.zip
.Tips:
Generate and Import/Link Datapact to Minecraft
are similar toGenerate Minecraft Datapack
, but they require the user to fill in the host and port of theDatapack Management Service
socket server. ForImport
, the generated datapack will be copied to the current world's datapack folder, and forLink
, the generated datapack will be linked to the current world's datapack folder and expired when the world is closed.
-
There are two ways to start the task to manage the datapack:
-
Click
Tools
->Minecraft Command DecKit
->Datapack Management
from the main menu bar: -
Right click the project view and click
Minecraft Command DevKit
->Datapack Managment
in the context menu.
-
-
Input the host and port of
Datapack Management Service
socket server shown in the Minecraft game. -
Do your operations.
- Right-click the item in
Datapacks
->Status
->Enabled
and clickDisable
to disable the datapack. - Right-click the item in
Datapacks
->Status
->Available
and clickEnable
to enable the datapack. - Right-click
Datapacks
->Type
->Common
and clickImport...
to import a datapack. - Right-click
Datapacks
->Type
->Common
and clickLink...
to link a datapack.
Tips:
This feature is with the requirement3.x
version of the mod.
Only the world is opened, theDatapack 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.
- Right-click the item in
- You can also use the IDE Debug Tool to connect to the socket server and execute the code.
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.
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.
-
For
3.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.
For more information, please visit .
This project is licensed under the MIT License.
You can use this project for any purpose for free.
See the file for details.
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.