Current Progress #3

This commit is contained in:
IronApollo
2019-01-09 02:13:44 -05:00
parent d4157b7e0e
commit 842b1307c7
221 changed files with 3173 additions and 3041 deletions

View File

@ -38,12 +38,12 @@ import com.google.gson.Gson;
import com.sk89q.jnbt.*;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -304,7 +304,7 @@ public enum ClipboardFormat {
// summary
// blocks
HashMap<String, Object> map = new HashMap<String, Object>();
Vector dimensions = clipboard.getDimensions();
BlockVector3 dimensions = clipboard.getDimensions();
map.put("width", dimensions.getX());
map.put("height", dimensions.getY());
map.put("length", dimensions.getZ());

View File

@ -31,6 +31,7 @@ import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
@ -225,7 +226,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
try {
if (state != null) {
if (tileEntitiesMap.containsKey(pt)) {
clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt))));
clipboard.setBlock(region.getMinimumPoint().add(pt), /*state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))*/new BaseBlock(state, new CompoundTag(tileEntitiesMap.get(pt))));
} else {
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
}

View File

@ -42,12 +42,7 @@ import com.sk89q.jnbt.NamedTag;
import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
<<<<<<< HEAD
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector;
=======
import com.sk89q.worldedit.WorldEdit;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.entity.BaseEntity;
@ -108,68 +103,214 @@ public class SpongeSchematicReader extends NBTSchematicReader {
return read(UUID.randomUUID());
}
<<<<<<< HEAD
@Override
public Clipboard read(UUID uuid) throws IOException {
return readVersion1(uuid);
}
=======
private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
BlockVector3 origin;
Region region;
Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
// private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
// BlockVector3 origin;
// Region region;
//
// Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
// }
private int width, height, length;
private int offsetX, offsetY, offsetZ;
private char[] palette;
private Vector min;
private BlockVector3 min;
private FaweClipboard fc;
private FaweClipboard setupClipboard(int size, UUID uuid) {
if (fc != null) {
if (fc.getDimensions().getX() == 0) {
fc.setDimensions(new Vector(size, 1, 1));
fc.setDimensions(new BlockVector3(size, 1, 1));
}
return fc;
}
<<<<<<< HEAD
if (Settings.IMP.CLIPBOARD.USE_DISK) {
return fc = new DiskOptimizedClipboard(size, 1, 1, uuid);
} else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) {
return fc = new CPUOptimizedClipboard(size, 1, 1);
} else {
return fc = new MemoryOptimizedClipboard(size, 1, 1);
=======
BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]);
if (metadata.containsKey("WEOffsetX")) {
// We appear to have WorldEdit Metadata
int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
origin = min.subtract(offset);
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
} else {
origin = min;
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
}
int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue();
Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
if (paletteObject.size() != paletteMax) {
throw new IOException("Differing given palette size to actual size");
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
}
// BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]);
//
// if (metadata.containsKey("WEOffsetX")) {
// // We appear to have WorldEdit Metadata
// int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
// int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
// int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
// BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
// origin = min.subtract(offset);
// region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
// } else {
// origin = min;
// region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
// }
//
// int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue();
// Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
// if (paletteObject.size() != paletteMax) {
// throw new IOException("Differing given palette size to actual size");
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
// private Clipboard readVersion1(UUID uuid) throws IOException {
// width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
//
// final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
// FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
// FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
//
// NBTStreamer streamer = new NBTStreamer(inputStream);
// streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
// streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
// streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
// streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
// streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
// streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
// streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
// streamer.addReader("Schematic.Palette", (BiConsumer<Integer, HashMap<String, Tag>>) (i, v) -> {
// palette = new char[v.size()];
// for (Map.Entry<String, Tag> entry : v.entrySet()) {
// BlockState state = BlockState.get(entry.getKey());
// int index = ((IntTag) entry.getValue()).getValue();
// palette[index] = (char) state.getOrdinal();
// }
//<<<<<<< HEAD
// });
// streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
// @Override
// public void accept(Integer arrayLen, DataInputStream dis) {
// try (FaweOutputStream blocks = new FaweOutputStream(new LZ4BlockOutputStream(blocksOut))) {
// IOUtil.copy(dis, blocks, arrayLen);
// } catch (IOException e) {
// e.printStackTrace();
// }
//=======
// palette.put(id, state);
// }
//
// byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
//
// Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
// try {
// List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
// .map(tag -> (CompoundTag) tag)
// .map(CompoundTag::getValue)
// .collect(Collectors.toList());
//
// for (Map<String, Tag> tileEntity : tileEntityTags) {
// int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
// tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity);
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
// }
// });
// streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
// @Override
// public void accept(Integer arrayLen, DataInputStream dis) {
// try (FaweOutputStream biomes = new FaweOutputStream(new LZ4BlockOutputStream(biomesOut))) {
// IOUtil.copy(dis, biomes, arrayLen);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// });
// streamer.addReader("Schematic.TileEntities.#", new BiConsumer<Integer, CompoundTag>() {
// @Override
// public void accept(Integer index, CompoundTag value) {
// if (fc == null) {
// setupClipboard(0, uuid);
// }
// int[] pos = value.getIntArray("Pos");
// int x = pos[0];
// int y = pos[1];
// int z = pos[2];
// fc.setTile(x, y, z, value);
// }
// });
// streamer.addReader("Schematic.Entities.#", new BiConsumer<Integer, CompoundTag>() {
// @Override
// public void accept(Integer index, CompoundTag compound) {
// if (fc == null) {
// setupClipboard(0, uuid);
// }
// String id = compound.getString("id");
// if (id.isEmpty()) {
// return;
// }
// ListTag positionTag = compound.getListTag("Pos");
// ListTag directionTag = compound.getListTag("Rotation");
// EntityType type = EntityTypes.parse(id);
// if (type != null) {
// compound.getValue().put("Id", new StringTag(type.getId()));
// BaseEntity state = new BaseEntity(type, compound);
// fc.createEntity(clipboard, positionTag.asDouble(0), positionTag.asDouble(1), positionTag.asDouble(2), (float) directionTag.asDouble(0), (float) directionTag.asDouble(1), state);
// } else {
// Fawe.debug("Invalid entity: " + id);
// }
// }
//<<<<<<< HEAD
// });
// streamer.readFully();
// if (fc == null) setupClipboard(length * width * height, uuid);
// Vector origin = min;
// CuboidRegion region;
// if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
// origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ));
// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
// } else {
// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
// }
// if (blocksOut.getSize() != 0) {
// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
// int volume = width * height * length;
// if (palette.length < 128) {
// for (int index = 0; index < volume; index++) {
// BlockState state = BlockTypes.states[palette[fis.read()]];
// fc.setBlock(index, state);
//=======
// // index = (y * length + z) * width + x
// int y = index / (width * length);
// int z = (index % (width * length)) / width;
// int x = (index % (width * length)) % width;
// BlockState state = palette.get(value);
// BlockVector3 pt = new BlockVector3(x, y, z);
// try {
// if (tileEntitiesMap.containsKey(pt)) {
// Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
// for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
// if (handler.isAffectedBlock(state)) {
// handler.updateNBT(state, values);
// }
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
// }
// } else {
// for (int index = 0; index < volume; index++) {
// BlockState state = BlockTypes.states[palette[fis.readVarInt()]];
// fc.setBlock(index, state);
// }
// }
// }
// }
// if (biomesOut.getSize() != 0) {
// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(biomesOut.toByteArrays())))) {
// int volume = width * length;
// for (int index = 0; index < volume; index++) {
// fc.setBiome(index, fis.read());
// }
// }
// }
// fc.setDimensions(new Vector(width, height, length));
// clipboard.init(region, fc);
// clipboard.setOrigin(origin);
// return clipboard;
// }
private Clipboard readVersion1(UUID uuid) throws IOException {
width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(0, 0, 0)), fc);
FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
@ -177,7 +318,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector3(v[0], v[1], v[2]));
streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
@ -188,7 +329,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
int index = ((IntTag) entry.getValue()).getValue();
palette[index] = (char) state.getOrdinal();
}
<<<<<<< HEAD
});
streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
@Override
@ -198,23 +338,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
} catch (IOException e) {
e.printStackTrace();
}
=======
palette.put(id, state);
}
byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
try {
List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
.map(tag -> (CompoundTag) tag)
.map(CompoundTag::getValue)
.collect(Collectors.toList());
for (Map<String, Tag> tileEntity : tileEntityTags) {
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
});
streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
@ -261,17 +384,16 @@ public class SpongeSchematicReader extends NBTSchematicReader {
Fawe.debug("Invalid entity: " + id);
}
}
<<<<<<< HEAD
});
streamer.readFully();
if (fc == null) setupClipboard(length * width * height, uuid);
Vector origin = min;
BlockVector3 origin = min;
CuboidRegion region;
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ));
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
origin = origin.subtract(new BlockVector3(offsetX, offsetY, offsetZ));
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
} else {
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
}
if (blocksOut.getSize() != 0) {
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
@ -280,21 +402,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
for (int index = 0; index < volume; index++) {
BlockState state = BlockTypes.states[palette[fis.read()]];
fc.setBlock(index, state);
=======
// index = (y * length + z) * width + x
int y = index / (width * length);
int z = (index % (width * length)) / width;
int x = (index % (width * length)) % width;
BlockState state = palette.get(value);
BlockVector3 pt = new BlockVector3(x, y, z);
try {
if (tileEntitiesMap.containsKey(pt)) {
Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
if (handler.isAffectedBlock(state)) {
handler.updateNBT(state, values);
}
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
} else {
for (int index = 0; index < volume; index++) {
@ -312,12 +419,13 @@ public class SpongeSchematicReader extends NBTSchematicReader {
}
}
}
fc.setDimensions(new Vector(width, height, length));
fc.setDimensions(new BlockVector3(width, height, length));
clipboard.init(region, fc);
clipboard.setOrigin(origin);
return clipboard;
}
@Override
public void close() throws IOException {
inputStream.close();

View File

@ -27,23 +27,14 @@ import com.sk89q.jnbt.NBTConstants;
import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
<<<<<<< HEAD
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
=======
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
<<<<<<< HEAD
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import net.jpountz.lz4.LZ4BlockInputStream;
import net.jpountz.lz4.LZ4BlockOutputStream;
=======
import com.sk89q.worldedit.world.block.BaseBlock;
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@ -83,15 +74,9 @@ public class SpongeSchematicWriter implements ClipboardWriter {
public void write1(Clipboard clipboard) throws IOException {
// metadata
Region region = clipboard.getRegion();
<<<<<<< HEAD
Vector origin = clipboard.getOrigin();
BlockVector min = region.getMinimumPoint().toBlockVector();
Vector offset = min.subtract(origin);
=======
BlockVector3 origin = clipboard.getOrigin();
BlockVector3 min = region.getMinimumPoint();
BlockVector3 offset = min.subtract(origin);
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
int width = region.getWidth();
int height = region.getHeight();
int length = region.getLength();
@ -104,7 +89,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
if (length > MAX_SIZE) {
throw new IllegalArgumentException("Length of region too large for a .schematic");
}
<<<<<<< HEAD
//<<<<<<< HEAD
// output
final DataOutput rawStream = outputStream.getOutputStream();
outputStream.writeLazyCompoundTag("Schematic", out -> {
@ -157,49 +142,49 @@ public class SpongeSchematicWriter implements ClipboardWriter {
}));
numTiles[0]++;
tilesOut.writeTagPayload(tile);
=======
Map<String, Tag> schematic = new HashMap<>();
schematic.put("Version", new IntTag(1));
Map<String, Tag> metadata = new HashMap<>();
metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
schematic.put("Metadata", new CompoundTag(metadata));
schematic.put("Width", new ShortTag((short) width));
schematic.put("Height", new ShortTag((short) height));
schematic.put("Length", new ShortTag((short) length));
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
schematic.put("Offset", new IntArrayTag(new int[]{
min.getBlockX(),
min.getBlockY(),
min.getBlockZ(),
}));
int paletteMax = 0;
Map<String, Integer> palette = new HashMap<>();
List<CompoundTag> tileEntities = new ArrayList<>();
ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
for (int y = 0; y < height; y++) {
int y0 = min.getBlockY() + y;
for (int z = 0; z < length; z++) {
int z0 = min.getBlockZ() + z;
for (int x = 0; x < width; x++) {
int x0 = min.getBlockX() + x;
BlockVector3 point = new BlockVector3(x0, y0, z0);
BaseBlock block = clipboard.getFullBlock(point);
if (block.getNbtData() != null) {
Map<String, Tag> values = new HashMap<>();
for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
values.put(entry.getKey(), entry.getValue());
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
//=======
//
// Map<String, Tag> schematic = new HashMap<>();
// schematic.put("Version", new IntTag(1));
//
// Map<String, Tag> metadata = new HashMap<>();
// metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
// metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
// metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
//
// schematic.put("Metadata", new CompoundTag(metadata));
//
// schematic.put("Width", new ShortTag((short) width));
// schematic.put("Height", new ShortTag((short) height));
// schematic.put("Length", new ShortTag((short) length));
//
// // The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
// schematic.put("Offset", new IntArrayTag(new int[]{
// min.getBlockX(),
// min.getBlockY(),
// min.getBlockZ(),
// }));
//
// int paletteMax = 0;
// Map<String, Integer> palette = new HashMap<>();
//
// List<CompoundTag> tileEntities = new ArrayList<>();
//
// ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
//
// for (int y = 0; y < height; y++) {
// int y0 = min.getBlockY() + y;
// for (int z = 0; z < length; z++) {
// int z0 = min.getBlockZ() + z;
// for (int x = 0; x < width; x++) {
// int x0 = min.getBlockX() + x;
// BlockVector3 point = new BlockVector3(x0, y0, z0);
// BaseBlock block = clipboard.getFullBlock(point);
// if (block.getNbtData() != null) {
// Map<String, Tag> values = new HashMap<>();
// for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
// values.put(entry.getKey(), entry.getValue());
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
}
int ordinal = block.getOrdinal();
char value = palette[ordinal];
@ -221,7 +206,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
if (clipboard instanceof BlockArrayClipboard) {
((BlockArrayClipboard) clipboard).IMP.forEach(reader, true);
} else {
for (Vector pt : region) {
for (BlockVector3 pt : region) {
BlockState block = clipboard.getBlock(pt);
int x = pt.getBlockX() - min.getBlockX();
int y = pt.getBlockY() - min.getBlockY();