Implement restoring biomes, entities, and extended world heights (#1316)

This commit is contained in:
Jordan
2021-10-17 14:40:55 +01:00
committed by GitHub
parent 27865dc785
commit 9c1c8bfdf2
19 changed files with 774 additions and 83 deletions

View File

@ -47,9 +47,16 @@ class LegacySnapshotUtilCommands {
this.we = we;
}
//FAWE start - biome and entity restore
void restore(
Actor actor, World world, LocalSession session, EditSession editSession,
String snapshotName
Actor actor,
World world,
LocalSession session,
EditSession editSession,
String snapshotName,
boolean restoreBiomes,
boolean restoreEntities
//FAWE end
) throws WorldEditException {
LocalConfiguration config = we.getConfiguration();
@ -108,8 +115,9 @@ class LegacySnapshotUtilCommands {
try {
// Restore snapshot
SnapshotRestore restore = new SnapshotRestore(chunkStore, editSession, region);
//player.print(restore.getChunksAffected() + " chunk(s) will be loaded.");
//FAWE start - biome and entity restore
SnapshotRestore restore = new SnapshotRestore(chunkStore, editSession, region, restoreBiomes, restoreEntities);
//FAWE end
restore.restore();

View File

@ -37,6 +37,7 @@ import com.sk89q.worldedit.world.snapshot.experimental.SnapshotRestore;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import java.io.IOException;
import java.net.URI;
@ -68,13 +69,23 @@ public class SnapshotUtilCommands {
public void restore(
Actor actor, World world, LocalSession session, EditSession editSession,
@Arg(name = "snapshot", desc = "The snapshot to restore", def = "")
String snapshotName
String snapshotName,
//FAWE start - biome and entity restore
@Switch(name = 'b', desc = "If biomes should be restored. If restoring from pre-1.15 to 1.15+, biomes may not be " +
"exactly the same due to 3D biomes.")
boolean restoreBiomes,
@Switch(name = 'e', desc = "If entities should be restored. Will cause issues with duplicate entities if all " +
"original entities were not removed.")
boolean restoreEntities
//FAWE end
) throws WorldEditException, IOException {
LocalConfiguration config = we.getConfiguration();
checkSnapshotsConfigured(config);
if (config.snapshotRepo != null) {
legacy.restore(actor, world, session, editSession, snapshotName);
//FAWE start - biome and entity restore
legacy.restore(actor, world, session, editSession, snapshotName, restoreBiomes, restoreEntities);
//FAWE end
return;
}
@ -116,8 +127,9 @@ public class SnapshotUtilCommands {
try {
// Restore snapshot
SnapshotRestore restore = new SnapshotRestore(snapshot, editSession, region);
//player.print(restore.getChunksAffected() + " chunk(s) will be loaded.");
//FAWE start - biome and entity restore
SnapshotRestore restore = new SnapshotRestore(snapshot, editSession, region, restoreBiomes, restoreEntities);
//FAWE end
restore.restore();