Two-pronged response to user-confirmed "bot stands still, doesn't actually chop" on play.xmatic.team: 1. Pin protocol — .env now sets MC_VERSION=1.21.4. minecraft-data has wrong packet ID mappings for protocol 775 (server 26.1.2 via ViaBackwards 5.9.1) — see mineflayer#3888 and #3717. 1.21.5 also has an enchants decoder bug that breaks bot.dig. 1.21.4 is the last protocol mineflayer 4.37.1 can speak cleanly through VIA. 2. Don't trust dig success — runtime/actions.js chopNearestTree and runtime/skills/gather-stone.js now lookAt(face center)+forceLook, await collectBlock, then re-read the target block. If the log/stone is STILL there, return ok:false code:"silent_dig_failure" and blacklist the position. Prevents the curriculum from reporting "wood.16 in progress" while the world hasn't actually changed. 3. Defensive default — runtime/movement-profiles.js: canDig=false on every profile until dig is confirmed working live. Otherwise pathfinder schedules paths through must-dig blocks and the bot loops. 4. Ground-truth probe — runtime/skills/diagnose-physics.js dispatches forward/jump/dig probes and writes the result to the diary. New IPC command cmd:run-skill lets the operator (or a future curriculum trigger) fire any skill on demand; it waits for the current action to finish before dispatching. /tmp/pepa-runskill.mjs is a one-shot client. Live probe on play.xmatic.team confirmed: forward Δ=0.003 over 2s (BROKEN — server rejects movement packets), jump ΔY=0.42 (likely physics jitter, not a real jump). Strongly suggests an anti-cheat plugin gating bot-style movements server-side — beyond protocol pin. npm test 124/124. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
// gather.logs — find the nearest log block matching the server's log
|
|
// registry, path to it, mine it. Wraps the existing actions.js primitive
|
|
// while exposing the survival-skill contract (preconditions, timeout,
|
|
// structured worldDelta, recovery hint).
|
|
|
|
import { chopNearestTree } from "../actions.js";
|
|
import { logs as logBlocks } from "./groups.js";
|
|
|
|
export const skill = Object.freeze({
|
|
id: "gather.logs",
|
|
title: "Gather logs",
|
|
timeoutMs: 60_000,
|
|
preconditions(ctx) {
|
|
if (!ctx?.bot) return { ok: false, code: "no_bot", detail: "bot missing" };
|
|
const known = logBlocks(ctx.bot);
|
|
if (known.size === 0) {
|
|
return { ok: false, code: "unsupported_version", detail: "no log blocks in registry" };
|
|
}
|
|
return { ok: true };
|
|
},
|
|
async execute(ctx) {
|
|
const res = await chopNearestTree(ctx.bot);
|
|
if (res.ok) {
|
|
return {
|
|
ok: true,
|
|
code: "done",
|
|
detail: res.detail,
|
|
worldDelta: {
|
|
choppedAt: res.detail?.at ?? null,
|
|
logType: res.detail?.logType ?? null,
|
|
},
|
|
};
|
|
}
|
|
const msg = String(res.detail ?? "");
|
|
// res.code can come straight from actions.js (silent_dig_failure),
|
|
// otherwise we classify from the detail string.
|
|
const code = res.code
|
|
? res.code
|
|
: (msg.includes("no reachable log") || msg.includes("no log within"))
|
|
? "no_target"
|
|
: msg.includes("timed out")
|
|
? "timeout"
|
|
: "failed";
|
|
return { ok: false, code, detail: res.detail, worldDelta: null };
|
|
},
|
|
validate(ctx, result) {
|
|
return result.ok && !!result.worldDelta?.logType;
|
|
},
|
|
recover(ctx, result) {
|
|
// Tell the caller: if there was no reachable log, switching to wander
|
|
// for ~60 s is the right next move — same heuristic the autonomous
|
|
// reflex already uses.
|
|
if (result.code === "no_target") {
|
|
return { hint: "wander", reason: "no log within 32 blocks" };
|
|
}
|
|
return null;
|
|
},
|
|
});
|