From e549c4df64473e2b887487c03932fc8c40eeb53e Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 27 Feb 2020 23:02:40 -0400 Subject: [PATCH] reset multiple chunks WvmIP II --- ...hunkStorage_scarpetChunkCreationMixin.java | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java index 3837a9e6..ec8e10f8 100644 --- a/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java @@ -152,22 +152,42 @@ public abstract class ThreadedAnvilChunkStorage_scarpetChunkCreationMixin implem //getting rid of all signs this.chunkHolderListDirty = true; // not needed right now - for (ChunkHolder newHolder: createdChunks) + mainThreadExecutor.runTasks(() -> mainThreadExecutor.getTaskCount() == 0); + //worldgenExecutor. + // save all pending chunks / potentially only one max - ours + // hopefully that would flush all chunk writes, including current chink + while ((runnable = field_19343.poll()) != null) { - //convert requires a chunk to be unloaded to load entities - //loadedChunks.remove(newHolder.getPos().toLong()); - //convertToFullChunk(newHolder); - // running all pending tasks - mainThreadExecutor.runTasks(() -> mainThreadExecutor.getTaskCount() == 0); - //worldgenExecutor. - // save all pending chunks / potentially only one max - ours - // hopefully that would flush all chunk writes, including current chink - while ((runnable = field_19343.poll()) != null) - { - runnable.run(); - } - convertToFullChunk(newHolder); + runnable.run(); } + + for (ChunkStatus status : ChunkStatus.createOrderedList()) + { + CarpetSettings.LOG.error("Creating layer: " + status.getId()); + if (status == ChunkStatus.LIGHT) + { + serverLightingProvider.setTaskBatchSize(chunksToConvert.size() + 20); + } + for (ChunkPos chpos : chunksToConvert) + { + //if (status==ChunkStatus.LIGHT) + //{ + // serverLightingProvider.tick(); + //} + //CarpetSettings.LOG.error("Creating layer: " + status.getId()); + world.getChunk(chpos.x, chpos.z, status); + //CarpetSettings.LOG.error(" .. done"); + //if (status==ChunkStatus.LIGHT) + //{ + // serverLightingProvider.tick(); + //} + } + if (status == ChunkStatus.LIGHT) + { + serverLightingProvider.setTaskBatchSize(5); + } + } + mainThreadExecutor.runTasks(() -> mainThreadExecutor.getTaskCount() == 0); //worldgenExecutor. // save all pending chunks / potentially only one max - ours