mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
feat: enhance decompilation and server management scripts
- Introduced `decompile.sh` to automate the decompilation process, including downloading `MinecraftDecompiler.jar` and server.jar for specified Minecraft versions. - Added `mc-rcon.sh` for sending RCON commands to a Minecraft server, improving server management capabilities. - Created `mcc-env.sh` to provide helper functions for managing Minecraft servers, including starting, stopping, and sending commands. - Implemented `start-server.sh` to launch a Minecraft server in a tmux session with a named pipe for stdin, facilitating easier command input. - Updated `README.md` to reflect new tools and usage instructions for decompiling and server management. These changes streamline the workflow for adapting to new Minecraft versions and enhance the overall development experience.
This commit is contained in:
parent
9e3bfaa868
commit
cca4134e8b
6 changed files with 301 additions and 11 deletions
33
tools/mcc-env.sh
Normal file
33
tools/mcc-env.sh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# MCC (Minecraft Console Client) Development Utilities
|
||||
# Source this file to get helper functions: source $MCC_REPO/tools/mcc-env.sh
|
||||
# Or add to ~/.bashrc: source "$HOME/Minecraft/Minecraft-Console-Client-milutinke/tools/mcc-env.sh"
|
||||
|
||||
TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export MCC_REPO="$(cd "$TOOLS_DIR/.." && pwd)"
|
||||
export MCC_SERVERS="$MCC_REPO/MinecraftOfficial/downloads"
|
||||
|
||||
# Helper: convert version to tmux session name (dots -> underscores)
|
||||
_mc-session() { echo "mc-${1//\./_}"; }
|
||||
|
||||
# --- Minecraft Server Management ---
|
||||
mc-start() { "$MCC_REPO/tools/start-server.sh" "${1:-1.20.6}"; }
|
||||
mc-stop() { local v="${1:-1.20.6}"; echo "stop" > "$MCC_SERVERS/$v/stdin.pipe"; }
|
||||
mc-cmd() { local v="${2:-1.20.6}"; echo "$1" > "$MCC_SERVERS/$v/stdin.pipe"; }
|
||||
mc-log() { local s; s=$(_mc-session "${1:-1.20.6}"); tmux capture-pane -t "$s" -p -S "-${2:-50}"; }
|
||||
mc-kill() { local v="${1:-1.20.6}" s; s=$(_mc-session "$v"); tmux kill-session -t "$s" 2>/dev/null; rm -f "$MCC_SERVERS/$v/stdin.pipe"; echo "Killed $s"; }
|
||||
mc-list() { tmux list-sessions 2>/dev/null | grep "^mc-" || echo "No running MC servers"; }
|
||||
|
||||
# --- RCON ---
|
||||
mc-rcon() { "$MCC_REPO/tools/mc-rcon.sh" "$@"; }
|
||||
|
||||
# --- MCC Build/Run ---
|
||||
mcc-build() { dotnet build "$MCC_REPO/MinecraftClient.sln" -c Release; }
|
||||
mcc-run() { cd "$MCC_REPO" && MCC_FILE_INPUT=1 dotnet run --project MinecraftClient -c Release -- CursorBot - "localhost:${1:-25565}" 2>&1; }
|
||||
mcc-cmd() { echo "$1" >> "$MCC_REPO/mcc_input.txt"; }
|
||||
mcc-kill() { pkill -f "MinecraftClient" 2>/dev/null && echo "MCC killed" || echo "No MCC process found"; }
|
||||
mcc-reload() {
|
||||
mcc-kill
|
||||
sleep 1
|
||||
mcc-build && mcc-run
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue