8ee8be9cc0
- mc_aigod.py: main watcher script (log tail, RCON, two-call LLM) - Two-call LLM split: qwen3-coder:30b for commands, gemma3:12b for messages - Divine intervention timer (Poisson process, configurable avg/day) - Prayer memory (persistent, last 10 exchanges) - Rolling server log context (last 20 min events) - Live player context (inventory with rarity, health, food, pos, XP) - /pray and bible chat detection (no slash — vanilla 1.21 compatible) - Login notice, bible help system - debug_commands toggle (in-game command display via tellraw) - Auto-fix for transposed give command syntax - JSON repair fallback for truncated LLM responses - Sentence-aware message chunking for long responses - mc-aigod.service systemd unit - mc_aigod_shrink.json example config - README.md full implementation guide - Minecraft_Ai_God.md full design document
116 lines
3.6 KiB
Markdown
116 lines
3.6 KiB
Markdown
# Sethpc Minecraft Project Context
|
|
|
|
## Infrastructure
|
|
|
|
### MCSManager Panel
|
|
- **CT:** 644 on node-112 (sethpc, 192.168.0.112)
|
|
- **IP:** 192.168.0.244
|
|
- **Web panel:** http://mc.sethpc.xyz (via Caddy on CT 600, node-241)
|
|
- **Panel ports:** 23333 (web), 24444 (daemon)
|
|
- **OS:** Debian 12, Java 21 (Temurin)
|
|
- **Installed via:** https://script.mcsmanager.com/setup.sh
|
|
- **Systemd services:** `mcsm-web.service`, `mcsm-daemon.service`
|
|
|
|
---
|
|
|
|
## Server 1 — mc1 (Vanilla survival)
|
|
|
|
| Property | Value |
|
|
|---|---|
|
|
| Instance ID | `d39f55861cb34204a92a18a9e1c78ca6` |
|
|
| Game port | `25565` |
|
|
| RCON port | `25575` |
|
|
| RCON password | `REDACTED_RCON` |
|
|
| Data dir | `/opt/mcsmanager/daemon/data/InstanceData/d39f55861cb34204a92a18a9e1c78ca6/` |
|
|
| Version | Minecraft 1.21.x (vanilla) |
|
|
| Connect | `192.168.0.244:25565` |
|
|
|
|
### Services on CT 644
|
|
- `mc-godmode.service` — watches `latest.log`, sets `slingshooter08` to creative on every login
|
|
- Script: `/usr/local/bin/mc_godmode_watch.sh`
|
|
- Calls: `/usr/local/bin/mc_godmode_rcon.py`
|
|
- Toggle: `systemctl start/stop mc-godmode.service`
|
|
|
|
---
|
|
|
|
## Server 2 — shrink-world
|
|
|
|
| Property | Value |
|
|
|---|---|
|
|
| Instance ID | `shrinkborder1234567890abcdef12345` |
|
|
| Game port | `25566` |
|
|
| RCON port | `25576` |
|
|
| RCON password | `REDACTED_RCON` |
|
|
| Data dir | `/opt/mcsmanager/daemon/data/InstanceData/shrinkborder1234567890abcdef12345/` |
|
|
| Version | Minecraft 1.21.x (vanilla, same server.jar as mc1) |
|
|
| Connect | `192.168.0.244:25566` |
|
|
| World border | 500x500 centered at 0,0 (started at 1000x1000) |
|
|
| Difficulty | Hard |
|
|
|
|
### Datapacks installed
|
|
1. **shrinkborder** — detects player deaths, shrinks world border by 1 block per death, alternating N/S and E/W sides. Starts DISABLED.
|
|
2. **morespawns** — increases creeper spawn weight from 100 to 500 (5x more creepers)
|
|
|
|
### Services on CT 644
|
|
- `mc-shrink-kit.service` — main watcher script for shrink-world
|
|
- Script: `/usr/local/bin/shrink_godkit.py`
|
|
- On first login: gives full god kit (netherite armor + tools + consumables)
|
|
- On every login: broadcasts world stats
|
|
- On every death: broadcasts world stats + increments death counter
|
|
- Every hour: broadcasts world stats
|
|
- Kit record persisted at: `<data_dir>/kit_given.json`
|
|
|
|
---
|
|
|
|
## RCON Helper (Python)
|
|
|
|
All server communication uses raw RCON sockets (no external library needed):
|
|
|
|
```python
|
|
import socket, struct, time
|
|
|
|
def rcon(cmd, host='127.0.0.1', port=25575, password='REDACTED_RCON'):
|
|
s = socket.socket()
|
|
s.settimeout(5)
|
|
s.connect((host, port))
|
|
def pkt(i, t, p):
|
|
p = p.encode() + b'\x00\x00'
|
|
return struct.pack('<iii', len(p)+8, i, t) + p
|
|
s.sendall(pkt(1, 3, password))
|
|
time.sleep(0.2)
|
|
s.recv(4096)
|
|
s.sendall(pkt(2, 2, cmd))
|
|
time.sleep(0.2)
|
|
r = s.recv(4096)
|
|
s.close()
|
|
return r[12:-2].decode()
|
|
```
|
|
|
|
For shrink-world use port `25576` and password `REDACTED_RCON`.
|
|
|
|
---
|
|
|
|
## Minecraft 1.21 Notes
|
|
|
|
- **Enchantment syntax** (1.21+): `give player item[enchantments={sharpness:5,unbreaking:3}]`
|
|
- NOT the old NBT `{Enchantments:[{id:...,lvl:...}]}` format
|
|
- **Death detection regex:** `(\w+) (died|was slain|was shot|drowned|fell|burned|blew up|suffocated|starved|was killed|hit the ground|went up in flames|tried to swim in lava)`
|
|
- **RCON** requires `enable-rcon=true` and `rcon.password=` set in `server.properties`, then server restart
|
|
|
|
---
|
|
|
|
## Players
|
|
|
|
| Username | UUID |
|
|
|---|---|
|
|
| slingshooter08 | 45374469-5333-43e1-9881-39ad6b5f3301 |
|
|
|
|
---
|
|
|
|
## Networking
|
|
|
|
- Both servers are LAN-only (`192.168.0.244`)
|
|
- External access requires port forwarding on router: `25565` and `25566` → `192.168.0.244`
|
|
- Web panel accessible via Caddy at `mc.sethpc.xyz`
|
|
- DNS: Pi-hole at `192.168.0.153`
|