PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.95k stars 904 forks source link

Bot cannot go through doors #3000

Closed SonicandTailsCD closed 1 year ago

SonicandTailsCD commented 1 year ago

Versions

Detailed description of a problem

A clear and concise description of what the problem is, with as much context as possible. The bot won't pathfind through doors - even when they're opened!

What are you building? A bot that follows me (and I was hoping @678435021 would help) What problem are you trying to solve?Bot can't pathfind through doors

What did you try yet?

Did you try any method from the API? Yes Did you try any example? Yes Any error from those? No

Your current code


// Here I tell node.js mineflayer and a few other plugins are required to load
import { createBot } from 'mineflayer'
import pathfinderPkg from 'mineflayer-pathfinder'
import { commands, setup as setupCmds } from './lib/commands.js'
import { setup as setupMfUtils } from './lib/mineflayer-utils.js'
const { pathfinder, Movements } = pathfinderPkg

// Here, we set up the server connection (in this case, my skin plugin server)
export const bot = createBot({
    host: 'SonicJavaBots.aternos.me',
    port: '37867',
    username: 'SonicandTailsCDb',
    version: '1.18.2'
})

setupMfUtils(bot)
setupCmds(bot)

const mcData = (await import('minecraft-data')).default(bot.version)

// Setup pathfinder
bot.loadPlugin(pathfinder)
bot.pathfinder.setMovements(new Movements(bot, mcData))

// And now, we work on the AI here!
// Here's all of the functions:
// One note tho: All functions are placeholders.
function onPhysicsTick () {}

function onSpawn () {
    bot.chat('/skin set SonicandTailsCDb robot1_alextest')
    bot.chat("Hey! I'm working properly :D")
    bot.on('chat', (daname, msg) => {
        if (daname === "SonicandTailsCDb") return
        if (daname === "SkinsRestorer") return
        console.log(daname + " said: " + msg)
        if (msg === 'follow me') {
            commands.followMe(daname)
            console.log("I started following " + daname)
            return
        }
        if (msg === 'Come here, sleep with me!') {
            commands.sleep()
        }
        if (msg === 'hey') {
            bot.chat("what you want?")
            console.log("I said: what you want?")
        }
        if (msg === 'stop following me') {
            commands.unFollowMe()
            console.log("I stopped following " + daname)
        }
    })
}

// I'm unsure on how am I gonna use onPhysicsTick function but I'll leave it there in case I wanna use it.
bot.on('physicsTick', onPhysicsTick)

// Next, I'm gonna set spawn actions.
bot.once('spawn', onSpawn)

Expected behavior

A clear and concise description of what you expected to happen. The bot would follow me through the doors

Additional context

Add any other context about the problem here. NO. Thanks 👍

ghost commented 1 year ago

This is an issue with mineflayer-pathfinder as it sees open doors as full blocks and doesn't support opening doors

SonicandTailsCD commented 1 year ago

Oh, hello @678435021! So there isn't a fix?

SonicandTailsCD commented 1 year ago

(at least for now?)

ghost commented 1 year ago

yup there's no fix yet

SonicandTailsCD commented 1 year ago

Alright. Should I close this as not planned?

ghost commented 1 year ago

yeah probably as there's already an issue open here: https://github.com/PrismarineJS/mineflayer-pathfinder/issues/300

SonicandTailsCD commented 1 year ago

Alright. (Also I already replied to you in "our" repo - you can check it out anytime :) )