https://linen.dev logo
The BitArray class is probably unchanged between 1...
# questions-and-help
c
The BitArray class is probably unchanged between 1.12 and 1.13, but there is a significant difference. In the BlockStateContainer class, there is a lock() method, which means it is no longer possible to write to the same subchunk concurrently. Furthermore, the lock() method has one terrible property. If it discovers that the blockstate container is concurrently written to, it will crash the thread that came second. Not all hope is lost though. Only write methods to the blockstate container are locked, which means we can still read on one thread and write on another. If a thread switch happens while one thread has just finished writing the first long but not the second, that position will be in the state available for a misread. This is only a temporary state where you can read a different blockstate out of a position though. To actually get the blockstate into the world permanently, you need a write operation. More specifically, you need an operation which reads a blockstate from the world (where we get the misread), and later write the blockstate back into the world in some way (where we solidify the misread as a real block in the world). The best such operations discovered so far are pistons and falling blocks, both of which have their limits. Both of which can be run only on the main thread, which means we need to do the write operation on the async thread. And as you can see, write operations on the async thread are very scarce, especially with ITT gone. A registry WT recipe has been found for nether portals at least, which can be used to create a nether portal in the end for falling block purposes. The only write operation you can do on an async thread to a gravity-affected block is solifying a concrete powder, and we will get to that in a bit.