From 9e2832c273c8ad7f947533db43d1d5efa5d4ef1b Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 6 Apr 2019 01:01:05 +1100 Subject: [PATCH] Use BlockVectorSet --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 2 +- .../java/com/sk89q/worldedit/regions/AbstractRegion.java | 3 ++- .../java/com/sk89q/worldedit/regions/CuboidRegion.java | 4 +++- .../sk89q/worldedit/world/snapshot/SnapshotRestore.java | 8 +++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index bc459da25..d71e2e42e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -3321,7 +3321,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, } private void recurseHollow(Region region, BlockVector3 origin, Set outside) { - final BlockVectorSet queue = new BlockVectorSet(); + final LocalBlockVectorSet queue = new LocalBlockVectorSet(); while (!queue.isEmpty()) { Iterator iter = queue.iterator(); while (iter.hasNext()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java index 66b3028e5..af136464e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.regions; +import com.boydti.fawe.object.collection.BlockVectorSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; @@ -181,7 +182,7 @@ public abstract class AbstractRegion implements Region { @Override public Set getChunkCubes() { - final Set chunks = new HashSet<>(); + final Set chunks = new BlockVectorSet(); final BlockVector3 min = getMinimumPoint(); final BlockVector3 max = getMaximumPoint(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 17b4c87a0..5d6da1301 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -24,6 +24,8 @@ import com.boydti.fawe.config.Settings; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import com.boydti.fawe.object.collection.BlockVectorSet; +import com.boydti.fawe.object.collection.LocalBlockVectorSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MutableBlockVector3; @@ -371,7 +373,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } @Override public Set getChunkCubes() { - Set chunks = new HashSet<>(); + Set chunks = new BlockVectorSet(); BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java index c5b134c62..28404f30e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.world.snapshot; +import com.boydti.fawe.object.collection.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.math.BlockVector2; @@ -35,13 +36,14 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Set; /** * A snapshot restore operation. */ public class SnapshotRestore { - private final Map> neededChunks = new LinkedHashMap<>(); + private final Map> neededChunks = new LinkedHashMap<>(); private final ChunkStore chunkStore; private final EditSession editSession; private ArrayList missingChunks; @@ -108,7 +110,7 @@ public class SnapshotRestore { // Unidentified chunk if (!neededChunks.containsKey(chunkPos)) { - neededChunks.put(chunkPos, new ArrayList<>()); + neededChunks.put(chunkPos, new LocalBlockVectorSet()); } neededChunks.get(chunkPos).add(pos); @@ -134,7 +136,7 @@ public class SnapshotRestore { errorChunks = new ArrayList<>(); // Now let's start restoring! - for (Map.Entry> entry : neededChunks.entrySet()) { + for (Map.Entry> entry : neededChunks.entrySet()) { BlockVector2 chunkPos = entry.getKey(); Chunk chunk;