From ed41a7e449af6a1bb77787ab5584d8926e3ce438 Mon Sep 17 00:00:00 2001 From: coolGi2007 Date: Mon, 13 Dec 2021 12:33:04 +0000 Subject: [PATCH] Updated generation comments --- .../lod/common/wrappers/VersionConstants.java | 5 ++++ .../WorldGeneratorWrapper.java | 26 +++++-------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/VersionConstants.java b/common/src/main/java/com/seibel/lod/common/wrappers/VersionConstants.java index 99dbd20bb..6f1056619 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/VersionConstants.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/VersionConstants.java @@ -23,6 +23,10 @@ public class VersionConstants implements IVersionConstants { @Override public boolean isWorldGeneratorSingleThreaded(DistanceGenerationMode distanceGenerationMode) { + // We are always asking the server to generate the chunk, + // so no use running this stuff multithreaded. + return true; + /* switch (distanceGenerationMode) { default: case NONE: @@ -35,5 +39,6 @@ public class VersionConstants implements IVersionConstants { case FULL: return true; } + */ } } \ No newline at end of file diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java index 46f18d3fb..941c771dc 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGeneratorWrapper.java @@ -26,18 +26,6 @@ import net.minecraft.world.level.chunk.*; */ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper { - //private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class); - - /** - * If a configured feature fails for whatever reason, - * add it to this list. This will hopefully remove any - * features that could cause issues down the line. - */ - //private static final ConcurrentHashMap> FEATURES_TO_AVOID = new ConcurrentHashMap<>(); - - //private static ExecutorService Executor = Executors.newSingleThreadExecutor(); - - public final ServerLevel serverWorld; public final LodDimension lodDim; public final LodBuilder lodBuilder; @@ -71,8 +59,6 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper /** * takes about 15 - 20 ms *

- * Causes concurrentModification Exceptions, - * which could cause instability or world generation bugs */ @Override public void generateFeatures(AbstractChunkPosWrapper pos) @@ -100,7 +86,7 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper private void generate(int chunkX, int chunkZ, DistanceGenerationMode generationMode) { - long t = System.nanoTime(); +// long t = System.nanoTime(); ChunkStatus targetStatus; switch (generationMode) { @@ -125,14 +111,16 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper return; } + // The bool=true means that we wants to generate chunk, and that the returned ChunkAccess must not be null + ChunkAccess ca = serverWorld.getChunkSource().getChunk(chunkX, chunkZ, targetStatus, true); if (ca == null) throw new RuntimeException("This should NEVER be null due to bool being true"); lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(ca), new LodBuilderConfig(generationMode)); - long duration = System.nanoTime()-t; - - System.out.println("LodChunkGenFull["+chunkX+","+chunkZ+"]: "+(double)(duration)/1000.); + // long duration = System.nanoTime()-t; + // Debug print the duration + // System.out.println("LodChunkGenFull["+chunkX+","+chunkZ+"]: "+(double)(duration)/1000.); } @@ -141,7 +129,7 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper - /* + /* TODO: Ask leetom to update chart * performance/generation tests related to * serverWorld.getChunk(x, z, ChunkStatus. *** )