-
-
Notifications
You must be signed in to change notification settings - Fork 920
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
Move the whole world state to prismarine-world for better packaging #334
Comments
One way to make the transition smoother is to just deprecate blockAt, implement it using prismarine-world-sync and use bot.world for everything else. |
Something interesting about this is a prismarine-world-blockfinder could be made and used in mineflayer-blockfinder that would then be just a few lines. |
(using prismarine-world-sync would break mineflayer in the browser though, maybe it should be an optional dependency and we'd have no blockAt function for the no-prismarine-world-sync case, or maybe we could just remove blockAt altogether, but that would mean doing PRs on all projects using mineflayer) |
Related idea : have a prismarine-world-snapshot that would take a snapshot of a given region and allow a sync api on that region. That might be useful to speed up blockfinder. |
Alright, let's start with using prismarine-chunk in mineflayer. That will give us cross platform chunk (PrismarineJS/prismarine-chunk#19) + we don't have to deal with the async problem for now. |
p-chunk is now used. |
#1145 made this happen Follow up :
|
deprecating blockAt would be really useful |
@rom1504 has funded $10.00 to this issue.
|
Faced with the fact that mineflayer duplicates some things from prusmarine such as Block, Item, Recipe, etc. |
@introquest Mineflayer does not duplicate anything from those libraries, but imports then. The goal of Mineflayer is to move as much code out of Mineflayer as possible into micro-modules. (prismarine-block, primsarine-item, etc) Ideally, by making many very small libraries, they become very easy to maintain and reuse since they are so small. As for this issue, prismarine-world should contain all of the world states, with Mineflayer acting solely as a stateless transformer for the world. The world contains submodules that further divide the state. Prismarine-chunk, Prismarine-Entity, etc. |
see https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#blockupdate-oldblock-newblock working towards PrismarineJS/mineflayer#334 (comment) this will do a get at each set, making the set methods a bit slower it is needed to keep compatibility with mineflayer I think it is ok as initialize can be used to do a faster set for many blocks
see https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#blockupdate-oldblock-newblock working towards PrismarineJS/mineflayer#334 (comment) this will do a get at each set, making the set methods a bit slower it is needed to keep compatibility with mineflayer I think it is ok as initialize can be used to do a faster set for many blocks
* add the same block events as mineflayer see https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#blockupdate-oldblock-newblock working towards PrismarineJS/mineflayer#334 (comment) this will do a get at each set, making the set methods a bit slower it is needed to keep compatibility with mineflayer I think it is ok as initialize can be used to do a faster set for many blocks * fix posInChunk thing
@sauberesache has funded $20.00 to this issue.
|
@sauberesache has cancelled funding for this issue.(Cancelled amount: $20.00) See it on IssueHunt |
@rom1504 has cancelled funding for this issue.(Cancelled amount: $10.00) See it on IssueHunt |
signs and block entities are done next step deciding what to do with paintings |
once paintings is gone we can merge #2453 |
new plan after discussion in discord: move everything to pchunk
since entities can move between chunks,
once this is done, mineflayer should contain no state and be only a packet <-> world and action <-> packet/world synchronization layer
|
since we have some funding now, any significant PR towards that goal is eligible to $20 of reward (using open collective money) of course working on it because it's cool stays a great reason :) |
why would entities be part of a chunk, and not just part of the world? their id is unique in the entire world, most entities move freely between chunks all the time, and accessing entities through their current chunk is rather useless as you typically want to find entities nearby regardless of what chunk they are in. |
the world abstraction (pworld) would expose the ability to search for an entity by its id or to look for an entity in a location based on properties (by looking and/or indexing the information stored in chunks) having the entities be part of the chunk should make it easier to scale the world to large sizes |
This will make blockAt async and break everything depending on it.
But it's for the good cause of being able to implement a world representation with any kind of backend (especially async backend like databases)
https://github.com/PrismarineJS/prismarine-world
https://github.com/andrewrk/mineflayer/blob/master/lib/plugins/blocks.js
The text was updated successfully, but these errors were encountered: