Consider storing errored blockstates a different way
embeddedt opened this issue ยท 3 comments
BlockStateMixin
currently adds an extra field to every block state, and initializes it with a unique Object2BooleanOpenHashMap
object.
This will add up to quite a bit of additional memory usage in larger modpacks; it's not uncommon for there to be over 400,000 blockstates in total. Since most blockstates will not be errored, the maps are rarely going to be used and thus will just waste memory.
As an alternative, I would suggest storing this data using either a global map of BlockState/BlockPos pairs, or just a Map<BlockState, Object2BooleanOpenHashMap<BlockPos>>
. Both solutions avoid baseline memory usage scaling with the number of blockstates.
Yup, makes sense. This was an oversight, I'll bundle this change into the next release which should follow shortly after arch merges their forge 1.20.6+ fix.. or if that takes too long I'll just drop lex forge.