geforkt von Mirrors/FastAsyncWorldEdit
Offsets are now saved with .schematic files.
Dieser Commit ist enthalten in:
Ursprung
cc9d639afb
Commit
7f2391649e
@ -227,6 +227,9 @@ public class CuboidClipboard {
|
|||||||
schematic.put("WEOriginX", new IntTag("WEOriginX", getOrigin().getBlockX()));
|
schematic.put("WEOriginX", new IntTag("WEOriginX", getOrigin().getBlockX()));
|
||||||
schematic.put("WEOriginY", new IntTag("WEOriginY", getOrigin().getBlockY()));
|
schematic.put("WEOriginY", new IntTag("WEOriginY", getOrigin().getBlockY()));
|
||||||
schematic.put("WEOriginZ", new IntTag("WEOriginZ", getOrigin().getBlockZ()));
|
schematic.put("WEOriginZ", new IntTag("WEOriginZ", getOrigin().getBlockZ()));
|
||||||
|
schematic.put("WEOffsetX", new IntTag("WEOffsetX", getOffset().getBlockX()));
|
||||||
|
schematic.put("WEOffsetY", new IntTag("WEOffsetY", getOffset().getBlockY()));
|
||||||
|
schematic.put("WEOffsetZ", new IntTag("WEOffsetZ", getOffset().getBlockZ()));
|
||||||
|
|
||||||
// Copy
|
// Copy
|
||||||
byte[] blocks = new byte[width * height * length];
|
byte[] blocks = new byte[width * height * length];
|
||||||
@ -289,6 +292,7 @@ public class CuboidClipboard {
|
|||||||
NBTInputStream nbtStream = new NBTInputStream(stream);
|
NBTInputStream nbtStream = new NBTInputStream(stream);
|
||||||
|
|
||||||
Vector origin = new Vector();
|
Vector origin = new Vector();
|
||||||
|
Vector offset = new Vector();
|
||||||
|
|
||||||
// Schematic tag
|
// Schematic tag
|
||||||
CompoundTag schematicTag = (CompoundTag)nbtStream.readTag();
|
CompoundTag schematicTag = (CompoundTag)nbtStream.readTag();
|
||||||
@ -316,6 +320,15 @@ public class CuboidClipboard {
|
|||||||
// No origin data
|
// No origin data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
int offsetX = (Integer)getChildTag(schematic, "WEOffsetX", IntTag.class).getValue();
|
||||||
|
int offsetY = (Integer)getChildTag(schematic, "WEOffsetY", IntTag.class).getValue();
|
||||||
|
int offsetZ = (Integer)getChildTag(schematic, "WEOffsetZ", IntTag.class).getValue();
|
||||||
|
offset = new Vector(offsetX, offsetY, offsetZ);
|
||||||
|
} catch (DataException e) {
|
||||||
|
// No offset data
|
||||||
|
}
|
||||||
|
|
||||||
// Check type of Schematic
|
// Check type of Schematic
|
||||||
String materials = (String)getChildTag(schematic, "Materials", StringTag.class).getValue();
|
String materials = (String)getChildTag(schematic, "Materials", StringTag.class).getValue();
|
||||||
if (!materials.equals("Alpha")) {
|
if (!materials.equals("Alpha")) {
|
||||||
@ -367,6 +380,7 @@ public class CuboidClipboard {
|
|||||||
Vector size = new Vector(width, height, length);
|
Vector size = new Vector(width, height, length);
|
||||||
CuboidClipboard clipboard = new CuboidClipboard(size);
|
CuboidClipboard clipboard = new CuboidClipboard(size);
|
||||||
clipboard.setOrigin(origin);
|
clipboard.setOrigin(origin);
|
||||||
|
clipboard.setOffset(offset);
|
||||||
|
|
||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
@ -434,4 +448,18 @@ public class CuboidClipboard {
|
|||||||
public void setOrigin(Vector origin) {
|
public void setOrigin(Vector origin) {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the offset
|
||||||
|
*/
|
||||||
|
public Vector getOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param origin the offset to set
|
||||||
|
*/
|
||||||
|
public void setOffset(Vector offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren