3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Restore ability to restore old MCRegion files.

Dieser Commit ist enthalten in:
wizjany 2019-06-06 10:34:12 -04:00
Ursprung 1b4ea528ea
Commit 351fd6771a
4 geänderte Dateien mit 20 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -109,7 +109,7 @@ public abstract class ChunkStore implements Closeable {
if (dataVersion == 0) dataVersion = -1; if (dataVersion == 0) dataVersion = -1;
final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING); final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING);
final int currentDataVersion = platform.getDataVersion(); final int currentDataVersion = platform.getDataVersion();
if (dataVersion < currentDataVersion) { if (tag.getValue().containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks
final DataFixer dataFixer = platform.getDataFixer(); final DataFixer dataFixer = platform.getDataFixer();
if (dataFixer != null) { if (dataFixer != null) {
return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level")); return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level"));

Datei anzeigen

@ -78,7 +78,7 @@ public abstract class McRegionChunkStore extends ChunkStore {
throw new ChunkStoreException("CompoundTag expected for chunk; got " + tag.getClass().getName()); throw new ChunkStoreException("CompoundTag expected for chunk; got " + tag.getClass().getName());
} }
return (CompoundTag)tag; return (CompoundTag) tag;
} }
} }

Datei anzeigen

@ -115,7 +115,14 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
ZipEntry entry = getEntry(name); ZipEntry entry = getEntry(name);
if (entry == null) { if (entry == null) {
throw new MissingChunkException(); if (name.endsWith(".mca")) { // try old mcr format
entry = getEntry(name.replace(".mca", ".mcr"));
if (entry == null) {
throw new MissingChunkException();
}
} else {
throw new MissingChunkException();
}
} }
try { try {
return zip.getInputStream(entry); return zip.getInputStream(entry);
@ -150,7 +157,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
ZipEntry testEntry = e.nextElement(); ZipEntry testEntry = e.nextElement();
if (testEntry.getName().matches(".*\\.mcr$") || testEntry.getName().matches(".*\\.mca$")) { // TODO: does this need a separate class? if (testEntry.getName().matches(".*\\.mcr$") || testEntry.getName().matches(".*\\.mca$")) {
return true; return true;
} }
} }

Datei anzeigen

@ -102,7 +102,14 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
ZipEntry entry = getEntry(name); ZipEntry entry = getEntry(name);
if (entry == null) { if (entry == null) {
throw new MissingChunkException(); if (name.endsWith(".mca")) { // try old mcr format
entry = getEntry(name.replace(".mca", ".mcr"));
if (entry == null) {
throw new MissingChunkException();
}
} else {
throw new MissingChunkException();
}
} }
try { try {
return zip.getInputStream(entry); return zip.getInputStream(entry);
@ -136,7 +143,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
ZipEntry testEntry = e.nextElement(); ZipEntry testEntry = e.nextElement();
if (testEntry.getName().matches(".*\\.mcr$") || testEntry.getName().matches(".*\\.mca$")) { // TODO: does this need a separate class? if (testEntry.getName().matches(".*\\.mcr$") || testEntry.getName().matches(".*\\.mca$")) {
return true; return true;
} }
} }