Closed EwyBoy closed 2 years ago
Using BlockEntity#saveAdditional
instead of BlockEntity#save
seems to do the trick for me.
That also appears to be the way vanilla BlockEntity
's save their data.
Apart from that, just be sure to call BlockEntity#setChanged
. If it's not called, the world thinks the chunk hasn't changed and thus it isn't "rewritten" to disk.
This would match your explanation as placing another block would cause the chunk to be saved again, thus the first tank would be saved when the second tank is placed and the second tank does not get saved.
Thank you I will give this a try.
That seems to do the trick. Thank you! Closing this now.
Version Info
1.18
https://github.com/SuperMartijn642/SuperMartijn642sCoreLib/blob/56d1c373f2b351438133e74880226b55b26564c7/src/main/java/com/supermartijn642/core/block/BaseTileEntity.java#L63-L70
Description of the Bug See #3 Tanks do not retain fluid after saving world