Open dktapps opened 5 years ago
This could be solved by implementing a BlockCacheRecord
which records the fullID of the block, alongside the block object that's supposed to represent it. If the block object's fullID doesn't match the recorded ID, we throw it away and get a new one from BlockFactory. However, this would come at a minor performance cost.
Issue description
Blocks are cached at the world level to improve performance of accesses. This is problematic because
getBlock()
does not clone or remove blocks from the cache, so if they are modified without setting them back into the world, the block cache becomes corrupted.This has been seen in the past when plugin devs modify the meta values of things like wool expecting to see a different colour - it sort-of works if you click on it totrigger block updates, but the changes don't save.
getBlock()
should have no effect on the world or its block cacheSteps to reproduce the issue
OS and versions