Hi ! I want to generate asynchronously a custom structure in sort of array of blocks and then merge in the world once the work is done. With Bukkit, I was using my own class, but with Sponge, I saw there is a MutableBlockVolume
class, it seems to be the class I need.
I want to know, how to create a new empty MutableBlockVolume
, edit blocks (async) and then merge with a world.
I hope I was clear, english isn’t my native language.
Can someone help me ?
Sponge.getRegistry.getExtentBufferFactory.createBlockBuffer(5,5,5) Should do the trick.
There isn’t any proper async support yet, but it’s planned.
Thank !
If I only use one thread to edit the volume, it should work ?
Yeah. You should also look at getBlockWorker()
, you can probably implement some of your operations using the methods provided by that class. This will also make converting back to multithreading simpler once I add support for multithreaded block workers (as long as you don’t really on state).