amadornes / MCMultiPart

A universal multipart API for Modern Minecraft
Other
67 stars 23 forks source link

Fix #112 #114

Closed 2xsaiko closed 6 years ago

2xsaiko commented 6 years ago

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.

asiekierka commented 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.

asiekierka commented 6 years ago

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.

2xsaiko commented 6 years ago

Yep, this is for converting into multiparts.

raoulvdberge commented 6 years ago

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).

asiekierka commented 6 years ago

@raoulvdberge Fair point.