PrismarineJS / mineflayer-navigate

mineflayer plugin which gives bots a high level 3d navigating API using A*
59 stars 22 forks source link

Promise-based navigation #36

Open thisismexp opened 5 years ago

thisismexp commented 5 years ago

Good morning everybody, i'am sorry for opening an issue on this; did not found an more appropriate place for it. While working on a project using mineflayer-navigate my code very fast became a mess because of all the events fired and holding status objects and so on. After a while i started to wrap this module in a promise based manner in order to use it in a more sequential style (without loosing any of the concurrency features), and express temporary dependencies better. This weekend i decided to proper document my code and publish it. Feel free to use it and it would be a pleasure if my code becomes part of this one (i avoided a pull request, because this topic was never discussed here, but it would be a pleasure to do so).

github: mineflayer-navigate-promise npm: mineflayer-navigate-promise

rom1504 commented 5 years ago

Hi, I will look at it, glad that mineflayer-navigate could be useful to you ! It was implemented before promises were a thing so indeed it was never considered before.

However there are many users of mineflayer and its plugins so we try to break the API as rarely as possible.

It would be great if it was possible to find a way to expose the promise API and also keep the old API at the same place. (Without copy pasting the code)

On a related topic, you can have a look at the mineflayer GitHub issue on promises.

On Mon, Dec 3, 2018, 08:58 Florian notifications@github.com wrote:

Good morning everybody, i'am sorry for opening an issue on this; did not found an more appropriate place for it. While working on a project using mineflayer-navigate my code very fast became a mess because of all the events fired and holding status objects and so on. After a while i started to wrap this module in a promise based manner in order to use it in a more sequential style (without loosing any of the concurrency features), and express temporary dependencies better. This weekend i decided to proper document my code and publish it. Feel free to use it and it would be a pleasure if my code becomes part of this one (i avoided a pull request, because this topic was never discussed here, but it would be a pleasure to do so).

github: mineflayer-navigate-promise https://github.com/thisismexp/mineflayer-navigate-promise npm: mineflayer-navigate-promise https://www.npmjs.com/package/mineflayer-navigate-promise

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer-navigate/issues/36, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_ojk80sMxum9cY5m29zTqQ7Opkumks5u1Nm0gaJpZM4Y-DgZ .

thisismexp commented 5 years ago

Thank you for your reply. Oh, to be honest, i did not checked the mineflayer issue page on this. But yeah, as you suggest, i just extended the api by some (3) functions and all the previous introduced functions should work as before. Just let me know your opinion on my little project when you looked at it. Since i'am new to the javascript world i do not claim that my code is flawless :)