Add basic preloading (#1221)

This commit is contained in:
dordsor21
2021-08-17 01:47:09 +01:00
committed by GitHub
parent d4d98708f9
commit da7aca8ef8
31 changed files with 532 additions and 119 deletions

View File

@ -58,6 +58,7 @@ public class FaweBukkit implements IFawe, Listener {
private boolean listeningImages;
private final boolean chunksStretched;
private final FAWEPlatformAdapterImpl platformAdapter;
private Preloader preloader;
public FaweBukkit(Plugin plugin) {
this.plugin = plugin;
@ -277,9 +278,12 @@ public class FaweBukkit implements IFawe, Listener {
}
@Override
public Preloader getPreloader() {
public Preloader getPreloader(boolean initialise) {
if (PaperLib.isPaper()) {
return new AsyncPreloader();
if (preloader == null && initialise) {
return preloader = new AsyncPreloader();
}
return preloader;
}
return null;
}

View File

@ -264,7 +264,7 @@ public class FaweDelegateRegionManager {
.autoQueue(false)
.build();
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace);
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace, editSession);
try {
Operations.completeLegacy(visitor);
editSession.flushQueue();

View File

@ -353,7 +353,7 @@ public class BukkitWorld extends AbstractWorld {
int Z = pt.getBlockZ() >> 4;
if (Fawe.isMainThread()) {
world.getChunkAt(X, Z);
} else {
} else if (PaperLib.isPaper()) {
PaperLib.getChunkAtAsync(world, X, Z, true);
}
//FAWE end