From 3a4743b7175e68056a7232ffa9d16527c1ab4a8d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 20 Apr 2023 19:59:27 -0500 Subject: [PATCH] Replace all WorldGenStep Enums with the API version --- .../fullData/FullDataPointIdMap.java | 1 - .../worldGeneration/EWorldGenerationStep.java | 30 ------------------- .../lod/core/generation/BatchGenerator.java | 18 +++++------ .../wrapperInterfaces/IWrapperFactory.java | 4 +-- ...actBatchGenerationEnvironmentWrapper.java} | 22 ++++++-------- 5 files changed, 20 insertions(+), 55 deletions(-) delete mode 100644 core/src/main/java/com/seibel/lod/core/enums/worldGeneration/EWorldGenerationStep.java rename core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/{AbstractBatchGenerationEnvionmentWrapper.java => AbstractBatchGenerationEnvironmentWrapper.java} (76%) diff --git a/core/src/main/java/com/seibel/lod/core/dataObjects/fullData/FullDataPointIdMap.java b/core/src/main/java/com/seibel/lod/core/dataObjects/fullData/FullDataPointIdMap.java index e498b08d8..d9dee29fb 100644 --- a/core/src/main/java/com/seibel/lod/core/dataObjects/fullData/FullDataPointIdMap.java +++ b/core/src/main/java/com/seibel/lod/core/dataObjects/fullData/FullDataPointIdMap.java @@ -1,6 +1,5 @@ package com.seibel.lod.core.dataObjects.fullData; -import com.seibel.lod.core.dataObjects.transformers.FullToColumnTransformer; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory; import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper; diff --git a/core/src/main/java/com/seibel/lod/core/enums/worldGeneration/EWorldGenerationStep.java b/core/src/main/java/com/seibel/lod/core/enums/worldGeneration/EWorldGenerationStep.java deleted file mode 100644 index fb5e22ce9..000000000 --- a/core/src/main/java/com/seibel/lod/core/enums/worldGeneration/EWorldGenerationStep.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.seibel.lod.core.enums.worldGeneration; - -/** - * EMPTY,
- * STRUCTURE_START,
- * STRUCTURE_REFERENCE,
- * BIOMES,
- * NOISE,
- * SURFACE,
- * CARVERS,
- * LIQUID_CARVERS,
- * FEATURES,
- * LIGHT,
- * - * @author James Seibel - * @version 2022-7-25 - */ -public enum EWorldGenerationStep -{ - EMPTY, - STRUCTURE_START, - STRUCTURE_REFERENCE, - BIOMES, - NOISE, - SURFACE, - CARVERS, - LIQUID_CARVERS, - FEATURES, - LIGHT, -} diff --git a/core/src/main/java/com/seibel/lod/core/generation/BatchGenerator.java b/core/src/main/java/com/seibel/lod/core/generation/BatchGenerator.java index 048db4b60..171ae5d87 100644 --- a/core/src/main/java/com/seibel/lod/core/generation/BatchGenerator.java +++ b/core/src/main/java/com/seibel/lod/core/generation/BatchGenerator.java @@ -20,6 +20,7 @@ package com.seibel.lod.core.generation; import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenThreadMode; +import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep; import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator; import com.seibel.lod.core.interfaces.dependencyInjection.IOverrideInjector; import com.seibel.lod.core.level.IDhLevel; @@ -31,8 +32,7 @@ import com.seibel.lod.core.util.BitShiftUtil; import com.seibel.lod.core.util.LodUtil; import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory; import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; -import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvionmentWrapper; -import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvionmentWrapper.EGenerationStep; +import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvironmentWrapper; import org.apache.logging.log4j.Logger; import java.util.concurrent.CompletableFuture; @@ -47,7 +47,7 @@ public class BatchGenerator implements IDhApiWorldGenerator private static final IWrapperFactory FACTORY = SingletonInjector.INSTANCE.get(IWrapperFactory.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - public AbstractBatchGenerationEnvionmentWrapper generationGroup; + public AbstractBatchGenerationEnvironmentWrapper generationGroup; public IDhLevel targetDhLevel; @@ -98,24 +98,24 @@ public class BatchGenerator implements IDhApiWorldGenerator @Override public CompletableFuture generateChunks(int chunkPosMinX, int chunkPosMinZ, byte granularity, byte targetDataDetail, EDhApiDistantGeneratorMode generatorMode, Consumer resultConsumer) { - EGenerationStep targetStep = null; + EDhApiWorldGenerationStep targetStep = null; switch (generatorMode) { case PRE_EXISTING_ONLY: - targetStep = EGenerationStep.Empty; // NOTE: Only load in existing chunks. No new chunk generation + targetStep = EDhApiWorldGenerationStep.EMPTY; // NOTE: Only load in existing chunks. No new chunk generation break; case BIOME_ONLY: - targetStep = EGenerationStep.Biomes; // NOTE: No blocks. Require fake height in LodBuilder + targetStep = EDhApiWorldGenerationStep.BIOMES; // NOTE: No blocks. Require fake height in LodBuilder break; case BIOME_ONLY_SIMULATE_HEIGHT: - targetStep = EGenerationStep.Noise; // NOTE: Stone only. Require fake surface + targetStep = EDhApiWorldGenerationStep.NOISE; // NOTE: Stone only. Require fake surface break; case SURFACE: - targetStep = EGenerationStep.Surface; // Carvers or Surface??? + targetStep = EDhApiWorldGenerationStep.SURFACE; // Carvers or Surface??? break; case FEATURES: case FULL: - targetStep = EGenerationStep.Features; + targetStep = EDhApiWorldGenerationStep.FEATURES; break; } diff --git a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/IWrapperFactory.java b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/IWrapperFactory.java index 7d1b1f130..245dd191d 100644 --- a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/IWrapperFactory.java +++ b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/IWrapperFactory.java @@ -24,7 +24,7 @@ import com.seibel.lod.core.interfaces.dependencyInjection.IBindable; import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper; import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper; -import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvionmentWrapper; +import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvironmentWrapper; import java.io.IOException; @@ -36,7 +36,7 @@ import java.io.IOException; */ public interface IWrapperFactory extends IBindable { - AbstractBatchGenerationEnvionmentWrapper createBatchGenerator(IDhLevel targetLevel); + AbstractBatchGenerationEnvironmentWrapper createBatchGenerator(IDhLevel targetLevel); IBiomeWrapper deserializeBiomeWrapper(String str) throws IOException; IBlockStateWrapper deserializeBlockStateWrapper(String str) throws IOException; IBlockStateWrapper getAirBlockStateWrapper(); diff --git a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/AbstractBatchGenerationEnvionmentWrapper.java b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/AbstractBatchGenerationEnvironmentWrapper.java similarity index 76% rename from core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/AbstractBatchGenerationEnvionmentWrapper.java rename to core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/AbstractBatchGenerationEnvironmentWrapper.java index 70c1e9538..b9c0d9556 100644 --- a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/AbstractBatchGenerationEnvionmentWrapper.java +++ b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/worldGeneration/AbstractBatchGenerationEnvironmentWrapper.java @@ -19,29 +19,25 @@ package com.seibel.lod.core.wrapperInterfaces.worldGeneration; +import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep; import com.seibel.lod.core.level.IDhLevel; import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; -public abstract class AbstractBatchGenerationEnvionmentWrapper +public abstract class AbstractBatchGenerationEnvironmentWrapper { - public enum EGenerationStep - { - Empty, StructureStart, StructureReference, Biomes, Noise, Surface, Carvers, LiquidCarvers, Features, Light, - } - - public AbstractBatchGenerationEnvionmentWrapper(IDhLevel level) { } - + public AbstractBatchGenerationEnvironmentWrapper(IDhLevel level) { } + public abstract void resizeThreadPool(int newThreadCount); - + public abstract void updateAllFutures(); - + public abstract int getEventCount(); - + public abstract void stop(boolean blocking); - - public abstract CompletableFuture generateChunks(int minX, int minZ, int genSize, EGenerationStep targetStep, double runTimeRatio, Consumer resultConsumer); + + public abstract CompletableFuture generateChunks(int minX, int minZ, int genSize, EDhApiWorldGenerationStep targetStep, double runTimeRatio, Consumer resultConsumer); }