Add schemvis create method

This commit is contained in:
Jesse Boyd 2018-08-13 16:09:33 +10:00
parent a3a28fe3de
commit 213207ab7b
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -39,6 +39,8 @@ import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.util.*;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* An Immutable virtual world used to display & select schematics
*/
@ -56,6 +58,18 @@ public class SchemVis extends ImmutableVirtualWorld {
private final BlockVector2D chunkOffset;
private BlockVector2D lastPosition;
public static SchemVis create(FawePlayer player, Collection<File> files) throws IOException {
checkNotNull(player);
checkNotNull(files);
SchemVis visExtent = new SchemVis(player);
for (File file : files) {
visExtent.add(file);
}
visExtent.bind();
visExtent.update();
return visExtent;
}
public SchemVis(FawePlayer player) {
this.files = new Long2ObjectOpenHashMap<>();
this.chunks = new Long2ObjectOpenHashMap<>();