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:
Ursprung
1b4ea528ea
Commit
351fd6771a
@ -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"));
|
||||||
|
@ -114,9 +114,16 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZipEntry entry = getEntry(name);
|
ZipEntry entry = getEntry(name);
|
||||||
|
if (entry == null) {
|
||||||
|
if (name.endsWith(".mca")) { // try old mcr format
|
||||||
|
entry = getEntry(name.replace(".mca", ".mcr"));
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
throw new MissingChunkException();
|
throw new MissingChunkException();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new MissingChunkException();
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return zip.getInputStream(entry);
|
return zip.getInputStream(entry);
|
||||||
} catch (ZipException e) {
|
} catch (ZipException e) {
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,16 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZipEntry entry = getEntry(name);
|
ZipEntry entry = getEntry(name);
|
||||||
|
if (entry == null) {
|
||||||
|
if (name.endsWith(".mca")) { // try old mcr format
|
||||||
|
entry = getEntry(name.replace(".mca", ".mcr"));
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
throw new MissingChunkException();
|
throw new MissingChunkException();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new MissingChunkException();
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return zip.getInputStream(entry);
|
return zip.getInputStream(entry);
|
||||||
} catch (ZipException e) {
|
} catch (ZipException e) {
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren