Leaf
Leaf copied to clipboard
Remove buffering in CraftBlock getNMS and getNMSFluid
Did as requested. Honestly, I'd recommend preferably doing a little context analysis of the internal calls before actually merging.
For context, calls involved in getNMS include:
- Retrieving a Chunk in
net.minecraft.world.level.Level#getBlockStateusingnet.minecraft.world.level.Level#getChunk. - If the Chunk is not loaded, it will fallback using
net.minecraft.world.level.ServerChunkCache#getChunkFallback. - If the fallback fails to load the chunk asynchronously, it will schedule the load in the main thread and will force the async thread to wait using
net.minecraft.world.level.ServerChunkCache#syncLoad.
If there were a lock, syncLoad can become troublesome, but seems like this is not the case on Leaf as it was on Fish.
Still, a little bit more research will be required to see if every buffered call to functions in CraftBlock that internally call getNMS are actually safe and free of possible deadlocks.