**Add a null-check to CharBlocks FULL section layer-retrieval.**
- It is possible to trim CharBlocks whilst it is attempting to read data due to the batching of chunks to help reduce memory
- This is done when the number of chunks sitting loaded in memory with having been "submitted" to the queue for writing to disk becomes high
- Seconday operations such as heightmap processing and lighting will quickly load chunks, meaning many chunks are submitted early
- This leads to much higher chances of the chunk being submitted and subsequently trimmed given heightmap and light processing is done layer-by-layer over many chunks, rather than chunk-by-chunk - thus leading to NPEs.
- By adding synchronisation to and around only the specific sections when loading/updating, and not blocking the whole chunk, many access can still be thread-safe without causing deadlocks
- This allows removal of lots of the needless and very-slowing synchronisation on get**Block** methods
**Remove much of the synchronisation from ChunkHolder**
- We shouldn't be synchronising with call() and safety should be added elsewhere. (plus it's making edits very very slow when queue target size is hit)
- Also remove much of synchronisation because we've added the null-check and section-specific synchronisation to CharBlocks
**Some QOL/thread-safe data access changes**
- Replaces the Array#clone seen in the get blocks classes with System#arraycopy as deep cloning is not required, and is also slower than arraycopy
- Add System#arraycopy when accessing chunk section data via history to ensure it is not altered whilst being written
- Renaming EMPTY to empty means it is not implied to be a static variable
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1028
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1025
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1089
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1091
Fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1097
* Use Unsafe to replace Lock
* Start cleaning up everything that has to do with CleanableThreadLocal
* Make cancellation work
Co-authored-by: NotMyFault <mc.cache@web.de>
* Relight using starlight engine on Tuinity
* Make use of invokeExact
* Cache MethodHandle
* Address some requested changes
* Remove random *
Co-authored-by: NotMyFault <mc.cache@web.de>
* Simplify and clean up sendChunk
Hopefully, that doesn't cause any issues
* Add naive HeightmapProcessor
* Make HeightmapProcessor more efficient
* Remove heightmap code from NMSRelighter
* Recognize fluid for waterlogged blocks
* Remove config option for heightmaps as they should always be updated
* Batch relighting for Starlight
* Dirty workaround for CharBlocks blocks NPE
* Revert "Dirty workaround for CharBlocks blocks NPE"
This reverts commit 737606a7
It only caused the heightmap to be wrong again and didn't help much with the original issue
* Adapt better chunk sending on older versions
* Adapt requested changes for HeightMapType
* Relight all changed chunks, batched
Also, address some requested changes
* Avoid deadlocks
* Clean up tuinity relighter and add some comments
* Minor changes to HeightmapProcessor
Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com>
Since there's no new NMS revision (we're still on R3...?!) but there were changes, it would be more difficult to maintain both 1.16.4 and 1.16.5. Therefore, let's just stop supporting 1.16.4 as 1.16.5 is a minor update regardless.
Fixes#859
- Add a "loadPrivately" method to be used when GetChunks are called to avoid synchronocity issues with super classes being used on different threads
- Synchronise the call method so we're not attempting to call whilst also loading/updating
- We don't want to flush if we're setting from the main thread, as that's going to be another plugin doing it
- It's better to have a concurrent error thrown than use a concurrent set, so concurrency issues can actually be fixed rather than handled unsafely
- Only send chunk packets up to once a tick (it really doesn't use any memory to cache IntPairs).
* Get rid of FastSchematicReader/Writer and document changed JNBT classes
This commit includes changes from upstream to the schematic classes
(`com.sk89q.worldedit.extent.clipboard.io`). It also documents the JNBT
classes, specifying what has been changed in FAWE. This was done in preparation
for the upcoming move to adventure-nbt.
The PlotSquared schematic handler classes will now use SpongeSchematicReader/Writer rather than FastSchematicReader/Writer.
This is yet untested and the entire branch is a W.I.P.
* Fix JNBT mutability misuse in FAWE
FAWE previously had mutable compound and list tags. The previous commit changed that, and this commit will fix misuse of the tag API.
I've tried to identify the places where mutability was assumed, but I might have missed something. This needs quite extensive testing.
This is yet another change which increases upstream compatibility in FAWE.
* Fix FAWE_Spigot_<..>#getEntity
* Fix JNBT usage in the AsyncBlockState code
* Readd FastSchematicReader/Writer and add a new schematic format (`FAST`)
* Update dead repository
* Implement missing AsyncChunk#getTileEntities
* handle entities properly and add "brokenentity" format
* Fix fast schematic reader
lazily reading means it's read in order of appearance in the inputstream so we need to read schematic version first (skip past everything) and then reset the stream
* Fix p2 FAWE
* Go back to fast schematics in P2/CompressedSchematicTag (#819)
* Fix compile
Co-authored-by: N0tMyFaultOG <mc.cache@web.de>
Co-authored-by: Alexander Söderberg <Sauilitired@users.noreply.github.com>
Co-authored-by: dordsor21 <dordsor21@gmail.com>
Co-authored-by: Aurora <aurora@relanet.eu>