This commit is contained in:
2024-12-31 11:25:00 +01:00
parent ec5382316a
commit 7dc5686389
2 changed files with 6 additions and 6 deletions
@@ -389,7 +389,7 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
inputStream.close();
}
}
private static class SpongeSchematicReader extends NBTSchematicReader {
public static class SpongeSchematicReader extends NBTSchematicReader {
private final NBTInputStream inputStream;
private DataFixer fixer = null;
@@ -420,7 +420,7 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
dataVersion = 1631; // this is a relatively safe assumption unless someone imports a schematic from 1.12, e.g. sponge 7.1-
fixer = platform.getDataFixer();
return readVersion1(schematicTag);
} else if (schematicVersion == 2) {
} else if (schematicVersion == 2 || schematicVersion == 3) {
dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue();
if (dataVersion < liveDataVersion) {
fixer = platform.getDataFixer();
@@ -449,9 +449,6 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
private CompoundTag getBaseTag() throws IOException {
NamedTag rootTag = inputStream.readNamedTag();
if (!rootTag.getName().equals("Schematic")) {
throw new IOException("Tag 'Schematic' does not exist or is not first");
}
CompoundTag schematicTag = (CompoundTag) rootTag.getTag();
// Check
@@ -460,6 +457,8 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
if (schematic.size() == 1) {
schematicTag = requireTag(schematic, "Schematic", CompoundTag.class);
schematic = schematicTag.getValue();
} else if (!rootTag.getName().equals("Schematic")) {
throw new IOException("Tag 'Schematic' does not exist or is not first");
}
schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue();
@@ -40,7 +40,8 @@ public class WorldEditWrapper18 extends WorldEditWrapper14 {
case MCEDIT:
return new MCEditSchematicReader(nbtStream).read();
case SPONGE_V2:
return new SpongeSchematicReader(nbtStream).read();
case SPONGE_V3:
return new WorldEditWrapper14.SpongeSchematicReader(nbtStream).read();
default:
throw new IllegalArgumentException("Unsupported schematic format");
}