Allow "post processing" of chunks (#658)

* begin allowing "post processing" of chunks
 - restores legacy capability to continue saving edits in the background after sending the chunks
 - speeds up the edit clientside
 - nail in the coffin of the terrible and staticly coded coreedit
 - We should totally make IronGolem work so Core* is no longer used by anyone

* begin allowing background history saving

* Handle post processors in queues properly

* Use futures for postprocessing so we're not waiting for them needlessly

* better use of closed boolean

* Reword
This commit is contained in:
dordsor21
2020-09-28 11:13:02 +01:00
committed by GitHub
parent 2aef0ee27e
commit 82bcc0e9a5
37 changed files with 811 additions and 18 deletions

View File

@ -10,6 +10,8 @@ import com.sk89q.worldedit.regions.Region;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
public class HeightBoundExtent extends FaweRegionExtent {
@ -51,4 +53,9 @@ public class HeightBoundExtent extends FaweRegionExtent {
}
return null;
}
@Override
public Future<IChunkSet> postProcessSet(IChunk chunk, IChunkGet get, IChunkSet set) {
return CompletableFuture.completedFuture(set);
}
}

View File

@ -10,6 +10,7 @@ import com.sk89q.worldedit.regions.RegionIntersection;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.Future;
public class MultiRegionExtent extends FaweRegionExtent {
@ -86,4 +87,9 @@ public class MultiRegionExtent extends FaweRegionExtent {
public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) {
return intersection.processSet(chunk, get, set);
}
@Override
public Future<IChunkSet> postProcessSet(IChunk chunk, IChunkGet get, IChunkSet set) {
return intersection.postProcessSet(chunk, get, set);
}
}

View File

@ -37,6 +37,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
//todo This should be removed in favor of com.sk89q.worldedit.extent.NullExtent
@ -340,6 +341,11 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
throw reason;
}
@Override
public Future<IChunkSet> postProcessSet(IChunk chunk, IChunkGet get, IChunkSet set) {
throw reason;
}
@Override
public boolean processGet(int chunkX, int chunkZ) {
throw reason;

View File

@ -9,6 +9,7 @@ import com.sk89q.worldedit.regions.Region;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.Future;
public class SingleRegionExtent extends FaweRegionExtent {
@ -44,6 +45,11 @@ public class SingleRegionExtent extends FaweRegionExtent {
return region.processSet(chunk, get, set);
}
@Override
public Future<IChunkSet> postProcessSet(IChunk chunk, IChunkGet get, IChunkSet set) {
return region.postProcessSet(chunk, get, set);
}
@Override
public boolean processGet(int chunkX, int chunkZ) {
return region.containsChunk(chunkX, chunkZ);