geforkt von Mirrors/FastAsyncWorldEdit
put MCEdit before sponge and query by file extension.
Massively reduces loading time a few addon plugins that are literally only trying to get the format of a schematic
Dieser Commit ist enthalten in:
Ursprung
ddb41a9669
Commit
74a2f02003
@ -86,6 +86,34 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Schematic format used by MCEdit.
|
||||||
|
*/
|
||||||
|
MCEDIT_SCHEMATIC("mcedit", "mce", "schematic") {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPrimaryFileExtension() {
|
||||||
|
return "schematic";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClipboardReader getReader(InputStream inputStream) throws IOException {
|
||||||
|
NBTInputStream nbtStream = new NBTInputStream(new GZIPInputStream(inputStream));
|
||||||
|
return new MCEditSchematicReader(nbtStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
||||||
|
throw new IOException("This format does not support saving");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFormat(File file) {
|
||||||
|
String name = file.getName().toLowerCase(Locale.ROOT);
|
||||||
|
return name.endsWith(".schematic") || name.endsWith(".mcedit") || name.endsWith(".mce");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
SPONGE_SCHEMATIC("sponge", "schem") {
|
SPONGE_SCHEMATIC("sponge", "schem") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -126,48 +154,6 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* The Schematic format used by MCEdit.
|
|
||||||
*/
|
|
||||||
MCEDIT_SCHEMATIC("mcedit", "mce", "schematic") {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPrimaryFileExtension() {
|
|
||||||
return "schematic";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ClipboardReader getReader(InputStream inputStream) throws IOException {
|
|
||||||
NBTInputStream nbtStream = new NBTInputStream(new GZIPInputStream(inputStream));
|
|
||||||
return new MCEditSchematicReader(nbtStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
|
||||||
throw new IOException("This format does not support saving");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFormat(File file) {
|
|
||||||
try (NBTInputStream str = new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))) {
|
|
||||||
NamedTag rootTag = str.readNamedTag();
|
|
||||||
if (!rootTag.getName().equals("Schematic")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CompoundTag schematicTag = (CompoundTag) rootTag.getTag();
|
|
||||||
|
|
||||||
// Check
|
|
||||||
Map<String, Tag> schematic = schematicTag.getValue();
|
|
||||||
if (!schematic.containsKey("Materials")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
BROKENENTITY("brokenentity", "legacyentity", "le", "be", "brokenentities", "legacyentities") {
|
BROKENENTITY("brokenentity", "legacyentity", "le", "be", "brokenentities", "legacyentities") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren