From f0542833f26e46b555af7ea8b5354b4f4fac9535 Mon Sep 17 00:00:00 2001 From: MaxRobinsonTheGreat Date: Sat, 27 Apr 2024 23:37:13 -0500 Subject: [PATCH] fixed null block crash --- src/agent/modes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agent/modes.js b/src/agent/modes.js index 0081682..ef99b59 100644 --- a/src/agent/modes.js +++ b/src/agent/modes.js @@ -26,13 +26,13 @@ const modes = [ const bot = agent.bot; const block = bot.blockAt(bot.entity.position); const blockAbove = bot.blockAt(bot.entity.position.offset(0, 1, 0)); - if (blockAbove.name === 'water' || blockAbove.name === 'flowing_water') { + if (blockAbove && (blockAbove.name === 'water' || blockAbove.name === 'flowing_water')) { // does not call execute so does not interrupt other actions if (!bot.pathfinder.goal) { bot.setControlState('jump', true); } } - else if (this.fall_blocks.some(name => blockAbove.name.includes(name))) { + else if (blockAbove && this.fall_blocks.some(name => blockAbove.name.includes(name))) { execute(this, agent, async () => { await skills.moveAway(bot, 2); });