Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +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;
|
||||
final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
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();
|
||||
if (dataFixer != null) {
|
||||
return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level"));
|
||||
|
@ -78,7 +78,7 @@ public abstract class McRegionChunkStore extends ChunkStore {
|
||||
throw new ChunkStoreException("CompoundTag expected for chunk; got " + tag.getClass().getName());
|
||||
}
|
||||
|
||||
return (CompoundTag)tag;
|
||||
return (CompoundTag) tag;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,14 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
|
||||
|
||||
ZipEntry entry = getEntry(name);
|
||||
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 {
|
||||
return zip.getInputStream(entry);
|
||||
@ -150,7 +157,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,14 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
|
||||
|
||||
ZipEntry entry = getEntry(name);
|
||||
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 {
|
||||
return zip.getInputStream(entry);
|
||||
@ -136,7 +143,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren