Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-07 00:22:51 +02:00
Fixed up tile entities in Sponge schematics.
Dieser Commit ist enthalten in:
Ursprung
b2769befdb
Commit
38cff7c7b2
@ -73,7 +73,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
||||
|
||||
// Check
|
||||
Map<String, Tag> schematic = schematicTag.getValue();
|
||||
if (!schematic.containsKey("Blocks")) {
|
||||
if (!schematic.containsKey("Materials")) {
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -110,18 +110,18 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
throw new IOException("Invalid offset specified in schematic.");
|
||||
}
|
||||
|
||||
Vector offset = new Vector(offsetParts[0], offsetParts[1], offsetParts[2]);
|
||||
Vector min = new Vector(offsetParts[0], offsetParts[1], offsetParts[2]);
|
||||
|
||||
if (metadata.containsKey("WEOriginX")) {
|
||||
if (metadata.containsKey("WEOffsetX")) {
|
||||
// We appear to have WorldEdit Metadata
|
||||
int originX = requireTag(metadata, "WEOriginX", IntTag.class).getValue();
|
||||
int originY = requireTag(metadata, "WEOriginY", IntTag.class).getValue();
|
||||
int originZ = requireTag(metadata, "WEOriginZ", IntTag.class).getValue();
|
||||
Vector min = new Vector(originX, originY, originZ);
|
||||
int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
|
||||
int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
|
||||
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));
|
||||
} else {
|
||||
origin = Vector.ZERO.subtract(offset);
|
||||
origin = min;
|
||||
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE));
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
|
||||
for (Map<String, Tag> tileEntity : tileEntityTags) {
|
||||
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
||||
tileEntitiesMap.put(new BlockVector(pos[0], pos[1], pos[2]), tileEntity);
|
||||
tileEntitiesMap.put(origin.add(new BlockVector(pos[0], pos[1], pos[2])).toBlockVector(), tileEntity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IOException("Failed to load Tile Entities: " + e.getMessage());
|
||||
|
@ -97,9 +97,9 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
schematic.put("Version", new IntTag(1));
|
||||
|
||||
Map<String, Tag> metadata = new HashMap<>();
|
||||
metadata.put("WEOriginX", new IntTag(min.getBlockX()));
|
||||
metadata.put("WEOriginY", new IntTag(min.getBlockY()));
|
||||
metadata.put("WEOriginZ", new IntTag(min.getBlockZ()));
|
||||
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));
|
||||
|
||||
@ -107,10 +107,11 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
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[]{
|
||||
offset.getBlockX(),
|
||||
offset.getBlockY(),
|
||||
offset.getBlockZ(),
|
||||
min.getBlockX(),
|
||||
min.getBlockY(),
|
||||
min.getBlockZ(),
|
||||
}));
|
||||
|
||||
int paletteMax = 0;
|
||||
@ -136,9 +137,9 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
|
||||
values.put("Id", new StringTag(block.getNbtId()));
|
||||
values.put("Pos", new IntArrayTag(new int[]{
|
||||
point.getBlockX(),
|
||||
point.getBlockY(),
|
||||
point.getBlockZ()
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}));
|
||||
|
||||
CompoundTag tileEntityTag = new CompoundTag(values);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren