diff --git a/services/minecraft/src/cognitive/conscious/context-view.ts b/services/minecraft/src/cognitive/conscious/context-view.ts index 9a0265db9..0b13b6003 100644 --- a/services/minecraft/src/cognitive/conscious/context-view.ts +++ b/services/minecraft/src/cognitive/conscious/context-view.ts @@ -17,18 +17,16 @@ export function buildConsciousContextView(ctx: ReflexContextState): ConsciousCon const gaze = ctx.environment.nearbyPlayersGaze .map((g) => { - const hit = g.hitBlock - ? `${g.hitBlock.name}@(${Math.round(g.hitBlock.pos.x)}, ${Math.round(g.hitBlock.pos.y)}, ${Math.round(g.hitBlock.pos.z)})` - : 'air' - - if (g.hitBlock) - return `${g.name}->${hit}` + if (g.hitBlock) { + const block = `${g.hitBlock.name} at (${Math.round(g.hitBlock.pos.x)}, ${Math.round(g.hitBlock.pos.y)}, ${Math.round(g.hitBlock.pos.z)})` + return `${g.name} is looking at ${block}` + } const lp = `(${Math.round(g.lookPoint.x)}, ${Math.round(g.lookPoint.y)}, ${Math.round(g.lookPoint.z)})` - return `${g.name}->${hit} lookPoint${lp}` + return `${g.name} is staring into the air around ${lp}` }) - .join(' | ') - const gazeSummary = ctx.environment.nearbyPlayersGaze.length > 0 ? ` Nearby player gaze [${gaze}]` : '' + .join('\n') + const gazeSummary = ctx.environment.nearbyPlayersGaze.length > 0 ? `\nNearby player gaze:\n${gaze}` : '' const environmentSummary = `${ctx.environment.time} ${ctx.environment.weather} Nearby players [${players}] Nearby entities [${entities}] Light ${ctx.environment.lightLevel}${gazeSummary}` diff --git a/services/minecraft/src/cognitive/reflex/context.ts b/services/minecraft/src/cognitive/reflex/context.ts index 59accf79d..be9c01757 100644 --- a/services/minecraft/src/cognitive/reflex/context.ts +++ b/services/minecraft/src/cognitive/reflex/context.ts @@ -8,7 +8,7 @@ export interface ReflexSelfState { } export interface ReflexEnvironmentState { - time: 'day' | 'night' | 'sunset' | 'sunrise' + time: string weather: 'clear' | 'rain' | 'thunder' nearbyPlayers: Array<{ name: string, distance?: number, holding?: string | null }> nearbyPlayersGaze: Array<{ @@ -64,7 +64,7 @@ export class ReflexContext { food: 20, }, environment: { - time: 'day', + time: 'SOMETHING WENT WRONG, YOU SHOULD NOTIFY THE USER OF THIS', weather: 'clear', nearbyPlayers: [], nearbyPlayersGaze: [], diff --git a/services/minecraft/src/cognitive/reflex/runtime.ts b/services/minecraft/src/cognitive/reflex/runtime.ts index 8c33b25c4..8dd16e5de 100644 --- a/services/minecraft/src/cognitive/reflex/runtime.ts +++ b/services/minecraft/src/cognitive/reflex/runtime.ts @@ -173,8 +173,20 @@ export class ReflexRuntime { return acc }, [] as Array<{ name: string, distance: number, holding: string | null }>) + const formatMinecraftTime = (timeOfDay?: number): string => { + if (typeof timeOfDay !== 'number') + return 'Unknown time' + + const hours24 = (6 + Math.floor(timeOfDay / 1000)) % 24 + const minutes = Math.floor(((timeOfDay % 1000) * 60) / 1000) + + const hours12 = hours24 % 12 === 0 ? 12 : hours24 % 12 + const suffix = hours24 >= 12 ? 'PM' : 'AM' + return `${String(hours12).padStart(2, '0')}:${String(minutes).padStart(2, '0')} ${suffix}` + } + this.context.updateEnvironment({ - time: bot.bot.time?.isDay ? 'day' : 'night', + time: formatMinecraftTime(bot.bot.time?.timeOfDay), weather: bot.bot.isRaining ? 'rain' : 'clear', nearbyPlayers: players, })