PrismarineJS / prismarine-chunk

A class to hold chunk data for Minecraft
MIT License
61 stars 59 forks source link

implement findBlock here #154

Open rom1504 opened 2 years ago

rom1504 commented 2 years ago

will be possible when https://github.com/PrismarineJS/mineflayer/issues/334 is done

will enable https://github.com/PrismarineJS/prismarine-world/issues/89

Karang commented 2 years ago

find block would be better implemented at the world level, since the iterators can cross chunks boundaries (and are already packaged in pworld)

nickelpro commented 2 years ago

We really need both. Chunks need to be allowed to search themselves (as they best know how, based on palette consideration). Then those facilities can be used by pris-world to do general purpose search

extremeheat commented 2 years ago

Is anything blocking here or just waiting for an implementation?

rom1504 commented 2 years ago

https://github.com/PrismarineJS/mineflayer/issues/334#issuecomment-670987395 is blocking because mineflayer findBlock relies on mineflayer blockAt which has features (eg block entities) that pchunk getBlock do not

extremeheat commented 2 years ago

there are some version handling things in https://github.com/PrismarineJS/mineflayer/blob/04665d1c757a9eaf6433cabd3b2fa62d39d88ad5/lib/plugins/blocks.js#L51 with signs, not sure how this could be implemented inside pchunk since it seems like a mineflayer level abstraction, as pchunk needs to be able to load block entities and also dump them back.

So maybe it would make sense to add some form of block entity abstraction on the mineflayer side and keep the block entity data pure on the pchunk side (as in we just .addBlockEntity(pos, nbt) in pworld which proxies to pchunk)? Or maybe prismarine-block could have a role to play in abstracting some of the block entity features.

rom1504 commented 2 years ago

https://github.com/PrismarineJS/prismarine-chunk/issues/134#issuecomment-1003436274 we have a plan for block entities there, we want to move them to pchunk to be able to move the state from mineflayer to pworld/pchunk about the sign abstraction, we can make any choice about it / change it if needed