From 113e340474c3c33da94f885b81a029a07b33aa60 Mon Sep 17 00:00:00 2001 From: rycbar0 Date: Mon, 26 Sep 2022 16:09:41 +0200 Subject: [PATCH] version check added --- .../schematic/format/DefaultSchematicFormats.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java b/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java index 6cea77fe..de142b39 100644 --- a/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java +++ b/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java @@ -74,7 +74,17 @@ public enum DefaultSchematicFormats implements ISchematicFormat { Litematica("litematic") { @Override public IStaticSchematic parse(InputStream input) throws IOException { - return new LitematicaSchematic(CompressedStreamTools.readCompressed(input)); + NBTTagCompound nbt = CompressedStreamTools.readCompressed(input); + int version = nbt.getInteger("Version"); + switch (version) { + case 4: + return new LitematicaSchematic(nbt); + case 5: + case 6: + throw new UnsupportedOperationException("This Schematic Verion is to new."); + default: + throw new UnsupportedOperationException("Unsuported Version of a Litematica Schematic"); + } } };