From 7dc56863891b577603612b41adffc02d3bbf81ba Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 31 Dec 2024 11:25:00 +0100 Subject: [PATCH] Fixes... --- .../src/de/steamwar/core/WorldEditWrapper14.java | 9 ++++----- .../src/de/steamwar/core/WorldEditWrapper18.java | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java index ca96d554..6f5d0ffc 100644 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java +++ b/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java @@ -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(); diff --git a/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java b/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java index b381ecf7..1c674150 100644 --- a/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java +++ b/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java @@ -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"); }