Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Mineflayer/Flying-Squid be deeply integrated with Minecraft-Protocol? #4

Open
TheDudeFromCI opened this issue Oct 27, 2020 · 2 comments

Comments

@TheDudeFromCI
Copy link
Member

I'm currently working on writing the design docs for the Mineflayer section when I started wondering whether or not Mineflayer (and Flying Squid) should be so tightly integrated with Minecraft-Protocol. Since all of the internal state is being moved info Prismarine-World, wouldn't it make sense to add another layer between Mineflayer and Minecraft-Protocol in the same manner?

Dependency Graph

For example, let's say we created a high-level version Minecraft-Protocol called Minecraft-Behavior or something. The purpose of this repository would be to add a higher level, version-agnostic implementation of Minecraft-Protocol. This would make maintaining both FlyingSquid and Mineflayer easier, since adding something like Minecraft 1.17 support would be done by updating this single module.

This way, we keep all states outside of Mineflayer and FlyingSquid, and we keep all protocols outside of Mineflayer and Flying Squid. The intermediate module would trigger events and add high level API for sending and recieving packets.

For example, look at Mineflayer's block_actions.js. Here, there are multiple conditions and packets to handle based on the Minecraft version. This is messy, in my opinion.

I think it would be a good idea to migrate the bot._client out of Mineflayer and into a dedicated module to manage all the low level packet processing. This new module could contain higher level packets such as useItem which would send the correct item use packet based on the given Minecraft version. It would also emit events when packets are recieved, and the format of each event would be identical, regardless of Minecraft version. (Such as in the example above, the packet would always use 'note_block', regardless of version. This would make it easier to maintain on Mineflayer and FlyingSquid.)

@rom1504
Copy link
Member

rom1504 commented Oct 27, 2020

yes I agree. Here are some notes on this idea PrismarineJS/node-minecraft-protocol#231

@TheDudeFromCI
Copy link
Member Author

Oh, nice. I'll add this to the document, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants