use of net.minecraft.world.chunk.ChunkManager in project FastAsyncWorldEdit by IntellectualSites.
the class FabricWorld method regenerate.
@Override
public boolean regenerate(Region region, EditSession editSession) {
// Don't even try to regen if it's going to fail.
ChunkManager provider = getWorld().getChunkManager();
if (!(provider instanceof ServerChunkManager)) {
return false;
}
File saveFolder = Files.createTempDir();
// register this just in case something goes wrong
// normally it should be deleted at the end of this method
saveFolder.deleteOnExit();
try {
ServerWorld originalWorld = (ServerWorld) getWorld();
MinecraftServer server = originalWorld.getServer();
WorldSaveHandler saveHandler = new WorldSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDir().getName(), server, server.getDataFixer());
World freshWorld = new ServerWorld(server, server.getWorkerExecutor(), saveHandler, originalWorld.getLevelProperties(), originalWorld.dimension.getType(), originalWorld.getProfiler(), new NoOpChunkStatusListener());
// Pre-gen all the chunks
// We need to also pull one more chunk in every direction
CuboidRegion expandedPreGen = new CuboidRegion(region.getMinimumPoint().subtract(16, 0, 16), region.getMaximumPoint().add(16, 0, 16));
for (BlockVector2 chunk : expandedPreGen.getChunks()) {
freshWorld.getChunk(chunk.getBlockX(), chunk.getBlockZ());
}
FabricWorld from = new FabricWorld(freshWorld);
for (BlockVector3 vec : region) {
editSession.setBlock(vec, from.getFullBlock(vec));
}
} catch (MaxChangedBlocksException e) {
throw new RuntimeException(e);
} finally {
saveFolder.delete();
}
return true;
}
use of net.minecraft.world.chunk.ChunkManager in project dynmap by webbukkit.
the class FabricMapChunkCache method setChunks.
public void setChunks(FabricWorld dw, List<DynmapChunk> chunks) {
this.w = dw.getWorld();
if (dw.isLoaded()) {
/* Check if world's provider is ServerChunkManager */
ChunkManager cp = this.w.getChunkManager();
if (cp instanceof ServerChunkManager) {
cps = (ServerChunkManager) cp;
} else {
Log.severe("Error: world " + dw.getName() + " has unsupported chunk provider");
}
}
super.setChunks(dw, chunks);
}
use of net.minecraft.world.chunk.ChunkManager in project dynmap by webbukkit.
the class FabricMapChunkCache method setChunks.
public void setChunks(FabricWorld dw, List<DynmapChunk> chunks) {
this.w = dw.getWorld();
if (dw.isLoaded()) {
/* Check if world's provider is ServerChunkManager */
ChunkManager cp = this.w.getChunkManager();
if (cp instanceof ServerChunkManager) {
cps = (ServerChunkManager) cp;
} else {
Log.severe("Error: world " + dw.getName() + " has unsupported chunk provider");
}
}
super.setChunks(dw, chunks);
}
use of net.minecraft.world.chunk.ChunkManager in project dynmap by webbukkit.
the class FabricMapChunkCache method setChunks.
public void setChunks(FabricWorld dw, List<DynmapChunk> chunks) {
this.w = dw.getWorld();
if (dw.isLoaded()) {
/* Check if world's provider is ServerChunkManager */
ChunkManager cp = this.w.getChunkManager();
if (cp instanceof ServerChunkManager) {
cps = (ServerChunkManager) cp;
} else {
Log.severe("Error: world " + dw.getName() + " has unsupported chunk provider");
}
}
super.setChunks(dw, chunks);
}
use of net.minecraft.world.chunk.ChunkManager in project dynmap by webbukkit.
the class FabricMapChunkCache method setChunks.
public void setChunks(FabricWorld dw, List<DynmapChunk> chunks) {
this.w = dw.getWorld();
if (dw.isLoaded()) {
/* Check if world's provider is ServerChunkManager */
ChunkManager cp = this.w.getChunkManager();
if (cp instanceof ServerChunkManager) {
cps = (ServerChunkManager) cp;
} else {
Log.severe("Error: world " + dw.getName() + " has unsupported chunk provider");
}
}
super.setChunks(dw, chunks);
}
Aggregations