GoalLookAtBlock.isEnd uses world.raycast to check if the target is visible from the current node. world.raycast only checks for collision boxes, not selection boxes.
Some blocks do not have collision boxes. Without a collision box to detect, the raycast will always fail. This prevents the agent recognizing when the goal has been reached. This prevents mineflayer-collectblocks collecting these blocks.
Code:
mineflayer-pathfinder\lib\goals.js line 195:
const rayPos = this.world.raycast(startPos, targetPos.clone().subtract(startPos).normalize(), this.reach)?.position
prismarine-world\worldsync.js line 52:
const intersect = iter.intersect(block.shapes, position)
Steps to reproduce:
place a block with no collision box
const goal = new mineflayer_pathfinder_1.goals.GoalLookAtBlock(blockWithNoCollision, bot.world); bot.pathfinder.goto(goal);
Expected result:
Bot looks at the block's selection box.
Observed result:
Bot moves towards the block but never marks the goal as complete.
Affected blocks include but are not limited to:
water
pressure plates
buttons
fire
torches
Possible steps to fix:
[ ] Add block.selectionShapes with data about selection boxes.
[ ] Update the documentation of block.shapes to make the difference between selection and collision boxes clearer.
[ ] Add an option to WorldSync.raycast to check for selection boxes instead of collision or create a matcher for this.
GoalLookAtBlock.isEnd
usesworld.raycast
to check if the target is visible from the current node.world.raycast
only checks for collision boxes, not selection boxes.These pages explain the difference: Collision box Selection box
Some blocks do not have collision boxes. Without a collision box to detect, the raycast will always fail. This prevents the agent recognizing when the goal has been reached. This prevents mineflayer-collectblocks collecting these blocks.
Code:
mineflayer-pathfinder\lib\goals.js line 195:
const rayPos = this.world.raycast(startPos, targetPos.clone().subtract(startPos).normalize(), this.reach)?.position
prismarine-world\worldsync.js line 52:const intersect = iter.intersect(block.shapes, position)
Steps to reproduce:
const goal = new mineflayer_pathfinder_1.goals.GoalLookAtBlock(blockWithNoCollision, bot.world); bot.pathfinder.goto(goal);
Expected result:
Bot looks at the block's selection box.
Observed result:
Bot moves towards the block but never marks the goal as complete.
Affected blocks include but are not limited to:
Possible steps to fix:
block.selectionShapes
with data about selection boxes.block.shapes
to make the difference between selection and collision boxes clearer.