Permalink
Browse files

Merge pull request #423 from Gerrygames/master

fix sponge schematic offset
  • Loading branch information...
me4502 committed Sep 10, 2018
2 parents 2521a9a + 934680d commit 6a71cd21551f79c55a01ff8e791618351624dc01
@@ -119,7 +119,7 @@ private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
Vector offset = new Vector(offsetX, offsetY, offsetZ);
origin = min.subtract(offset);
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE));
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
} else {
origin = min;
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE));
@@ -160,7 +160,7 @@ private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
for (Map<String, Tag> tileEntity : tileEntityTags) {
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
tileEntitiesMap.put(origin.add(new BlockVector(pos[0], pos[1], pos[2])).toBlockVector(), tileEntity);
tileEntitiesMap.put(new BlockVector(pos[0], pos[1], pos[2]).toBlockVector(), tileEntity);
}
} catch (Exception e) {
throw new IOException("Failed to load Tile Entities: " + e.getMessage());
@@ -189,9 +189,9 @@ private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
i++;
}
// index = (y * length + z) * width + x
int y = origin.getBlockY() + index / (width * length);
int z = origin.getBlockZ() + (index % (width * length)) / width;
int x = origin.getBlockX() + (index % (width * length)) % width;
int y = index / (width * length);
int z = (index % (width * length)) / width;
int x = (index % (width * length)) % width;
BlockState state = palette.get(value);
BlockVector pt = new BlockVector(x, y, z);
try {
@@ -208,9 +208,9 @@ private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
values.put("id", values.get("Id"));
values.remove("Id");
values.remove("Pos");
clipboard.setBlock(pt, state.toBaseBlock(new CompoundTag(values)));
clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(values)));
} else {
clipboard.setBlock(pt, state);
clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state);
}
} catch (WorldEditException e) {
throw new IOException("Failed to load a block in the schematic");

0 comments on commit 6a71cd2

Please sign in to comment.