Some minor code cleanup

This commit is contained in:
Jesse Boyd 2017-03-31 06:46:05 +11:00
parent 5c6a5c48d1
commit b19402ae17
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 15 additions and 4 deletions

View File

@ -49,7 +49,6 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
private final HashMap<IntegerTrio, CompoundTag> nbtMap;
private final HashSet<ClipboardEntity> entities;
private final File file;
private final byte[] buffer;
private final BufferedRandomAccessFile raf;
private int last;
@ -62,7 +61,6 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
try {
nbtMap = new HashMap<>();
entities = new HashSet<>();
this.buffer = new byte[2];
this.file = file;
this.raf = new BufferedRandomAccessFile(file, "rw", 16);
raf.setLength(file.length());
@ -111,7 +109,6 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
nbtMap = new HashMap<>();
entities = new HashSet<>();
this.file = file;
this.buffer = new byte[2];
this.width = width;
this.height = height;
this.length = length;

View File

@ -192,7 +192,7 @@ public class Schematic {
extent.setBlock(mutable.getBlockX() + relx, mutable.getBlockY() + rely, mutable.getBlockZ() + relz, block);
return false;
}
}, (HasFaweQueue) (extent instanceof HasFaweQueue ? extent : null));
}, null);
Operations.completeBlindly(visitor);
}
// Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin)

View File

@ -42,6 +42,7 @@ import com.boydti.fawe.object.changeset.CPUOptimizedChangeSet;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.object.changeset.FaweChangeSet;
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.FastWorldEditExtent;
@ -79,6 +80,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.ChangeSetExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.MaskingExtent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.extent.world.SurvivalModeExtent;
import com.sk89q.worldedit.function.GroundFunction;
@ -378,6 +380,18 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
this(world, null, null, null, null, null, true, null, null, null, blockBag, eventBus, event);
}
/**
* Lazily copy a region
* @param region
* @return
*/
public BlockArrayClipboard lazyCopy(Region region) {
WorldCopyClipboard faweClipboard = new WorldCopyClipboard(this, region);
BlockArrayClipboard weClipboard = new BlockArrayClipboard(region, faweClipboard);
weClipboard.setOrigin(region.getMinimumPoint());
return weClipboard;
}
/**
* The limit for this specific edit (blocks etc)
* @return