const { getBot } = require('../core/context'); const { saveMemory } = require('../memory'); const db = require('../db'); // Define what kinds of blocks to remember. This should probably be a variable later so that I can add to this list. const INTERESTING_BLOCKS = [ 'coal_ore', 'iron_ore', 'diamond_ore', 'gold_ore', 'emerald_ore', 'redstone_ore', 'lapis_ore', 'copper_ore', 'oak_log', 'birch_log', 'spruce_log', 'crafting_table', 'furnace', 'chest', 'anvil', 'enchanting_table', 'lectern', 'bell', 'bed', 'beacon', 'portal' ]; module.exports = async function logSurroundings() { const bot = getBot(); if (!bot) return; const found = bot.findBlocks({ matching: block => INTERESTING_BLOCKS.includes(block.name), maxDistance: 12, count: 10 }); for (const pos of found) { const block = bot.blockAt(pos); if (!block || !block.name) continue; const label = `found:${block.name}:${pos.x},${pos.y},${pos.z}`; const memoryData = { name: block.name, position: pos }; saveMemory(db, label, memoryData); } if (found.length > 0) { bot.chat(`I noticed ${found.length} interesting blocks nearby.`); } };