From 126006635a64a4cde10672123d69c5c2a097ca2e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 14 Nov 2021 08:40:50 -0600 Subject: [PATCH] Start adding ConfigApi --- .../lod/{config => api/forge}/LodConfig.java | 2 +- .../seibel/lod/api/forge/LodForgeMain.java | 1 - .../com/seibel/lod/api/lod/ClientApi.java | 2 +- .../com/seibel/lod/api/lod/ConfigApi.java | 498 ++++++++++++++++++ .../java/com/seibel/lod/api/lod/EventApi.java | 2 +- .../LodBufferBuilderFactory.java | 2 +- .../lod/builders/lodBuilding/LodBuilder.java | 2 +- .../worldGeneration/LodGenWorker.java | 2 +- .../worldGeneration/LodWorldGenerator.java | 2 +- src/main/java/com/seibel/lod/objects/Box.java | 2 +- .../com/seibel/lod/objects/MinDefaultMax.java | 22 + .../seibel/lod/objects/lod/LodDimension.java | 2 +- .../com/seibel/lod/render/LodRenderer.java | 2 +- .../seibel/lod/util/DetailDistanceUtil.java | 2 +- .../java/com/seibel/lod/util/LodUtil.java | 2 +- .../WorldGeneratorWrapper.java | 2 +- 16 files changed, 533 insertions(+), 14 deletions(-) rename src/main/java/com/seibel/lod/{config => api/forge}/LodConfig.java (99%) create mode 100644 src/main/java/com/seibel/lod/api/lod/ConfigApi.java create mode 100644 src/main/java/com/seibel/lod/objects/MinDefaultMax.java diff --git a/src/main/java/com/seibel/lod/config/LodConfig.java b/src/main/java/com/seibel/lod/api/forge/LodConfig.java similarity index 99% rename from src/main/java/com/seibel/lod/config/LodConfig.java rename to src/main/java/com/seibel/lod/api/forge/LodConfig.java index 25fd29ebb..fc5c007c1 100644 --- a/src/main/java/com/seibel/lod/config/LodConfig.java +++ b/src/main/java/com/seibel/lod/api/forge/LodConfig.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.lod.config; +package com.seibel.lod.api.forge; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/src/main/java/com/seibel/lod/api/forge/LodForgeMain.java b/src/main/java/com/seibel/lod/api/forge/LodForgeMain.java index d071ab949..f61457ee4 100644 --- a/src/main/java/com/seibel/lod/api/forge/LodForgeMain.java +++ b/src/main/java/com/seibel/lod/api/forge/LodForgeMain.java @@ -20,7 +20,6 @@ package com.seibel.lod.api.forge; import com.seibel.lod.ModInfo; -import com.seibel.lod.config.LodConfig; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; diff --git a/src/main/java/com/seibel/lod/api/lod/ClientApi.java b/src/main/java/com/seibel/lod/api/lod/ClientApi.java index 7a1dadfb3..260ef67c3 100644 --- a/src/main/java/com/seibel/lod/api/lod/ClientApi.java +++ b/src/main/java/com/seibel/lod/api/lod/ClientApi.java @@ -22,8 +22,8 @@ package com.seibel.lod.api.lod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.builders.worldGeneration.LodGenWorker; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.objects.lod.LodDimension; import com.seibel.lod.objects.math.Mat4f; import com.seibel.lod.render.GlProxy; diff --git a/src/main/java/com/seibel/lod/api/lod/ConfigApi.java b/src/main/java/com/seibel/lod/api/lod/ConfigApi.java new file mode 100644 index 000000000..29c89bd9b --- /dev/null +++ b/src/main/java/com/seibel/lod/api/lod/ConfigApi.java @@ -0,0 +1,498 @@ +package com.seibel.lod.api.lod; + +import com.seibel.lod.api.forge.LodConfig; +import com.seibel.lod.enums.config.BlockToAvoid; +import com.seibel.lod.enums.config.BufferRebuildTimes; +import com.seibel.lod.enums.config.DistanceGenerationMode; +import com.seibel.lod.enums.config.GenerationPriority; +import com.seibel.lod.enums.config.GpuUploadMethod; +import com.seibel.lod.enums.config.HorizontalQuality; +import com.seibel.lod.enums.config.HorizontalResolution; +import com.seibel.lod.enums.config.HorizontalScale; +import com.seibel.lod.enums.config.LodTemplate; +import com.seibel.lod.enums.config.VanillaOverdraw; +import com.seibel.lod.enums.config.VerticalQuality; +import com.seibel.lod.enums.rendering.DebugMode; +import com.seibel.lod.enums.rendering.FogDistance; +import com.seibel.lod.enums.rendering.FogDrawOverride; +import com.seibel.lod.objects.MinDefaultMax; +import com.seibel.lod.util.LodUtil; + +import net.minecraftforge.common.ForgeConfigSpec; + +/** + * This holds the config defaults and setters/getters + * that should be hooked into the host mod loader (Fabric, Forge, etc.). + * + * @author James Seibel + * @version 11-14-2021 + */ +public class ConfigApi +{ + public static final Client client = new Client(); + + + public static class Client + { + public final Graphics graphics; + public final WorldGenerator worldGenerator; + public final AdvancedModOptions advancedModOptions; + + + //================// + // Client Configs // + //================// + public Client() + { + graphics = new Graphics(); + worldGenerator = new WorldGenerator(); + advancedModOptions = new AdvancedModOptions(); + } + + + //==================// + // Graphics Configs // + //==================// + public static class Graphics + { + + public final QualityOption qualityOption; + public final FogQualityOption fogQualityOption; + public final AdvancedGraphicsOption advancedGraphicsOption; + + Graphics() + { + qualityOption = new QualityOption(); + advancedGraphicsOption = new AdvancedGraphicsOption(); + fogQualityOption = new FogQualityOption(); + } + + + public static class QualityOption + { + public static final HorizontalResolution DRAW_RESOLUTION_DEFAULT = HorizontalResolution.BLOCK; + public HorizontalResolution getDrawResolution() + { + return LodConfig.CLIENT.graphics.qualityOption.drawResolution.get(); + } + public void setDrawResolution(HorizontalResolution newHorizontalResolution) + { + LodConfig.CLIENT.graphics.qualityOption.drawResolution.set(newHorizontalResolution); + } + + public static final MinDefaultMax LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX = new MinDefaultMax(32, 64, 1024); + public int getLodChunkRenderDistance() + { + return LodConfig.CLIENT.graphics.qualityOption.lodChunkRenderDistance.get(); + } + public void setLodChunkRenderDistance(int newLodChunkRenderDistance) + { + LodConfig.CLIENT.graphics.qualityOption.lodChunkRenderDistance.set(newLodChunkRenderDistance); + } + + public static final VerticalQuality VERTICAL_QUALITY_DEFAULT = VerticalQuality.MEDIUM; + public VerticalQuality getVerticalQuality() + { + return LodConfig.CLIENT.graphics.qualityOption.verticalQuality.get(); + } + public void setVerticalQuality(VerticalQuality newVerticalQuality) + { + LodConfig.CLIENT.graphics.qualityOption.verticalQuality.set(newVerticalQuality); + } + + public static final HorizontalScale HORIZONTAL_SCALE_DEFAULT = HorizontalScale.MEDIUM; + public HorizontalScale getHorizontalScale() + { + return LodConfig.CLIENT.graphics.qualityOption.horizontalScale.get(); + } + public void setLodChunkRenderDistance(HorizontalScale newHorizontalScale) + { + LodConfig.CLIENT.graphics.qualityOption.horizontalScale.set(newHorizontalScale); + } + + public static final HorizontalQuality HORIZONTAL_QUALITY_DEFAULT = HorizontalQuality.MEDIUM; + public HorizontalQuality getHorizontalQuality() + { + return LodConfig.CLIENT.graphics.qualityOption.horizontalQuality.get(); + } + public void setLodChunkRenderDistance(HorizontalQuality newHorizontalQuality) + { + LodConfig.CLIENT.graphics.qualityOption.horizontalQuality.set(newHorizontalQuality); + } + } + + + public static class FogQualityOption + { + public final ForgeConfigSpec.EnumValue fogDistance; + + public final ForgeConfigSpec.EnumValue fogDrawOverride; + + public final ForgeConfigSpec.BooleanValue disableVanillaFog; + + FogQualityOption(ForgeConfigSpec.Builder builder) + { + + builder.comment("These settings control the fog quality.").push(this.getClass().getSimpleName()); + + fogDistance = builder + .comment("\n\n" + + " At what distance should Fog be drawn on the fake chunks? \n" + + " If the fog cuts off abruptly or you are using Optifine's \"fast\" fog option \n" + + " set this to " + FogDistance.NEAR + " or " + FogDistance.FAR + ". \n") + .defineEnum("Fog Distance", FogDistance.FAR); + + fogDrawOverride = builder + .comment("\n\n" + + " When should fog be drawn? \n" + + " " + FogDrawOverride.OPTIFINE_SETTING + ": Use whatever Fog setting Optifine is using. If Optifine isn't installed this defaults to " + FogDrawOverride.FANCY + ". \n" + + " " + FogDrawOverride.NO_FOG + ": Never draw fog on the LODs \n" + + " " + FogDrawOverride.FAST + ": Always draw fast fog on the LODs \n" + + " " + FogDrawOverride.FANCY + ": Always draw fancy fog on the LODs (if your graphics card supports it) \n") + .defineEnum("Fog Draw Override", FogDrawOverride.FANCY); + + disableVanillaFog = builder + .comment("\n\n" + + " If true disable Minecraft's fog. \n\n" + + "" + + " Experimental! May cause issues with Sodium. \n\n" + + "" + + " Unlike Optifine or Sodium's fog disabling option this won't change \n" + + " performance (we don't actually disable the fog, we just tell it to render a infinite distance away). \n" + + " May or may not play nice with other mods that edit fog. \n") + .define("Experimental Disable Vanilla Fog", false); + + builder.pop(); + } + } + + + public static class AdvancedGraphicsOption + { + public final ForgeConfigSpec.EnumValue lodTemplate; + + public final ForgeConfigSpec.BooleanValue disableDirectionalCulling; + + public final ForgeConfigSpec.BooleanValue alwaysDrawAtMaxQuality; + + public final ForgeConfigSpec.EnumValue vanillaOverdraw; + + public final ForgeConfigSpec.EnumValue gpuUploadMethod; + + public final ForgeConfigSpec.BooleanValue useExtendedNearClipPlane; + + AdvancedGraphicsOption(ForgeConfigSpec.Builder builder) + { + + builder.comment("Advanced graphics option for the mod").push(this.getClass().getSimpleName()); + + lodTemplate = builder + .comment("\n\n" + + " How should the LODs be drawn? \n" + + " NOTE: Currently only " + LodTemplate.CUBIC + " is implemented! \n" + + " \n" + + " " + LodTemplate.CUBIC + ": LOD Chunks are drawn as rectangular prisms (boxes). \n" + + " " + LodTemplate.TRIANGULAR + ": LOD Chunks smoothly transition between other. \n" + + " " + LodTemplate.DYNAMIC + ": LOD Chunks smoothly transition between each other, \n" + + " " + " unless a neighboring chunk is at a significantly different height. \n") + .defineEnum("LOD Template", LodTemplate.CUBIC); + + disableDirectionalCulling = builder + .comment("\n\n" + + " If false fake chunks behind the player's camera \n" + + " aren't drawn, increasing performance. \n\n" + + "" + + " If true all LODs are drawn, even those behind \n" + + " the player's camera, decreasing performance. \n\n" + + "" + + " Disable this if you see LODs disappearing. \n" + + " (Which may happen if you are using a camera mod) \n") + .define("Disable Directional Culling", false); + + alwaysDrawAtMaxQuality = builder + .comment("\n\n" + + " Disable quality falloff, \n" + + " all fake chunks will be drawn at the highest \n" + + " available detail level. \n\n" + + " " + + " WARNING: \n" + + " This could cause a Out Of Memory crash on render \n" + + " distances higher than 128 \n") + .define("Always Use Max Quality", false); + + vanillaOverdraw = builder + .comment("\n\n" + + " How often should LODs be drawn on top of regular chunks? \n" + + " HALF and ALWAYS will prevent holes in the world, but may look odd for transparent blocks or in caves. \n\n" + + " " + VanillaOverdraw.NEVER + ": LODs won't render on top of vanilla chunks. \n" + + " " + VanillaOverdraw.BORDER + ": LODs will render only on the border of vanilla chunks preventing only some holes in the world. \n" + + " " + VanillaOverdraw.DYNAMIC + ": LODs will render on top of distant vanilla chunks to hide delayed loading. \n" + + " " + " More effective on higher render distances. \n" + + " " + " For vanilla render distances less than or equal to " + LodUtil.MINIMUM_RENDER_DISTANCE_FOR_PARTIAL_OVERDRAW + " \n" + + " " + " " + VanillaOverdraw.NEVER + " or " + VanillaOverdraw.ALWAYS + " may be used depending on the dimension. \n" + + " " + VanillaOverdraw.ALWAYS + ": LODs will render on all vanilla chunks preventing holes in the world. \n") + .defineEnum("Vanilla Overdraw", VanillaOverdraw.DYNAMIC); + + gpuUploadMethod = builder + .comment("\n\n" + + " What method should be used to upload geometry to the GPU? \n\\n" + + "" + + " " + GpuUploadMethod.BUFFER_STORAGE + ": Default if OpenGL 4.5 is supported. Fast rendering, no stuttering. \n" + + " " + GpuUploadMethod.SUB_DATA + ": Default if OpenGL 4.5 is NOT supported. Fast rendering but may stutter when uploading. \n" + + " " + GpuUploadMethod.BUFFER_MAPPING + ": Slow rendering but won't stutter when uploading. Possibly better than " + GpuUploadMethod.SUB_DATA + " if using a integrated GPU. \n") + .defineEnum("GPU Upload Method", GpuUploadMethod.BUFFER_STORAGE); + + // This is a temporary fix (like vanilla overdraw) + // hopefully we can remove both once we get individual chunk rendering figured out + useExtendedNearClipPlane = builder + .comment("\n\n" + + " Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n" + + " especially when in/near an ocean. \n") + .define("Use Extended Near Clip Plane", false); + + + builder.pop(); + } + } + } + + + + + //========================// + // WorldGenerator Configs // + //========================// + public static class WorldGenerator + { + public final ForgeConfigSpec.EnumValue generationPriority; + public final ForgeConfigSpec.EnumValue distanceGenerationMode; + public final ForgeConfigSpec.BooleanValue allowUnstableFeatureGeneration; + public final ForgeConfigSpec.EnumValue blockToAvoid; + //public final ForgeConfigSpec.BooleanValue useExperimentalPreGenLoading; + + WorldGenerator(ForgeConfigSpec.Builder builder) + { + builder.comment("These settings control how fake chunks outside your normal view range are generated.").push("Generation"); + + generationPriority = builder + .comment("\n\n" + + " " + GenerationPriority.FAR_FIRST + " \n" + + " LODs are generated from low to high detail \n" + + " with a small priority for far away regions. \n" + + " This fills in the world fastest. \n\n" + + "" + + " " + GenerationPriority.NEAR_FIRST + " \n" + + " LODs are generated around the player \n" + + " in a spiral, similar to vanilla minecraft. \n") + .defineEnum("Generation Priority", GenerationPriority.FAR_FIRST); + + distanceGenerationMode = builder + .comment("\n\n" + + " Note: The times listed here are the amount of time it took \n" + + " one of the developer's PC to generate 1 chunk, \n" + + " and are included so you can compare the \n" + + " different generation options. Your mileage may vary. \n" + + "\n" + + + " " + DistanceGenerationMode.NONE + " \n" + + " Don't run the distance generator. \n" + + + "\n" + + " " + DistanceGenerationMode.BIOME_ONLY + " \n" + + " Only generate the biomes and use the biome's \n" + + " grass color, water color, or snow color. \n" + + " Doesn't generate height, everything is shown at sea level. \n" + + " Multithreaded - Fastest (2-5 ms) \n" + + + "\n" + + " " + DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT + " \n" + + " Same as BIOME_ONLY, except instead \n" + + " of always using sea level as the LOD height \n" + + " different biome types (mountain, ocean, forest, etc.) \n" + + " use predetermined heights to simulate having height data. \n" + + " Multithreaded - Fastest (2-5 ms) \n" + + + "\n" + + " " + DistanceGenerationMode.SURFACE + " \n" + + " Generate the world surface, \n" + + " this does NOT include trees, \n" + + " or structures. \n" + + " Multithreaded - Faster (10-20 ms) \n" + + + "\n" + + " " + DistanceGenerationMode.FEATURES + " \n" + + " Generate everything except structures. \n" + + " WARNING: This may cause world generation bugs or instability! \n" + + " Multithreaded - Fast (15-20 ms) \n" + + + "\n" + + " " + DistanceGenerationMode.SERVER + " \n" + + " Ask the server to generate/load each chunk. \n" + + " This will show player made structures, which can \n" + + " be useful if you are adding the mod to a pre-existing world. \n" + + " This is the most compatible, but causes server/simulation lag. \n" + + " SingleThreaded - Slow (15-50 ms, with spikes up to 200 ms) \n") + .defineEnum("Distance Generation Mode", DistanceGenerationMode.SURFACE); + + allowUnstableFeatureGeneration = builder + .comment("\n\n" + + " When using the " + DistanceGenerationMode.FEATURES + " generation mode \n" + + " some features may not be thread safe, which could \n" + + " cause instability and crashes. \n" + + " By default (false) those features are skipped, \n" + + " improving stability, but decreasing how many features are \n" + + " actually generated. \n" + + " (for example: some tree generation is unstable, \n" + + " so some trees may not be generated.) \n" + + " By setting this to true, all features will be generated, \n" + + " but your game will be more unstable and crashes may occur. \n" + + " \n" + + " I would love to remove this option and always generate everything, \n" + + " but I'm not sure how to do that. \n" + + " If you are a Java wizard, check out the git issue here: \n" + + " https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/35 \n") + .define("Allow Unstable Feature Generation", false); + + blockToAvoid = builder + .comment("\n\n" + + " " + BlockToAvoid.NONE + ": Use all blocks when generating fake chunks \n\n" + + "" + + " " + BlockToAvoid.NON_FULL + ": Only use full blocks when generating fake chunks (ignores slabs, lanterns, torches, grass, etc.) \n\n" + + "" + + " " + BlockToAvoid.NO_COLLISION + ": Only use solid blocks when generating fake chunks (ignores grass, torches, etc.) \n" + + "" + + " " + BlockToAvoid.BOTH + ": Only use full solid blocks when generating fake chunks \n" + + "\n") + .defineEnum("Block to avoid", BlockToAvoid.BOTH); + + /*useExperimentalPreGenLoading = builder + .comment("\n\n" + + " if a chunk has been pre-generated, then the mod would use the real chunk for the \n" + + "fake chunk creation. May require a deletion of the lod file to see the result. \n") + .define("Use pre-generated chunks", false);*/ + builder.pop(); + } + } + + + + + //============================// + // AdvancedModOptions Configs // + //============================// + public static class AdvancedModOptions + { + + public final Threading threading; + public final Debugging debugging; + public final Buffers buffers; + + public AdvancedModOptions(ForgeConfigSpec.Builder builder) + { + builder.comment("Advanced mod settings").push(this.getClass().getSimpleName()); + { + threading = new Threading(builder); + debugging = new Debugging(builder); + buffers = new Buffers(builder); + } + builder.pop(); + } + + public static class Threading + { + public final ForgeConfigSpec.IntValue numberOfWorldGenerationThreads; + public final ForgeConfigSpec.IntValue numberOfBufferBuilderThreads; + + Threading(ForgeConfigSpec.Builder builder) + { + builder.comment("These settings control how many CPU threads the mod uses for different tasks.").push(this.getClass().getSimpleName()); + + numberOfWorldGenerationThreads = builder + .comment("\n\n" + + " This is how many threads are used when generating LODs outside \n" + + " the normal render distance. \n" + + " If you experience stuttering when generating distant LODs, decrease \n" + + " this number. If you want to increase LOD generation speed, \n" + + " increase this number. \n\n" + + "" + + " The maximum value is the number of logical processors on your CPU. \n" + + " Requires a restart to take effect. \n") + .defineInRange("numberOfWorldGenerationThreads", Math.max(1, Runtime.getRuntime().availableProcessors() / 2), 1, Runtime.getRuntime().availableProcessors()); + + numberOfBufferBuilderThreads = builder + .comment("\n\n" + + " This is how many threads are used when building vertex buffers \n" + + " (The things sent to your GPU to draw the fake chunks). \n" + + " If you experience high CPU usage when NOT generating distant \n" + + " fake chunks, lower this number. \n" + + " \n" + + " The maximum value is the number of logical processors on your CPU. \n" + + " Requires a restart to take effect. \n") + .defineInRange("numberOfBufferBuilderThreads", Math.max(1, Runtime.getRuntime().availableProcessors() / 2), 1, Runtime.getRuntime().availableProcessors()); + + builder.pop(); + } + } + + + + + //===============// + // Debug Options // + //===============// + public static class Debugging + { + public final ForgeConfigSpec.BooleanValue drawLods; + public final ForgeConfigSpec.EnumValue debugMode; + public final ForgeConfigSpec.BooleanValue enableDebugKeybindings; + + Debugging(ForgeConfigSpec.Builder builder) + { + builder.comment("These settings can be used to look for bugs, or see how certain aspects of the mod work.").push(this.getClass().getSimpleName()); + + drawLods = builder + .comment("\n\n" + + " If true, the mod is enabled and fake chunks will be drawn. \n" + + " If false, the mod will still generate fake chunks, \n" + + " but they won't be rendered. \n") + .define("Enable Rendering", true); + + debugMode = builder + .comment("\n\n" + + " " + DebugMode.OFF + ": Fake chunks will be drawn with their normal colors. \n" + + " " + DebugMode.SHOW_DETAIL + ": Fake chunks color will be based on their detail level. \n" + + " " + DebugMode.SHOW_DETAIL_WIREFRAME + ": Fake chunks color will be based on their detail level, drawn as a wireframe. \n") + .defineEnum("Debug Mode", DebugMode.OFF); + + enableDebugKeybindings = builder + .comment("\n\n" + + " If true the F4 key can be used to cycle through the different debug modes. \n" + + " and the F6 key can be used to enable and disable LOD rendering.") + .define("Enable Debug Keybinding", false); + + builder.pop(); + } + } + + + public static class Buffers + { + public final ForgeConfigSpec.EnumValue rebuildTimes; + + Buffers(ForgeConfigSpec.Builder builder) + { + builder.comment("These settings affect how often geometry is are built.").push(this.getClass().getSimpleName()); + + rebuildTimes = builder + .comment("\n\n" + + " How frequently should geometry be rebuilt and sent to the GPU? \n" + + " Higher settings may cause stuttering, but will prevent holes in the world \n") + .defineEnum("rebuildFrequency", BufferRebuildTimes.NORMAL); + + builder.pop(); + } + } + } + } + +} diff --git a/src/main/java/com/seibel/lod/api/lod/EventApi.java b/src/main/java/com/seibel/lod/api/lod/EventApi.java index a480eb2af..469ddfb9e 100644 --- a/src/main/java/com/seibel/lod/api/lod/EventApi.java +++ b/src/main/java/com/seibel/lod/api/lod/EventApi.java @@ -21,8 +21,8 @@ package com.seibel.lod.api.lod; import org.lwjgl.glfw.GLFW; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.builders.worldGeneration.LodWorldGenerator; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.objects.lod.LodDimension; import com.seibel.lod.objects.lod.RegionPos; diff --git a/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilderFactory.java b/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilderFactory.java index 7a2e036e6..d91625317 100644 --- a/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilderFactory.java +++ b/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilderFactory.java @@ -36,8 +36,8 @@ import org.lwjgl.opengl.GL30; import org.lwjgl.opengl.GL45; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.api.lod.ClientApi; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.enums.LodDirection; import com.seibel.lod.enums.config.GpuUploadMethod; import com.seibel.lod.enums.config.VanillaOverdraw; diff --git a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java index da6aed52f..721813908 100644 --- a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java @@ -22,7 +22,7 @@ package com.seibel.lod.builders.lodBuilding; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import com.seibel.lod.config.LodConfig; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.enums.config.HorizontalResolution; import com.seibel.lod.objects.lod.LodDimension; diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodGenWorker.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodGenWorker.java index 3511d3bea..7c84d6424 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodGenWorker.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodGenWorker.java @@ -23,9 +23,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.api.lod.ClientApi; import com.seibel.lod.builders.lodBuilding.LodBuilder; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.objects.lod.LodDimension; import com.seibel.lod.util.LodUtil; diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java index dbf9cd54f..9df08e128 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java @@ -25,8 +25,8 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.builders.lodBuilding.LodBuilder; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.objects.PosToGenerateContainer; import com.seibel.lod.objects.lod.LodDimension; diff --git a/src/main/java/com/seibel/lod/objects/Box.java b/src/main/java/com/seibel/lod/objects/Box.java index b6fa5d0e8..cfece97fe 100644 --- a/src/main/java/com/seibel/lod/objects/Box.java +++ b/src/main/java/com/seibel/lod/objects/Box.java @@ -23,7 +23,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import com.seibel.lod.config.LodConfig; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.enums.LodDirection; import com.seibel.lod.enums.rendering.DebugMode; import com.seibel.lod.objects.math.Vec3i; diff --git a/src/main/java/com/seibel/lod/objects/MinDefaultMax.java b/src/main/java/com/seibel/lod/objects/MinDefaultMax.java new file mode 100644 index 000000000..4433e6a43 --- /dev/null +++ b/src/main/java/com/seibel/lod/objects/MinDefaultMax.java @@ -0,0 +1,22 @@ +package com.seibel.lod.objects; + +/** + * Used when setting up configuration fields. + * + * @author James Seibel + * @version 11-14-2021 + * @param The type of data this object is storing + */ +public class MinDefaultMax +{ + public T minValue; + public T defaultValue; + public T maxValue; + + public MinDefaultMax(T newMinValue, T newDefaultValue, T newMaxValue) + { + minValue = newMinValue; + defaultValue = newDefaultValue; + maxValue = newMaxValue; + } +} diff --git a/src/main/java/com/seibel/lod/objects/lod/LodDimension.java b/src/main/java/com/seibel/lod/objects/lod/LodDimension.java index 9259002b4..2ec35c4a1 100644 --- a/src/main/java/com/seibel/lod/objects/lod/LodDimension.java +++ b/src/main/java/com/seibel/lod/objects/lod/LodDimension.java @@ -24,7 +24,7 @@ import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import com.seibel.lod.config.LodConfig; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.enums.config.GenerationPriority; import com.seibel.lod.enums.config.VerticalQuality; diff --git a/src/main/java/com/seibel/lod/render/LodRenderer.java b/src/main/java/com/seibel/lod/render/LodRenderer.java index 4eb374ff4..6cfb6cf79 100644 --- a/src/main/java/com/seibel/lod/render/LodRenderer.java +++ b/src/main/java/com/seibel/lod/render/LodRenderer.java @@ -26,10 +26,10 @@ import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL30; import org.lwjgl.opengl.NVFogDistance; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.api.lod.ApiShared; import com.seibel.lod.builders.bufferBuilding.LodBufferBuilderFactory; import com.seibel.lod.builders.bufferBuilding.LodBufferBuilderFactory.VertexBuffersAndOffset; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.enums.config.GpuUploadMethod; import com.seibel.lod.enums.rendering.DebugMode; import com.seibel.lod.enums.rendering.FogDistance; diff --git a/src/main/java/com/seibel/lod/util/DetailDistanceUtil.java b/src/main/java/com/seibel/lod/util/DetailDistanceUtil.java index 6908fd864..bdb051bc4 100644 --- a/src/main/java/com/seibel/lod/util/DetailDistanceUtil.java +++ b/src/main/java/com/seibel/lod/util/DetailDistanceUtil.java @@ -19,7 +19,7 @@ package com.seibel.lod.util; -import com.seibel.lod.config.LodConfig; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.enums.config.HorizontalQuality; import com.seibel.lod.enums.config.HorizontalResolution; diff --git a/src/main/java/com/seibel/lod/util/LodUtil.java b/src/main/java/com/seibel/lod/util/LodUtil.java index 290f41d42..14b8f3332 100644 --- a/src/main/java/com/seibel/lod/util/LodUtil.java +++ b/src/main/java/com/seibel/lod/util/LodUtil.java @@ -23,7 +23,7 @@ import java.awt.Color; import java.io.File; import java.util.HashSet; -import com.seibel.lod.config.LodConfig; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.enums.LodDirection; import com.seibel.lod.enums.config.HorizontalResolution; import com.seibel.lod.enums.config.VanillaOverdraw; diff --git a/src/main/java/com/seibel/lod/wrappers/worldGeneration/WorldGeneratorWrapper.java b/src/main/java/com/seibel/lod/wrappers/worldGeneration/WorldGeneratorWrapper.java index aabe3b6c6..5e19a5afb 100644 --- a/src/main/java/com/seibel/lod/wrappers/worldGeneration/WorldGeneratorWrapper.java +++ b/src/main/java/com/seibel/lod/wrappers/worldGeneration/WorldGeneratorWrapper.java @@ -7,9 +7,9 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; +import com.seibel.lod.api.forge.LodConfig; import com.seibel.lod.builders.lodBuilding.LodBuilder; import com.seibel.lod.builders.lodBuilding.LodBuilderConfig; -import com.seibel.lod.config.LodConfig; import com.seibel.lod.enums.config.DistanceGenerationMode; import com.seibel.lod.objects.lod.LodDimension; import com.seibel.lod.util.LodUtil;