Open random-logic opened 1 year ago
I think this issue is with the 1.18.1 physics implementation. The issue is that it does not match vanilla physics causing the bot to get stuck inside the block. I don't know how to work around this. You can overwrite the getNeighbors method in Movements to remove the diagonal move tho. To extend the Movements class you could so something like this:
class NewMovement extends Movement {
getNeighbors (node) {
const neighbors = []
// Simple moves in 4 cardinal points
for (const i in cardinalDirections) {
const dir = cardinalDirections[i]
this.getMoveForward(node, dir, neighbors)
this.getMoveJumpUp(node, dir, neighbors)
this.getMoveDropDown(node, dir, neighbors)
if (this.allowParkour) {
this.getMoveParkourForward(node, dir, neighbors)
}
}
// Diagonals disabled
// for (const i in diagonalDirections) {
// const dir = diagonalDirections[i]
// this.getMoveDiagonal(node, dir, neighbors)
//}
this.getMoveDown(node, neighbors)
this.getMoveUp(node, neighbors)
return neighbors
}
}
And then use NewMovement as you would use Movement
The real fix would be to fix prismarine-physics for 1.18
mineflayer-pathfinder simulates jumps before it attempts them. If it detects that the simulation does not work it won't jump at all. If the bot jumps it means the bot thinks it can make the jump. If it fails it should be because the server resets the bots position making it fail the jump.
Thank you for the quick solution. Hopefully prismarine-physics can be fixed.
The bot thinks it can use the block on the right (that is one block high) on the right to get to the block in front (that is two blocks high). The bot thinks it can travel diagonally, but it can't since it is surrounded by other blocks.
To reproduce: Put the bot in an enclosure as shown on the screen shot with clearance above the block on the right (that is one block high) and the block in front (that is two blocks high). Set parkour to false. Set the goal so that the bot's feet are on the block in front (that is two blocks high). This is tested in Minecraft 1.18.1.
Result: The bot infinitely jumps without finding an alternate path.
Possible Fix: Allow the user the option to disallow bot to jump and travel diagonally in the Movements class.
Edit: It happens mainly when the bot is mining in the Nether. Sometimes it gets stuck while other times it doesn't, so I think the bot is getting stuck on a block when it tries to jump and travel diagonally simultaneously.