Closed 2xsaiko closed 6 years ago
I'm going to make a suggestion: instead of doing this, have BlockMultipart's breakBlock() a NOP given a special, thread-local flag is set to true. Might be less hacky in practice.
Wait. Does this involve converting from non-multiparts to multiparts? If so, ignore my suggestion!
Going to propose another one: writeToNBT the tile entity before setting the block state, then readFromNBT it to restore it. This is a bit slower, but guaranteed to avoid setBlockState side effects.
Yep, this is for converting into multiparts.
Going to propose another one: writeToNBT the tile entity before setting the block state, then readFromNBT it to restore it. This is a bit slower, but guaranteed to avoid setBlockState side effects.
That assumes the only use case for this workaround is TE persistance, while breakBlock can do virtually anything (not only TE stuff).
@raoulvdberge Fair point.
Fixes #112 by setting the new block state (Multipart) into Chunk's storage arrays before calling setBlockState, thus causing it not to call breakBlock on the old block.