Use BlockArrayClipboard for schem load

This commit is contained in:
Jesse Boyd 2019-11-12 12:41:39 +00:00
parent cfa147cf76
commit ac6f4ae358
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 14 additions and 3 deletions

View File

@ -60,6 +60,13 @@ public class BlockArrayClipboard extends DelegateClipboard implements Clipboard,
this(region, UUID.randomUUID()); this(region, UUID.randomUUID());
} }
public BlockArrayClipboard(Clipboard clipboard, BlockVector3 offset) {
super(clipboard);
Region shifted = clipboard.getRegion();
shifted.shift(offset);
setRegion(shifted);
}
/** /**
* Create a new instance. * Create a new instance.
* *

View File

@ -218,10 +218,9 @@ public class SpongeSchematicReader extends NBTSchematicReader {
biomes = null; biomes = null;
BlockVector3 dimensions = BlockVector3.at(width, height, length); BlockVector3 dimensions = BlockVector3.at(width, height, length);
BlockVector3 origin = min; BlockVector3 origin = BlockVector3.ZERO;
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) { if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
// origin = origin.subtract(BlockVector3.at(offsetX, offsetY, offsetZ)); origin = BlockVector3.at(-offsetX, -offsetY, -offsetZ);
origin = BlockVector3.at(offsetX, offsetY, offsetZ);
} }
Clipboard clipboard = createOutput.apply(dimensions); Clipboard clipboard = createOutput.apply(dimensions);
@ -341,6 +340,11 @@ public class SpongeSchematicReader extends NBTSchematicReader {
} }
} }
clipboard.setOrigin(origin); clipboard.setOrigin(origin);
if (!min.equals(BlockVector3.ZERO)) {
new BlockArrayClipboard(clipboard, min);
}
return clipboard; return clipboard;
} }