mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-25 17:35:25 +02:00
fix bug in pathfinder
This commit is contained in:
parent
e930a0b340
commit
512fac9622
1 changed files with 13 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
diff --git a/node_modules/mineflayer-pathfinder/index.js b/node_modules/mineflayer-pathfinder/index.js
|
||||
index b38bd30..069c1af 100644
|
||||
index b38bd30..fb39b45 100644
|
||||
--- a/node_modules/mineflayer-pathfinder/index.js
|
||||
+++ b/node_modules/mineflayer-pathfinder/index.js
|
||||
@@ -170,6 +170,16 @@ function inject (bot) {
|
||||
|
@ -19,7 +19,17 @@ index b38bd30..069c1af 100644
|
|||
if (b && (b.type === waterType || ((b.type === ladderId || b.type === vineId) && i + 1 < path.length && path[i + 1].y < curPoint.y))) {
|
||||
curPoint.x = Math.floor(curPoint.x) + 0.5
|
||||
curPoint.y = Math.floor(curPoint.y)
|
||||
@@ -550,6 +560,7 @@ function inject (bot) {
|
||||
@@ -524,6 +534,9 @@ function inject (bot) {
|
||||
bot.activateBlock(bot.blockAt(new Vec3(placingBlock.x, placingBlock.y, placingBlock.z))).then(() => {
|
||||
lockUseBlock.release()
|
||||
placingBlock = nextPoint.toPlace.shift()
|
||||
+ if (!placingBlock) {
|
||||
+ placing = false
|
||||
+ }
|
||||
}, err => {
|
||||
console.error(err)
|
||||
lockUseBlock.release()
|
||||
@@ -550,6 +563,7 @@ function inject (bot) {
|
||||
lockEquipItem.release()
|
||||
const refBlock = bot.blockAt(new Vec3(placingBlock.x, placingBlock.y, placingBlock.z), false)
|
||||
if (!lockPlaceBlock.tryAcquire()) return
|
||||
|
@ -27,7 +37,7 @@ index b38bd30..069c1af 100644
|
|||
if (interactableBlocks.includes(refBlock.name)) {
|
||||
bot.setControlState('sneak', true)
|
||||
}
|
||||
@@ -557,6 +568,7 @@ function inject (bot) {
|
||||
@@ -557,6 +571,7 @@ function inject (bot) {
|
||||
.then(function () {
|
||||
// Dont release Sneak if the block placement was not successful
|
||||
bot.setControlState('sneak', false)
|
||||
|
|
Loading…
Add table
Reference in a new issue