PrismarineJS / mineflayer

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

Is it possible to switch between vanilla client and mineflayer bot (without login / logout)? #728

Closed ahibbe closed 5 years ago

ahibbe commented 6 years ago

Although I do not believe that this is possible, but maybe there is still a chance. In my case, it's quite difficult (for a bot) to get to a certain location on a non vanilla server and then let the bot do things automatically. Is it possible to navigate with the vanilla client to this place and then switch to the bot via mineflayer (without login / logout)?

plexigras commented 6 years ago

you use a proxy like this and instead of having keepAlive disabled you enable/remove it from the createBot options.

if you still have issues you might try to figure out if it is due to the minecraft client sending any packages you want to filter out. client.on('data', console.log) should help.

ahibbe commented 5 years ago

Thanks for your answer, the proxy thing works great. I can use the keyboard-driven client to go to a location that is not easy to reach and then close the client and then use client.on ("end" ..) as the starting point for automated actions.

For these actions, it would be helpful if the physics plugin were now active again. We deliberately did not load this on createBot with plugins: {physics: false}, as this would not work with a connected client. Now the client is closed and the physics plugin could be activated.

My question: Is there a way to load the physics plugin later?

Unfortunately, all my attempts have failed.

Thank you

plexigras commented 5 years ago

the physics module causes some glitchiness but i think having it disabled is not necessary.

i believe you should also be able to load it later using

bot.loadPlugin(require('mineflayer/lib/plugins/physics'))
piousdeer commented 5 years ago

Is there a way to do this with a real server, not with prismarine? It keeps kicking me no matter what I try.

plexigras commented 5 years ago

did you try this?

https://github.com/PrismarineJS/mineflayer/issues/315#issuecomment-409931101

piousdeer commented 5 years ago

In lluiscab's code client is generated by NMP server, I'm trying to connect to a normal Spigot server.

plexigras commented 5 years ago

i'm not sure what you are trying to do, the nmp server is just a proxy server.

piousdeer commented 5 years ago

I'm trying to get a mineflayer bot to connect to a Spigot server while I'm also connected with a normal vanilla client. So that I and my bot end up "controlling the same body". Now that I think of it it's probably impossible.

rom1504 commented 5 years ago

duplicate of https://github.com/PrismarineJS/mineflayer/issues/315 , please continue there