diff --git a/src/agent/commands/queries.js b/src/agent/commands/queries.js index 5b3ec58..f10b6e1 100644 --- a/src/agent/commands/queries.js +++ b/src/agent/commands/queries.js @@ -17,9 +17,6 @@ export const queryList = [ let pos = bot.entity.position; // display position to 2 decimal places res += `\n- Position: x: ${pos.x.toFixed(2)}, y: ${pos.y.toFixed(2)}, z: ${pos.z.toFixed(2)}`; - // Environmental Awareness - res += '\n- ' + world.getSurroundingBlocks(bot).join('\n- ') - res += `\n- First Solid Block Above Head: ${world.getFirstBlockAboveHead(bot, null, 32)}`; // Gameplay res += `\n- Gamemode: ${bot.game.gameMode}`; res += `\n- Health: ${Math.round(bot.health)} / 20`; @@ -35,6 +32,9 @@ export const queryList = [ // res += `\n- Artficial light: ${block.skyLight}`; // res += `\n- Sky light: ${block.light}`; // light properties are bugged, they are not accurate + res += '\n- ' + world.getSurroundingBlocks(bot).join('\n- ') + res += `\n- First Solid Block Above Head: ${world.getFirstBlockAboveHead(bot, null, 32)}`; + if (bot.time.timeOfDay < 6000) { res += '\n- Time: Morning'; diff --git a/src/agent/library/world.js b/src/agent/library/world.js index a6428c0..1f147d2 100644 --- a/src/agent/library/world.js +++ b/src/agent/library/world.js @@ -67,10 +67,9 @@ export function getSurroundingBlocks(bot) { **/ // Create a list of block position results that can be unpacked. let res = []; - res.push(`Block Above: ${getBlockAtPosition(bot, 0, 2, 0).name}`); res.push(`Block Below: ${getBlockAtPosition(bot, 0, -1, 0).name}`); - res.push(`Block at Head: ${getBlockAtPosition(bot, 0, 1, 0).name}`); res.push(`Block at Legs: ${getBlockAtPosition(bot, 0, 0, 0).name}`); + res.push(`Block at Head: ${getBlockAtPosition(bot, 0, 1, 0).name}`); return res; } @@ -92,8 +91,8 @@ export function getFirstBlockAboveHead(bot, ignore_types=null, distance=32) { else { if (!Array.isArray(ignore_types)) ignore_types = [ignore_types]; - for(let ingnore_type of ignore_types) { - if (mc.getBlockId(ingnore_type)) ignore_blocks.push(ingnore_type); + for(let ignore_type of ignore_types) { + if (mc.getBlockId(ignore_type)) ignore_blocks.push(ignore_type); } } // The block above, stops when it finds a solid block . @@ -109,6 +108,8 @@ export function getFirstBlockAboveHead(bot, ignore_types=null, distance=32) { height = i; break; } + + if (ignore_blocks.includes(block_above.name)) return 'none'; return `${block_above.name} (${height} blocks up)`; }