Skip poi folders for snapshot restores.

New to 1.14, Mojang stores .mca files which don't contain chunks in the
poi folder.

Note: we explicitly filter *out* the poi folder, instead of filtering
*to* the regions folder, since old versions of minecraft had regions
directly in the world folder (instead of a regions subfolder).
This commit is contained in:
wizjany 2019-06-12 21:51:22 -04:00
parent efb7650d6f
commit 6f7927bc5a
4 changed files with 12 additions and 6 deletions

View File

@ -1307,14 +1307,16 @@ public class EditSession implements Extent, AutoCloseable {
checkNotNull(origin);
checkArgument(radius >= 0, "radius >= 0 required");
Mask waterloggedMask = null;
if (waterlogged) {
Map<String, String> stateMap = new HashMap<>();
stateMap.put("waterlogged", "true");
waterloggedMask = new BlockStateMask(this, stateMap, true);
}
MaskIntersection mask = new MaskIntersection(
new BoundedHeightMask(0, getWorld().getMaxY()),
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
waterlogged ? new MaskUnion(
getWorld().createLiquidMask(),
new BlockStateMask(this, new HashMap<String, String>() {{
put("waterlogged", "true");
}}, true))
waterlogged ? new MaskUnion(getWorld().createLiquidMask(), waterloggedMask)
: getWorld().createLiquidMask());
BlockReplace replace;

View File

@ -133,7 +133,9 @@ public class SnapshotUtilCommands {
if (restore.hadTotalFailure()) {
String error = restore.getLastErrorMessage();
if (error != null) {
if (!restore.getMissingChunks().isEmpty()) {
player.printError("Chunks were not present in snapshot.");
} else if (error != null) {
player.printError("Errors prevented any blocks from being restored.");
player.printError("Last error: " + error);
} else {

View File

@ -101,6 +101,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
// Check for file
if (pattern.matcher(testEntry.getName()).matches()) {
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/'));
if (folder.endsWith("poi")) continue;
name = folder + "/" + name;
break;
}

View File

@ -87,6 +87,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
if (testEntry.getName().startsWith(worldName + "/")) {
if (pattern.matcher(testEntry.getName()).matches()) { // does entry end in .mca
folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/'));
if (folder.endsWith("poi")) continue;
name = folder + "/" + name;
break;
}