From de8c0637318c06cf952e189558c5477734b6bbae Mon Sep 17 00:00:00 2001 From: tom lee Date: Sat, 22 Jan 2022 16:10:32 +0800 Subject: [PATCH] Update core + cleanup debug logging --- .../wrappers/block/BlockShapeWrapper.java | 2 +- .../ExperimentalGenerator.java | 23 +++++++++++-------- .../worldGeneration/WorldGenerationStep.java | 5 ++-- core | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockShapeWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockShapeWrapper.java index e46f0c541..470f2bef9 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockShapeWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockShapeWrapper.java @@ -40,7 +40,7 @@ public class BlockShapeWrapper implements IBlockShapeWrapper this.noCollision = false; this.toAvoid = ofBlockToAvoid(); setupShapes(chunkWrapper, x, y, z); - System.out.println(block + " non full " + nonFull + " no collision " + noCollision + " to avoid " + toAvoid); + //System.out.println(block + " non full " + nonFull + " no collision " + noCollision + " to avoid " + toAvoid); } private BlockShapeWrapper() diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java index 519ed1bb9..a1a76e42f 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ExperimentalGenerator.java @@ -39,6 +39,8 @@ import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractExperimenta public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWrapper { + public static final boolean ENABLE_GENERATOR_STATS_LOGGING = false; + private static final IMinecraftWrapper MC = SingletonHandler.get(IMinecraftWrapper.class); private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class); public WorldGenerationStep generationGroup; @@ -59,6 +61,7 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra ClientApi.LOGGER.info("1.18 Experimental Chunk Generator initialized"); } + @SuppressWarnings("unused") @Override public void queueGenerationRequests(LodDimension lodDim, LodBuilder lodBuilder) { if (lodDim != targetLodDim) { @@ -127,7 +130,8 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra if (priority == GenerationPriority.FAR_FIRST) { int nearCount = posToGenerate.getNumberOfNearPos(); int farCount = posToGenerate.getNumberOfFarPos(); - //ClientApi.LOGGER.info("WorldGen. Near:"+nearCount+" Far:"+farCount); + if (ENABLE_GENERATOR_STATS_LOGGING) + ClientApi.LOGGER.info("WorldGen. Near:"+nearCount+" Far:"+farCount); int maxIteration = Math.max(nearCount, farCount); for (int i = 0; i < maxIteration; i++) { @@ -140,7 +144,6 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra int chunkX = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosX(i, false)); int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosZ(i, false)); if (generationGroup.tryAddPoint(chunkX, chunkZ, generationGroupSizeFar, targetStep)) { - //ClientApi.LOGGER.info("WorldGen added 1 far point"); toGenerate--; } } @@ -155,7 +158,6 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posToGenerate.getNthPosZ(i, true)); int genSize = detailLevel > LodUtil.CHUNK_DETAIL_LEVEL ? 0 : generationGroupSize; if (generationGroup.tryAddPoint(chunkX, chunkZ, genSize, targetStep)) { - //ClientApi.LOGGER.info("WorldGen added 1 near point"); toGenerate--; } } @@ -204,15 +206,14 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra } } } - - //Enable this for logging - if (targetToGenerate != toGenerate) { + + if (targetToGenerate != toGenerate && ENABLE_GENERATOR_STATS_LOGGING) { if (toGenerate <= 0) { - ClientApi.LOGGER.debug( + ClientApi.LOGGER.info( "WorldGenerator: Sampled " + posToGenerate.getNumberOfPos() + " out of " + estimatedSampleNeeded + " points, started all targeted " + targetToGenerate + " generations."); } else { - ClientApi.LOGGER.debug("WorldGenerator: Sampled " + posToGenerate.getNumberOfPos() + " out of " + ClientApi.LOGGER.info("WorldGenerator: Sampled " + posToGenerate.getNumberOfPos() + " out of " + estimatedSampleNeeded + " points, started " + (targetToGenerate - toGenerate) + " out of targeted " + targetToGenerate + " generations."); } @@ -225,7 +226,8 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra // Ensure wee don't go to basically infinity if (estimatedSampleNeeded > 32768) estimatedSampleNeeded = 32768; - ClientApi.LOGGER.debug("WorldGenerator: Increasing estimatedSampleNeeeded to " + estimatedSampleNeeded); + if (ENABLE_GENERATOR_STATS_LOGGING) + ClientApi.LOGGER.info("WorldGenerator: Increasing estimatedSampleNeeeded to " + estimatedSampleNeeded); } else if (toGenerate <= 0 && positionGoneThough * 1.5 < posToGenerate.getNumberOfPos()) { // We haven't gone though half of them and it's already enough. @@ -234,7 +236,8 @@ public class ExperimentalGenerator extends AbstractExperimentalWorldGeneratorWra // Ensure we don't go to near zero. if (estimatedSampleNeeded < 4) estimatedSampleNeeded = 4; - ClientApi.LOGGER.debug("WorldGenerator: Decreasing estimatedSampleNeeeded to " + estimatedSampleNeeded); + if (ENABLE_GENERATOR_STATS_LOGGING) + ClientApi.LOGGER.info("WorldGenerator: Decreasing estimatedSampleNeeeded to " + estimatedSampleNeeded); } } diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java index 7d8489bd3..5303d0cf6 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/WorldGenerationStep.java @@ -104,6 +104,7 @@ Lod Generation: 0.269023348s public final class WorldGenerationStep { public static final boolean ENABLE_PERF_LOGGING = false; + public static final boolean ENABLE_EVENT_LOGGING = false; //TODO: Make this LightMode a config public static final LightMode DEFAULT_LIGHTMODE = LightMode.Fancy; @@ -500,7 +501,8 @@ public final class WorldGenerationStep { public void generateLodFromList(GenerationEvent e) { - //System.out.println("Lod Generate Event: "+e.pos); + if (ENABLE_EVENT_LOGGING) + ClientApi.LOGGER.info("Lod Generate Event: "+e.pos); e.pEvent.beginNano = System.nanoTime(); GridList referencedChunks; DistanceGenerationMode generationMode; @@ -529,7 +531,6 @@ public final class WorldGenerationStep { for (int oy = -rangeEmpty; oy <= rangeEmpty; oy++) { for (int ox = -rangeEmpty; ox <= rangeEmpty; ox++) { - // ChunkAccess target = getCachedChunk(new ChunkPos(cx+ox, cy+oy)); ChunkAccess target = generator.generate(cx + ox, cy + oy); chunks.add(target); } diff --git a/core b/core index 608dc443d..958033569 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 608dc443dc12d938c01f1372e56c405054a9123e +Subproject commit 9580335692f948bfd8b3fb90e19a777dcf8d404c