3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 11:00:05 +01:00

Use BlockVectorSet

Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-06 01:01:05 +11:00
Ursprung f7cdae5e56
Commit 9e2832c273
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
4 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions;
import com.boydti.fawe.object.collection.BlockVectorSet;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
@ -181,7 +182,7 @@ public abstract class AbstractRegion implements Region {
@Override @Override
public Set<BlockVector3> getChunkCubes() { public Set<BlockVector3> getChunkCubes() {
final Set<BlockVector3> chunks = new HashSet<>(); final Set<BlockVector3> chunks = new BlockVectorSet();
final BlockVector3 min = getMinimumPoint(); final BlockVector3 min = getMinimumPoint();
final BlockVector3 max = getMaximumPoint(); final BlockVector3 max = getMaximumPoint();

Datei anzeigen

@ -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.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; 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.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.MutableBlockVector3;
@ -371,7 +373,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
} }
@Override @Override
public Set<BlockVector3> getChunkCubes() { public Set<BlockVector3> getChunkCubes() {
Set<BlockVector3> chunks = new HashSet<>(); Set<BlockVector3> chunks = new BlockVectorSet();
BlockVector3 min = getMinimumPoint(); BlockVector3 min = getMinimumPoint();
BlockVector3 max = getMaximumPoint(); BlockVector3 max = getMaximumPoint();

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.world.snapshot; package com.sk89q.worldedit.world.snapshot;
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
@ -35,13 +36,14 @@ import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* A snapshot restore operation. * A snapshot restore operation.
*/ */
public class SnapshotRestore { 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 ChunkStore chunkStore;
private final EditSession editSession; private final EditSession editSession;
private ArrayList<BlockVector2> missingChunks; private ArrayList<BlockVector2> missingChunks;
@ -108,7 +110,7 @@ public class SnapshotRestore {
// Unidentified chunk // Unidentified chunk
if (!neededChunks.containsKey(chunkPos)) { if (!neededChunks.containsKey(chunkPos)) {
neededChunks.put(chunkPos, new ArrayList<>()); neededChunks.put(chunkPos, new LocalBlockVectorSet());
} }
neededChunks.get(chunkPos).add(pos); neededChunks.get(chunkPos).add(pos);
@ -134,7 +136,7 @@ public class SnapshotRestore {
errorChunks = new ArrayList<>(); errorChunks = new ArrayList<>();
// Now let's start restoring! // 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(); BlockVector2 chunkPos = entry.getKey();
Chunk chunk; Chunk chunk;