Use BlockVectorSet

This commit is contained in:
Jesse Boyd 2019-04-06 01:01:05 +11:00
parent f7cdae5e56
commit 9e2832c273
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 11 additions and 6 deletions

View File

@ -3321,7 +3321,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
}
private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3> outside) {
final BlockVectorSet queue = new BlockVectorSet();
final LocalBlockVectorSet queue = new LocalBlockVectorSet();
while (!queue.isEmpty()) {
Iterator<BlockVector3> iter = queue.iterator();
while (iter.hasNext()) {

View File

@ -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<BlockVector3> getChunkCubes() {
final Set<BlockVector3> chunks = new HashSet<>();
final Set<BlockVector3> chunks = new BlockVectorSet();
final BlockVector3 min = getMinimumPoint();
final BlockVector3 max = getMaximumPoint();

View File

@ -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<BlockVector3> getChunkCubes() {
Set<BlockVector3> chunks = new HashSet<>();
Set<BlockVector3> chunks = new BlockVectorSet();
BlockVector3 min = getMinimumPoint();
BlockVector3 max = getMaximumPoint();

View File

@ -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<BlockVector2, ArrayList<BlockVector3>> neededChunks = new LinkedHashMap<>();
private final Map<BlockVector2, Set<BlockVector3>> neededChunks = new LinkedHashMap<>();
private final ChunkStore chunkStore;
private final EditSession editSession;
private ArrayList<BlockVector2> 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<BlockVector2, ArrayList<BlockVector3>> entry : neededChunks.entrySet()) {
for (Map.Entry<BlockVector2, Set<BlockVector3>> entry : neededChunks.entrySet()) {
BlockVector2 chunkPos = entry.getKey();
Chunk chunk;