You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detailed Description
When attempting to pathfind with goalGetToBlock, if the selected path is obstructed by a block that cannot be broken such as Bedrock, the bot approaches the obstruction and stops. At that point, the code hangs indefinitely until the obstruction is removed, a new goal is set, or the bot is stopped.
The bot also does this if obstructed by a block that it does not have the correct tool to break. If blocked in by leaves, it will not break them unless it has a Hoe in its inventory to equip. I noticed that #142 has videos which show this behaviour.
The bot does not throw any error, nor does it trigger any 'goal_reached', 'path_updated', or 'path_reset' events while this is happening. It gets stuck in place and hangs. It also does not time out when in this state.
Steps to Reproduce
Create a basic bot that connects to a server, with mineflayer-pathfinder set up.
Set a goalGetToBlock which is obstructed on all sides by a block that cannot be broken, such as bedrock.
Run the bot and observe.
Alternate Steps to Reproduce
Create a basic bot that connects to a server, with mineflayer-pathfinder and mineflayer-collectblock set up.
Run the collectBlock.collect() function, targeting a diamond ore block (or any other block) which is obstructed on all sides by bedrock.
Run the bot and observe.
Expected Behaviour
When the bot encounters a goal that cannot be reached because of an unbreakable block, be it Bedrock, a Chest, etc, it should throw an error or event update (such as path_update: noPath or path_reset: stuck) so that the goal can be skipped.
Actual Behaviour
When the bot encounters a goal that cannot be reached because of an unbreakable block, be it Bedrock, a Chest, etc it stops in place and the pathfinding code seems to hang. It doesn't throw any events, updates, or errors, nor does it time out.
My Use Case
I am attempting to use https://github.com/PrismarineJS/mineflayer-collectblock/ to gather resources.
When gathering diamonds, the bot will occasionally locate diamonds in the bedrock layer that cannot be reached in survival mode.
I've also noticed this issue with leaves blocking the bot in if there is no Hoe in its inventory when attempting to gather wood.
Code Snippets
This is not my whole program, but these are the code snippets that I believe are relevant to the issue and recreating it.
//Debug listeners, these never trigger when the issue is occurring.bot.on('goal_reached',()=>{console.log("Goal reached.")})bot.on('path_updated',(update)=>{console.log("Path update "+update.status)})bot.on('path_reset',(update)=>{console.log("Update "+update)})//This code sets up the parameters of the movements constmcData=require('minecraft-data')(bot.version)constmovements=newMovements(bot,mcData)movements.scafoldingBlocks=[mcData.itemsByName.dirt.id,mcData.itemsByName.cobblestone.id]movements.blocksCantBreak.add(mcData.blocksByName.bedrock.id)//This line doesn't seem to make any difference on whether the bot hangs as described or not.constcmd=msg.split(' ')bot.pathfinder.thinkTimeout=10000//The think timeout doesn't seem to trigger at all when it's in the 'hanging' state I described.bot.pathfinder.setGoal(null)bot.pathfinder.setMovements(movements)//Finding the blocks to be gathered from a command, cmd[1] will be 'diamond_ore' and cmd[2] + cmd[3] are integers. mcData.blocksByName returns the position of the block, not the block itself, so we have to convert to the Block datatype using the for loop and the bot.blockAt function below.constblockType=mcData.blocksByName[cmd[1]]consttargetPs=bot.findBlocks({matching: blockType.id,maxDistance: cmd[2],count: cmd[3]})lettargets=[]for(lett=0;t<targetPs.length;t++){targets[t]=bot.blockAt(targetPs[t])}if(!targets[0]){console.log("No "+cmd[1]+" located within "+cmd[2]+" blocks, aborting.")return}else{console.log("Collecting...")//When the 'hanging' issue occurs as described, the below 'collect' function is called and executed, and it hangs there.//It doesn't throw an error or complete and say "Done Gathering", it gets stuck in the 'collect' function.//ignoreNoPath doesn't seem to affect whether it gets stuck in this state or not. If set to true, the bot// will run into the obstruction, sprint into it, and hang in that state while sprinting. Effectively// the only difference is that the bot hangs while sprinting instead of while standing still.bot.collectBlock.collect(targets,{ignoreNoPath: false},(error)=>{if(error){console.log(error)return}else{console.log("Done gathering.")return}})}return
The text was updated successfully, but these errors were encountered:
That's likely an issue with the collectblock plugin. pathfinder provides many way to check that the path is obstructed, the plugin should use them.
It isn't. I've tested this issue using a goalGetToBlock goal set to a point which is impossible to reach, without using the collectblock plugin at all. The same hanging behaviour happens as described in my post.
What version where you using? Bedrock should be on off the blocks that pathfinder should avoid when planing paths. It might be that for some reason it still tries to plan a path through an unbreakable block. Does it look like the bot is trying to break the block?
Detailed Description
When attempting to pathfind with
goalGetToBlock
, if the selected path is obstructed by a block that cannot be broken such as Bedrock, the bot approaches the obstruction and stops. At that point, the code hangs indefinitely until the obstruction is removed, a new goal is set, or the bot is stopped.The bot also does this if obstructed by a block that it does not have the correct tool to break. If blocked in by leaves, it will not break them unless it has a Hoe in its inventory to equip. I noticed that #142 has videos which show this behaviour.
The bot does not throw any error, nor does it trigger any 'goal_reached', 'path_updated', or 'path_reset' events while this is happening. It gets stuck in place and hangs. It also does not time out when in this state.
Steps to Reproduce
mineflayer-pathfinder
set up.goalGetToBlock
which is obstructed on all sides by a block that cannot be broken, such as bedrock.Alternate Steps to Reproduce
mineflayer-pathfinder
andmineflayer-collectblock
set up.collectBlock.collect()
function, targeting a diamond ore block (or any other block) which is obstructed on all sides by bedrock.Expected Behaviour
When the bot encounters a goal that cannot be reached because of an unbreakable block, be it Bedrock, a Chest, etc, it should throw an error or event update (such as
path_update: noPath
orpath_reset: stuck
) so that the goal can be skipped.Actual Behaviour
When the bot encounters a goal that cannot be reached because of an unbreakable block, be it Bedrock, a Chest, etc it stops in place and the pathfinding code seems to hang. It doesn't throw any events, updates, or errors, nor does it time out.
My Use Case
I am attempting to use https://github.com/PrismarineJS/mineflayer-collectblock/ to gather resources.
When gathering diamonds, the bot will occasionally locate diamonds in the bedrock layer that cannot be reached in survival mode.
I've also noticed this issue with leaves blocking the bot in if there is no Hoe in its inventory when attempting to gather wood.
Code Snippets
This is not my whole program, but these are the code snippets that I believe are relevant to the issue and recreating it.
The text was updated successfully, but these errors were encountered: