05-16-2017, 07:41 AM
The WorldEdit plugin has a //copy and //paste commands that basically do what you want to do.
Simply put, you need to create a cBlockArea object, Read data into it (from within a cWorld:ChunkStay() to make sure the chunks are loaded) and then Write() it to the destination, again in a cWorld:ChunkStay(). Note that it's a bad idea to call a ChunkStay from another world's ChunkStay handler, because that could result in a deadlock. Use cWorld:QueueTask on the second world to avoid the deadlock.
Simply put, you need to create a cBlockArea object, Read data into it (from within a cWorld:ChunkStay() to make sure the chunks are loaded) and then Write() it to the destination, again in a cWorld:ChunkStay(). Note that it's a bad idea to call a ChunkStay from another world's ChunkStay handler, because that could result in a deadlock. Use cWorld:QueueTask on the second world to avoid the deadlock.
local ba = cBlockArea() srcWorld:ChunkStay(chunkCoords, nil, function() ba:Read(srcWorld, ...) dstWorld:QueueTask( function() ba:Write(dstWorld, ...) ba:Clear() end ) end )