dsh-mc-instances: Managing Minecraft Mod Test Instances in DSH

Introduction

When developing mods for Fabric / NeoForge, a common practice is to isolate game directories by instance: use gradlew runClient -Pinstance=<name> to point the save file to run/<name>/, giving each their own mods/, config/, saves/, and logs/. This workflow works, but instances often won’t appear in the IDE’s run configuration dropdown, and mods/ also needs to be copied manually; as the number of projects and instances increases, the cost of switching and troubleshooting rises significantly.

DeepSeek Harness (DSH) supports extending session capabilities and tooling via plugins. Below is an introduction to the community plugin dsh-mc-instances (maintainer xin070710), which provides a PCL2-style instance management panel in DSH. Operations such as listing, creating, starting/stopping, toggling mods, viewing logs, and generating IntelliJ run configurations can all be completed via panel clicks or chatting with the agent.

What is it

dsh-mc-instances is a DSH client plugin: after loading, an “MC instances” tab will appear on the right sidebar of the session; the “Minecraft instance manager” card on the welcome page and the MC instances button in the session header open the same panel. The plugin targets the scenario of “managing Minecraft mod testing instances within Harness” and relies on the existing instance isolation conventions of each project (run/<name>/ + Gradle -Pinstance); it does not replace your build scripts.

The license is MIT (see repository LICENSE). package.json specifies the runtime environment as Node >=20, DSH >=0.2.1, with peer dependencies including @deepseek-ai/cordis and @deepseek-ai/dsh-tools.

Core Features

The capabilities summarized in the README below can all be triggered via the panel or through Agent tools.

Panel and Scanning

  • Right sidebar PCL2-style instance cards: grouped by project, showing loader, MC version, JDK, mod count, and recent activity; supports search, loader filtering, and “Running” filtering.
  • Identifies the current session workspace; defaults to auto-hiding the entry when no nearby instances exist (can be forced open with Ctrl+Alt+M / macOS ⌘⌥M and disabled in gear settings).
  • Lists supported projects with instance isolation and their instances (including the default run/), displaying loader, version, JDK, mod count, last play time, etc.
  • Scanning has limits: 5000 directories or 3 seconds, to prevent hanging the panel by scanning from the drive root.

Start/Stop and Logs

  • Start gradlew runClient -Pinstance=… (or server) from the panel; displays PID and uptime; stops by ending the entire process tree; Gradle output is written to logs/launch-*.log under the project.
  • Two views for Game Log and Gradle Log, auto-refreshing, highlighting error/warning, supporting path copying and opening in file manager.
  • Tools can tail the instance’s logs/latest.log (default 120 lines, max 2000 lines) and the Gradle side logs/launch-<instance>-<side>.log.

Instances and Mods

  • Create Instance: Create run/<name>/{mods,config,saves,logs} and inherit options.txt from a default instance.
  • Delete Instance: Delete run/<instance>/ (default run/ is protected; running instances cannot be deleted).
  • Mod Toggles: Enable/Disable by renaming xxx.jar ⇄ xxx.jar.disabled without deleting files; supports “Keep only this one”.
  • Pick Mods from Workspace: Collect candidate jars from _shared/, _mods/, various run/mods, and run/<instance>/mods and import them to the target instance.

IDE Integration

  • One-click write to .idea/runConfigurations/<project>-<instance>.run, making each instance appear in the IntelliJ run dropdown list (format consistent with existing Gradle configurations: GradleRunConfiguration + runClient + -Pinstance=<name>).
  • When project names conflict, use project relative path + instance name as identity; when run configuration names conflict, add a project prefix (e.g., Fabric-example-default).

Behavior Contracts (Know before using)

  • No build script modification: Only reads build.gradle to identify loader/version/JDK; write scope is limited to run/, .idea/runConfigurations/, and startup logs under project logs/.
  • Startup record persistence: Running instances are recorded in %DSH_HOME%/mc-instances/launches.json, avoiding duplicate launches after Host reloads; stops request process tree exit first, then force-ends after 5 seconds.
  • Safe paths: Folders and files opened by the panel are limited to scanned instance/project directories and logs/text/images; executable files are refused. Remote sessions (e.g., dsh-pocket) cannot use the panel, but Agent tools are still available.
  • Zero extra runtime dependencies: File operations are pure Node; @deepseek-ai/dsh-tools is the only peer dependency.

Installation and Activation

Community plugin directory page: skillhub.cn/plugins/xin070710/dsh-mc-instances. This site is a community directory and has no official affiliation with DeepSeek or Huafan.

Recommended installation from the Plugin Market: Open Plugins → Plugin Market, search for “MC instances” or dsh-mc-instances and install.

Can also install directly from GitHub (no build needed):

dsh plugin --profile web add github:xin070710/dsh-mc-instances

Restart dsh web after installation. The README states it works without further configuration. If using Desktop, please install in Settings → Plugins to make the plugin enter the profile actually used by the app.

The plugin reads/writes the workspace and starts Gradle with the current DSH process permissions; it is recommended to check the source code and MIT license on the GitHub repository before installing to confirm it fits your security policy.

Workspace and JDK

Workspace resolution order: Tool argument workspace → Environment variable DSH_MC_WORKSPACE → Current process directory. The panel prioritizes registered DSH workspaces and respects auto-hide settings before switching.

DSH_MC_WORKSPACE=D:\path\to\your\mods dsh web

You can also set a default workspace for the plugin line in the profile’s cordis.patch.yml (public repo example does not include machine-specific paths):

- id: mc-instances
  name: dsh-mc-instances
  config:
    workspace: D:\path\to\your\mods

JDK resolution order: Project gradle.properties org.gradle.java.home → DSH_MC_JDK17/21/25 → JAVA_HOME → Common installation directories.

Typical Usage

Chat with Agent

The natural language examples provided in the README can be reused directly:

list my Minecraft test instances
create an instance called dev2 for example-mod and copy JEI into it
keep only Pixelmon enabled in example-mod-dev2
generate the IDE run configurations
example-mod-dev2 crashed on launch, show me the log

Agent-callable Tools

Tool Purpose
mc_instances action: list for full listing; action: detail to view a single instance
mc_instance_create Create instance; can copy the entire mods/ from another instance
mc_mods list / enable / disable / only / import / remove / candidates
mc_instance_log Tail instance game log
mc_instance_launch Launch instance in background (returns PID and log path)
mc_instance_launch_log Tail Gradle launch log
mc_ide_config Write IntelliJ run configuration (or runServer when server: true)
mc_instance_delete Delete instance directory

IntelliJ Workflow

  1. Ask the agent to “generate the IDE run configurations” (or call mc_ide_config).
  2. Click Reload in IntelliJ’s Gradle panel to load the new configuration.
  3. Select, for example, example-mod-dev2 in the run dropdown and click the green run button (including debug breakpoints).
  4. Ask the agent to tail that instance’s log to confirm if mods loaded successfully.

Suitable Scenarios and Notes

Who is it for: Mod developers who already use gradlew runClient -Pinstance=… and run/<name>/ isolation, need to view multiple projects/instances centrally in a DSH session, frequently switch mod combinations, or compare game and Gradle logs.

Not suitable or limited: Projects that do not use the aforementioned instance isolation conventions cannot work as designed; scenarios expecting automatic build.gradle modification or relying solely on panel operations via remote (e.g., dsh-pocket) need to use a local Web/Desktop session or rely on Agent tools.

Security and Trust: The plugin spawns child processes, reads/writes run/ and .idea/runConfigurations/, and records startup status in %DSH_HOME%. As with all DSH plugins, install from a trusted source and audit the code yourself.

Conclusion

If you are already hand-coding the test ritual of “scanning directories, copying jars, remembering Gradle commands”, dsh-mc-instances consolidates it into the DSH sidebar and a few conversations, while also adding IntelliJ run dropdowns and log views. For further information, jump from the community directory page dsh-mc-instances; for complete documentation and updates, see GitHub: github.com/xin070710/dsh-mc-instances.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye