From e83f5051ce95b35f83b11068569fd5283f00d27b Mon Sep 17 00:00:00 2001 From: Lawtro37 <98205608+Lawtro37@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:38:02 +1000 Subject: [PATCH] added "goToDeath()" skill and fixed bugs shouldn't fail to path find now and is generally cleaner --- src/agent/library/skills.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/agent/library/skills.js b/src/agent/library/skills.js index b575ff1..fd53bc3 100644 --- a/src/agent/library/skills.js +++ b/src/agent/library/skills.js @@ -1185,6 +1185,25 @@ export async function goToBed(bot) { return true; } +export async function goToDeath(bot, agent) { + /** + * Navigate to the last death point. + * @param {MinecraftBot} bot, reference to the minecraft bot. + * @param {Agent} agent, reference to the agent. + * @returns {Promise} true if the death point was found, false otherwise. + * @example + * await skills.goToDeath(bot); + **/ + let death_pos = agent.memory_bank.recallPlace('last death position')[0]; // <- dont even ask why this is an array + if (death_pos) { + await goToPosition(bot, death_pos.x, death_pos.y, death_pos.z); + log(bot, `You have reached the death point.`); + return true; + } + log(bot, `Could not find the death point.`); + return false; +} + export async function tillAndSow(bot, x, y, z, seedType=null) { /** * Till the ground at the given position and plant the given seed type.