mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-22 06:02:07 +02:00
fix unloaded blocks in mode check
This commit is contained in:
parent
3ac7423953
commit
dc520a9ea1
1 changed files with 4 additions and 2 deletions
|
@ -26,13 +26,15 @@ const modes = [
|
||||||
const bot = agent.bot;
|
const bot = agent.bot;
|
||||||
const block = bot.blockAt(bot.entity.position);
|
const block = bot.blockAt(bot.entity.position);
|
||||||
const blockAbove = bot.blockAt(bot.entity.position.offset(0, 1, 0));
|
const blockAbove = bot.blockAt(bot.entity.position.offset(0, 1, 0));
|
||||||
if (blockAbove && (blockAbove.name === 'water' || blockAbove.name === 'flowing_water')) {
|
if (!block) block = {name: 'air'}; // hacky fix when blocks are not loaded
|
||||||
|
if (!blockAbove) blockAbove = {name: 'air'};
|
||||||
|
if (blockAbove.name === 'water' || blockAbove.name === 'flowing_water') {
|
||||||
// does not call execute so does not interrupt other actions
|
// does not call execute so does not interrupt other actions
|
||||||
if (!bot.pathfinder.goal) {
|
if (!bot.pathfinder.goal) {
|
||||||
bot.setControlState('jump', true);
|
bot.setControlState('jump', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (blockAbove && this.fall_blocks.some(name => blockAbove.name.includes(name))) {
|
else if (this.fall_blocks.some(name => blockAbove.name.includes(name))) {
|
||||||
execute(this, agent, async () => {
|
execute(this, agent, async () => {
|
||||||
await skills.moveAway(bot, 2);
|
await skills.moveAway(bot, 2);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue