diff --git a/src/main/java/com/seibel/lod/api/forge/ForgeConfig.java b/src/main/java/com/seibel/lod/api/forge/ForgeConfig.java index 6c20f1520..90b54173a 100644 --- a/src/main/java/com/seibel/lod/api/forge/ForgeConfig.java +++ b/src/main/java/com/seibel/lod/api/forge/ForgeConfig.java @@ -28,7 +28,6 @@ import org.apache.logging.log4j.LogManager; import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.io.WritingMode; import com.seibel.lod.ModInfo; -import com.seibel.lod.core.config.LodConfig; import com.seibel.lod.core.enums.config.BlockToAvoid; import com.seibel.lod.core.enums.config.BufferRebuildTimes; import com.seibel.lod.core.enums.config.DistanceGenerationMode; @@ -44,6 +43,15 @@ import com.seibel.lod.core.enums.rendering.DebugMode; import com.seibel.lod.core.enums.rendering.FogDistance; import com.seibel.lod.core.enums.rendering.FogDrawOverride; import com.seibel.lod.core.objects.MinDefaultMax; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IAdvanced; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IGraphics; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IGraphics.IQuality; +import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -54,7 +62,7 @@ import net.minecraftforge.fml.config.ModConfig; * This handles any configuration the user has access to. * @author Leonardo Amato * @author James Seibel - * @version 11-14-2021 + * @version 11-16-2021 */ @Mod.EventBusSubscriber public class ForgeConfig @@ -103,18 +111,17 @@ public class ForgeConfig //==================// public static class Graphics { - public final QualityOption qualityOption; - public final FogQualityOption fogQualityOption; + public final FogQualityOption fogQuality; public final AdvancedGraphicsOption advancedGraphicsOption; Graphics(ForgeConfigSpec.Builder builder) { - builder.comment("These settings control how the mod will look in game").push("Graphics"); + builder.comment(IGraphics.DESC).push("Graphics"); { qualityOption = new QualityOption(builder); advancedGraphicsOption = new AdvancedGraphicsOption(builder); - fogQualityOption = new FogQualityOption(builder); + fogQuality = new FogQualityOption(builder); } builder.pop(); } @@ -123,44 +130,39 @@ public class ForgeConfig public static class QualityOption { public final ForgeConfigSpec.EnumValue drawResolution; - public final ForgeConfigSpec.IntValue lodChunkRenderDistance; - public final ForgeConfigSpec.EnumValue verticalQuality; - public final ForgeConfigSpec.EnumValue horizontalScale; - public final ForgeConfigSpec.EnumValue horizontalQuality; - QualityOption(ForgeConfigSpec.Builder builder) { - builder.comment(LodConfig.Client.Graphics.QualityOption.DESC).push(this.getClass().getSimpleName()); + builder.comment(IQuality.DESC).push(this.getClass().getSimpleName()); verticalQuality = builder .comment("\n\n" - + LodConfig.Client.Graphics.QualityOption.VERTICAL_QUALITY_DESC) - .defineEnum("Vertical Quality", LodConfig.Client.Graphics.QualityOption.VERTICAL_QUALITY_DEFAULT); + + IQuality.VERTICAL_QUALITY_DESC) + .defineEnum("Vertical Quality", IQuality.VERTICAL_QUALITY_DEFAULT); horizontalScale = builder .comment("\n\n" - + LodConfig.Client.Graphics.QualityOption.HORIZONTAL_SCALE_DESC) - .defineEnum("Horizontal Scale", LodConfig.Client.Graphics.QualityOption.HORIZONTAL_SCALE_DEFAULT); + + IQuality.HORIZONTAL_SCALE_DESC) + .defineEnum("Horizontal Scale", IQuality.HORIZONTAL_SCALE_DEFAULT); horizontalQuality = builder .comment("\n\n" - + LodConfig.Client.Graphics.QualityOption.HORIZONTAL_QUALITY_DESC) - .defineEnum("Horizontal Quality", LodConfig.Client.Graphics.QualityOption.HORIZONTAL_QUALITY_DEFAULT); + + IQuality.HORIZONTAL_QUALITY_DESC) + .defineEnum("Horizontal Quality", IQuality.HORIZONTAL_QUALITY_DEFAULT); drawResolution = builder .comment("\n\n" - + LodConfig.Client.Graphics.QualityOption.DRAW_RESOLUTION_DESC) - .defineEnum("Block size", LodConfig.Client.Graphics.QualityOption.DRAW_RESOLUTION_DEFAULT); + + IQuality.DRAW_RESOLUTION_DESC) + .defineEnum("Block size", IQuality.DRAW_RESOLUTION_DEFAULT); - MinDefaultMax minDefaultMax = LodConfig.Client.Graphics.QualityOption.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX; + MinDefaultMax minDefaultMax = IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX; lodChunkRenderDistance = builder .comment("\n\n" - + LodConfig.Client.Graphics.QualityOption.LOD_CHUNK_RENDER_DISTANCE_DESC) + + IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC) .defineInRange("Lod Render Distance", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue); builder.pop(); @@ -171,30 +173,27 @@ public class ForgeConfig 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(LodConfig.Client.Graphics.FogQualityOption.DESC).push(this.getClass().getSimpleName()); + builder.comment(IFogQuality.DESC).push(this.getClass().getSimpleName()); fogDistance = builder .comment("\n\n" - + LodConfig.Client.Graphics.FogQualityOption.FOG_DISTANCE_DESC) - .defineEnum("Fog Distance", LodConfig.Client.Graphics.FogQualityOption.FOG_DISTANCE_DEFAULT); + + IFogQuality.FOG_DISTANCE_DESC) + .defineEnum("Fog Distance", IFogQuality.FOG_DISTANCE_DEFAULT); fogDrawOverride = builder .comment("\n\n" - + LodConfig.Client.Graphics.FogQualityOption.FOG_DRAW_OVERRIDE_DESC) - .defineEnum("Fog Draw Override", LodConfig.Client.Graphics.FogQualityOption.FOG_DRAW_OVERRIDE_DEFAULT); + + IFogQuality.FOG_DRAW_OVERRIDE_DESC) + .defineEnum("Fog Draw Override", IFogQuality.FOG_DRAW_OVERRIDE_DEFAULT); disableVanillaFog = builder .comment("\n\n" - + LodConfig.Client.Graphics.FogQualityOption.DISABLE_VANILLA_FOG_DESC) - .define("Experimental Disable Vanilla Fog", LodConfig.Client.Graphics.FogQualityOption.DISABLE_VANILLA_FOG_DEFAULT); + + IFogQuality.DISABLE_VANILLA_FOG_DESC) + .define("Experimental Disable Vanilla Fog", IFogQuality.DISABLE_VANILLA_FOG_DEFAULT); builder.pop(); } @@ -204,53 +203,47 @@ public class ForgeConfig 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(LodConfig.Client.Graphics.AdvancedGraphicsOption.DESC).push(this.getClass().getSimpleName()); + builder.comment(IAdvancedGraphics.DESC).push(this.getClass().getSimpleName()); lodTemplate = builder .comment("\n\n" - + LodConfig.Client.Graphics.AdvancedGraphicsOption.LOD_TEMPLATE_DESC) - .defineEnum("LOD Template", LodConfig.Client.Graphics.AdvancedGraphicsOption.LOD_TEMPLATE_DEFAULT); + + IAdvancedGraphics.LOD_TEMPLATE_DESC) + .defineEnum("LOD Template", IAdvancedGraphics.LOD_TEMPLATE_DEFAULT); disableDirectionalCulling = builder .comment("\n\n" - + LodConfig.Client.Graphics.AdvancedGraphicsOption.DISABLE_DIRECTIONAL_CULLING_DESC) - .define("Disable Directional Culling", LodConfig.Client.Graphics.AdvancedGraphicsOption.DISABLE_DIRECTIONAL_CULLING_DEFAULT); + + IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DESC) + .define("Disable Directional Culling", IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DEFAULT); alwaysDrawAtMaxQuality = builder .comment("\n\n" - + LodConfig.Client.Graphics.AdvancedGraphicsOption.ALWAYS_DRAW_AT_MAD_QUALITY_DESC) - .define("Always Use Max Quality", LodConfig.Client.Graphics.AdvancedGraphicsOption.ALWAYS_DRAW_AT_MAD_QUALITY_DEFAULT); + + IAdvancedGraphics.ALWAYS_DRAW_AT_MAD_QUALITY_DESC) + .define("Always Use Max Quality", IAdvancedGraphics.ALWAYS_DRAW_AT_MAD_QUALITY_DEFAULT); vanillaOverdraw = builder .comment("\n\n" - + LodConfig.Client.Graphics.AdvancedGraphicsOption.VANILLA_OVERDRAW_DESC) - .defineEnum("Vanilla Overdraw", LodConfig.Client.Graphics.AdvancedGraphicsOption.VANILLA_OVERDRAW_DEFAULT); + + IAdvancedGraphics.VANILLA_OVERDRAW_DESC) + .defineEnum("Vanilla Overdraw", IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT); gpuUploadMethod = builder .comment("\n\n" - + LodConfig.Client.Graphics.AdvancedGraphicsOption.GPU_UPLOAD_METHOD_DESC) - .defineEnum("GPU Upload Method", LodConfig.Client.Graphics.AdvancedGraphicsOption.GPU_UPLOAD_METHOD_DEFAULT); + + IAdvancedGraphics.GPU_UPLOAD_METHOD_DESC) + .defineEnum("GPU Upload Method", IAdvancedGraphics.GPU_UPLOAD_METHOD_DEFAULT); // 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" - + LodConfig.Client.Graphics.AdvancedGraphicsOption.USE_EXTENDED_NEAR_CLIP_PLANE_DESC) - .define("Use Extended Near Clip Plane", LodConfig.Client.Graphics.AdvancedGraphicsOption.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT); + + IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC) + .define("Use Extended Near Clip Plane", IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT); builder.pop(); @@ -274,27 +267,27 @@ public class ForgeConfig WorldGenerator(ForgeConfigSpec.Builder builder) { - builder.comment(LodConfig.Client.WorldGenerator.DESC).push("Generation"); + builder.comment(IWorldGenerator.DESC).push("Generation"); generationPriority = builder .comment("\n\n" - + LodConfig.Client.WorldGenerator.GENERATION_PRIORITY_DESC) - .defineEnum("Generation Priority", LodConfig.Client.WorldGenerator.GENERATION_PRIORITY_DEFAULT); + + IWorldGenerator.GENERATION_PRIORITY_DESC) + .defineEnum("Generation Priority", IWorldGenerator.GENERATION_PRIORITY_DEFAULT); distanceGenerationMode = builder .comment("\n\n" - + LodConfig.Client.WorldGenerator.DISTANCE_GENERATION_MODE_DESC) - .defineEnum("Distance Generation Mode", LodConfig.Client.WorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT); + + IWorldGenerator.DISTANCE_GENERATION_MODE_DESC) + .defineEnum("Distance Generation Mode", IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT); allowUnstableFeatureGeneration = builder .comment("\n\n" - + LodConfig.Client.WorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DESC) - .define("Allow Unstable Feature Generation", LodConfig.Client.WorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT); + + IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DESC) + .define("Allow Unstable Feature Generation", IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT); blockToAvoid = builder .comment("\n\n" - + LodConfig.Client.WorldGenerator.BLOCK_TO_AVOID_DESC) - .defineEnum("Block to avoid", LodConfig.Client.WorldGenerator.BLOCK_TO_AVOID_DEFAULT); + + IWorldGenerator.BLOCK_TO_AVOID_DESC) + .defineEnum("Block to avoid", IWorldGenerator.BLOCK_TO_AVOID_DEFAULT); /*useExperimentalPreGenLoading = builder .comment("\n\n" @@ -313,14 +306,13 @@ public class ForgeConfig //============================// 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()); + builder.comment(IAdvanced.DESC).push(this.getClass().getSimpleName()); { threading = new Threading(builder); debugging = new Debugging(builder); @@ -336,19 +328,19 @@ public class ForgeConfig Threading(ForgeConfigSpec.Builder builder) { - builder.comment(LodConfig.Client.AdvancedModOptions.Threading.DESC).push(this.getClass().getSimpleName()); + builder.comment(IThreading.DESC).push(this.getClass().getSimpleName()); - MinDefaultMax minDefaultMax = LodConfig.Client.AdvancedModOptions.Threading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT; + MinDefaultMax minDefaultMax = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT; numberOfWorldGenerationThreads = builder .comment("\n\n" - + LodConfig.Client.AdvancedModOptions.Threading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC) + + IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC) .defineInRange("numberOfWorldGenerationThreads", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue); - minDefaultMax = LodConfig.Client.AdvancedModOptions.Threading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX; + minDefaultMax = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX; numberOfBufferBuilderThreads = builder .comment("\n\n" - + LodConfig.Client.AdvancedModOptions.Threading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX) + + IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX) .defineInRange("numberOfBufferBuilderThreads", minDefaultMax.defaultValue, minDefaultMax.minValue, minDefaultMax.maxValue); builder.pop(); @@ -369,22 +361,22 @@ public class ForgeConfig Debugging(ForgeConfigSpec.Builder builder) { - builder.comment(LodConfig.Client.AdvancedModOptions.Debugging.DESC).push(this.getClass().getSimpleName()); + builder.comment(IDebugging.DESC).push(this.getClass().getSimpleName()); drawLods = builder .comment("\n\n" - + LodConfig.Client.AdvancedModOptions.Debugging.DRAW_LODS_DESC) - .define("Enable Rendering", LodConfig.Client.AdvancedModOptions.Debugging.DRAW_LODS_DEFAULT); + + IDebugging.DRAW_LODS_DESC) + .define("Enable Rendering", IDebugging.DRAW_LODS_DEFAULT); debugMode = builder .comment("\n\n" - + LodConfig.Client.AdvancedModOptions.Debugging.DEBUG_MODE_DESC) - .defineEnum("Debug Mode", LodConfig.Client.AdvancedModOptions.Debugging.DEBUG_MODE_DEFAULT); + + IDebugging.DEBUG_MODE_DESC) + .defineEnum("Debug Mode", IDebugging.DEBUG_MODE_DEFAULT); enableDebugKeybindings = builder .comment("\n\n" - + LodConfig.Client.AdvancedModOptions.Debugging.ENABLE_DEBUG_KEYBINDINGS_DESC) - .define("Enable Debug Keybinding", LodConfig.Client.AdvancedModOptions.Debugging.ENABLE_DEBUG_KEYBINDINGS_DEFAULT); + + IDebugging.ENABLE_DEBUG_KEYBINDINGS_DESC) + .define("Enable Debug Keybinding", IDebugging.ENABLE_DEBUG_KEYBINDINGS_DEFAULT); builder.pop(); } @@ -397,12 +389,12 @@ public class ForgeConfig Buffers(ForgeConfigSpec.Builder builder) { - builder.comment(LodConfig.Client.AdvancedModOptions.Buffers.DESC).push(this.getClass().getSimpleName()); + builder.comment(IBuffers.DESC).push(this.getClass().getSimpleName()); rebuildTimes = builder .comment("\n\n" - + LodConfig.Client.AdvancedModOptions.Buffers.REBUILD_TIMES_DESC) - .defineEnum("rebuildFrequency", LodConfig.Client.AdvancedModOptions.Buffers.REBUILD_TIMES_DEFAULT); + + IBuffers.REBUILD_TIMES_DESC) + .defineEnum("rebuildFrequency", IBuffers.REBUILD_TIMES_DEFAULT); builder.pop(); } 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 43a946d25..d9cc7c64a 100644 --- a/src/main/java/com/seibel/lod/api/lod/ClientApi.java +++ b/src/main/java/com/seibel/lod/api/lod/ClientApi.java @@ -120,7 +120,7 @@ public class ClientApi // these can't be set until after the buffers are built (in renderer.drawLODs) // otherwise the buffers may be set to the wrong size, or not changed at all ApiShared.previousChunkRenderDistance = mc.getRenderDistance(); - ApiShared.previousLodRenderDistance = config.getClient().getGraphics().getQualityOption().getLodChunkRenderDistance(); + ApiShared.previousLodRenderDistance = config.client().graphics().quality().getLodChunkRenderDistance(); } catch (Exception e) { @@ -145,7 +145,7 @@ public class ClientApi - config.getClient().getAdvancedModOptions().getDebugging().setEnableDebugKeybindings(true); + config.client().advanced().debugging().setEnableDebugKeybindings(true); } diff --git a/src/main/java/com/seibel/lod/core/config/LodConfig.java b/src/main/java/com/seibel/lod/core/config/LodConfig.java deleted file mode 100644 index 47cb463c9..000000000 --- a/src/main/java/com/seibel/lod/core/config/LodConfig.java +++ /dev/null @@ -1,651 +0,0 @@ -package com.seibel.lod.core.config; - -import com.seibel.lod.core.enums.config.BlockToAvoid; -import com.seibel.lod.core.enums.config.BufferRebuildTimes; -import com.seibel.lod.core.enums.config.DistanceGenerationMode; -import com.seibel.lod.core.enums.config.GenerationPriority; -import com.seibel.lod.core.enums.config.GpuUploadMethod; -import com.seibel.lod.core.enums.config.HorizontalQuality; -import com.seibel.lod.core.enums.config.HorizontalResolution; -import com.seibel.lod.core.enums.config.HorizontalScale; -import com.seibel.lod.core.enums.config.LodTemplate; -import com.seibel.lod.core.enums.config.VanillaOverdraw; -import com.seibel.lod.core.enums.config.VerticalQuality; -import com.seibel.lod.core.enums.rendering.DebugMode; -import com.seibel.lod.core.enums.rendering.FogDistance; -import com.seibel.lod.core.enums.rendering.FogDrawOverride; -import com.seibel.lod.core.objects.MinDefaultMax; -import com.seibel.lod.core.util.LodUtil; -import com.seibel.lod.wrappers.config.LodConfigWrapperSingleton; - -/** - * Interacts with the LodConfigWrapper to get the config - * - * @author James Seibel - * @version 11-14-2021 - */ -public class LodConfig -{ - 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 String DESC = "These settings control how detailed the fake chunks will be."; - - - - public static final String DRAW_RESOLUTION_DESC = "" - + " What is the maximum detail fake chunks should be drawn at? \n" - + " " + HorizontalResolution.CHUNK + ": render 1 LOD for each Chunk. \n" - + " " + HorizontalResolution.HALF_CHUNK + ": render 4 LODs for each Chunk. \n" - + " " + HorizontalResolution.FOUR_BLOCKS + ": render 16 LODs for each Chunk. \n" - + " " + HorizontalResolution.TWO_BLOCKS + ": render 64 LODs for each Chunk. \n" - + " " + HorizontalResolution.BLOCK + ": render 256 LODs for each Chunk. \n"; - public static final HorizontalResolution DRAW_RESOLUTION_DEFAULT = HorizontalResolution.BLOCK; - - public HorizontalResolution getDrawResolution() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.getDrawResolution(); - } - public void setDrawResolution(HorizontalResolution newHorizontalResolution) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.setDrawResolution(newHorizontalResolution); - } - - - - public static final String LOD_CHUNK_RENDER_DISTANCE_DESC = "" - + " The mod's render distance, measured in chunks. \n"; - public static final MinDefaultMax LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX = new MinDefaultMax(16, 64, 1024); - - public int getLodChunkRenderDistance() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.getLodChunkRenderDistance(); - } - public void setLodChunkRenderDistance(int newLodChunkRenderDistance) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.setLodChunkRenderDistance(newLodChunkRenderDistance); - } - - - - public static final String VERTICAL_QUALITY_DESC = "" - + " This indicates how detailed fake chunks will represent \n" - + " overhangs, caves, floating islands, ect. \n" - + " Higher options will use more memory and increase GPU usage. \n" - + " " + VerticalQuality.LOW + ": uses at max 2 columns per position. \n" - + " " + VerticalQuality.MEDIUM + ": uses at max 4 columns per position. \n" - + " " + VerticalQuality.HIGH + ": uses at max 8 columns per position. \n"; - public static final VerticalQuality VERTICAL_QUALITY_DEFAULT = VerticalQuality.MEDIUM; - - public VerticalQuality getVerticalQuality() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.getVerticalQuality(); - } - public void setVerticalQuality(VerticalQuality newVerticalQuality) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.setVerticalQuality(newVerticalQuality); - } - - - - public static final String HORIZONTAL_SCALE_DESC = "" - + " This indicates how quickly fake chunks drop off in quality. \n" - + " " + HorizontalScale.LOW + ": quality drops every " + HorizontalScale.LOW.distanceUnit / 16 + " chunks. \n" - + " " + HorizontalScale.MEDIUM + ": quality drops every " + HorizontalScale.MEDIUM.distanceUnit / 16 + " chunks. \n" - + " " + HorizontalScale.HIGH + ": quality drops every " + HorizontalScale.HIGH.distanceUnit / 16 + " chunks. \n"; - public static final HorizontalScale HORIZONTAL_SCALE_DEFAULT = HorizontalScale.MEDIUM; - - public HorizontalScale getHorizontalScale() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.getHorizontalScale(); - } - public void setLodChunkRenderDistance(HorizontalScale newHorizontalScale) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.setHorizontalScale(newHorizontalScale); - } - - - - public static final String HORIZONTAL_QUALITY_DESC = "" - + " This indicates the exponential base of the quadratic drop-off \n" - + " " + HorizontalQuality.LOWEST + ": base " + HorizontalQuality.LOWEST.quadraticBase + ". \n" - + " " + HorizontalQuality.LOW + ": base " + HorizontalQuality.LOW.quadraticBase + ". \n" - + " " + HorizontalQuality.MEDIUM + ": base " + HorizontalQuality.MEDIUM.quadraticBase + ". \n" - + " " + HorizontalQuality.HIGH + ": base " + HorizontalQuality.HIGH.quadraticBase + ". \n"; - public static final HorizontalQuality HORIZONTAL_QUALITY_DEFAULT = HorizontalQuality.MEDIUM; - - public HorizontalQuality getHorizontalQuality() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.getHorizontalQuality(); - } - public void setLodChunkRenderDistance(HorizontalQuality newHorizontalQuality) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.qualityOption.setHorizontalQuality(newHorizontalQuality); - } - } - - - public static class FogQualityOption - { - public static final String DESC = "These settings control the fog quality."; - - - - public static final String FOG_DISTANCE_DESC = "" - + " 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"; - public static final FogDistance FOG_DISTANCE_DEFAULT = FogDistance.FAR; - - public FogDistance getFogDistance() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.fogQualityOption.getFogDistance(); - } - public void setFogDistance(FogDistance newFogDistance) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.fogQualityOption.setFogDistance(newFogDistance); - } - - - - public static final String FOG_DRAW_OVERRIDE_DESC = "" - + " 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"; - public static final FogDrawOverride FOG_DRAW_OVERRIDE_DEFAULT = FogDrawOverride.FANCY; - - public FogDrawOverride getFogDrawOverride() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.fogQualityOption.getFogDrawOverride(); - } - public void setFogDrawOverride(FogDrawOverride newFogDrawOverride) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.fogQualityOption.setFogDrawOverride(newFogDrawOverride); - } - - - - public static final String DISABLE_VANILLA_FOG_DESC = "" - + " 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"; - public static final boolean DISABLE_VANILLA_FOG_DEFAULT = false; - - public boolean getDisableVanillaFog() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.fogQualityOption.getDisableVanillaFog(); - } - public void setDisableVanillaFog(boolean newDisableVanillaFog) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.fogQualityOption.setDisableVanillaFog(newDisableVanillaFog); - } - } - - - public static class AdvancedGraphicsOption - { - public static final String DESC = "Advanced graphics options for the mod"; - - - - public static final String LOD_TEMPLATE_DESC = "" - + " 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"; - public static final LodTemplate LOD_TEMPLATE_DEFAULT = LodTemplate.CUBIC; - - public LodTemplate getLodTemplate() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.getLodTemplate(); - } - public void setLodTemplate(LodTemplate newLodTemplate) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.setLodTemplate(newLodTemplate); - } - - - - public static final String DISABLE_DIRECTIONAL_CULLING_DESC = "" - + " 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"; - public static final boolean DISABLE_DIRECTIONAL_CULLING_DEFAULT = false; - - public boolean getDisableDirectionalCulling() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.getDisableDirectionalCulling(); - } - public void setDisableDirectionalCulling(boolean newDisableDirectionalCulling) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.setDisableDirectionalCulling(newDisableDirectionalCulling); - } - - - - public static final String ALWAYS_DRAW_AT_MAD_QUALITY_DESC = "" - + " 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"; - public static final boolean ALWAYS_DRAW_AT_MAD_QUALITY_DEFAULT = false; - - public boolean getAlwaysDrawAtMaxQuality() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.getAlwaysDrawAtMaxQuality(); - } - public void setAlwaysDrawAtMaxQuality(boolean newAlwaysDrawAtMaxQuality) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.setAlwaysDrawAtMaxQuality(newAlwaysDrawAtMaxQuality); - } - - - - public static final String VANILLA_OVERDRAW_DESC = "" - + " 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"; - public static final VanillaOverdraw VANILLA_OVERDRAW_DEFAULT = VanillaOverdraw.DYNAMIC; - - public VanillaOverdraw getVanillaOverdraw() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.getVanillaOverdraw(); - } - public void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.setVanillaOverdraw(newVanillaOverdraw); - } - - - - public static final String GPU_UPLOAD_METHOD_DESC = "" - + " 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"; - public static final GpuUploadMethod GPU_UPLOAD_METHOD_DEFAULT = GpuUploadMethod.BUFFER_STORAGE; - - public GpuUploadMethod getGpuUploadMethod() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.getGpuUploadMethod(); - } - public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.setGpuUploadMethod(newDisableVanillaFog); - } - - - - public static final String USE_EXTENDED_NEAR_CLIP_PLANE_DESC = "" - + " Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n" - + " especially when in/near an ocean. \n"; - public static final boolean USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT = false; - - public boolean getUseExtendedNearClipPlane() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.getUseExtendedNearClipPlane(); - } - public void setGpuUploadMethod(boolean newUseExtendedNearClipPlane) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.advancedGraphicsOption.setUseExtendedNearClipPlane(newUseExtendedNearClipPlane); - } - } - } - - - - - //========================// - // WorldGenerator Configs // - //========================// - public static class WorldGenerator - { - public static final String DESC = "These settings control how fake chunks outside your normal view range are generated."; - - - - public static final String GENERATION_PRIORITY_DESC = "" - + " " + 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"; - public static final GenerationPriority GENERATION_PRIORITY_DEFAULT = GenerationPriority.FAR_FIRST; - - public GenerationPriority getGenerationPriority() - { - return LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.getGenerationPriority(); - } - public void setGenerationPriority(GenerationPriority newGenerationPriority) - { - LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.setGenerationPriority(newGenerationPriority); - } - - - - public static final String DISTANCE_GENERATION_MODE_DESC = "" - + " 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"; - public static final DistanceGenerationMode DISTANCE_GENERATION_MODE_DEFAULT = DistanceGenerationMode.SURFACE; - - public DistanceGenerationMode getDistanceGenerationMode() - { - return LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.getDistanceGenerationMode(); - } - public void setDistanceGenerationMode(DistanceGenerationMode newDistanceGenerationMode) - { - LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.setDistanceGenerationMode(newDistanceGenerationMode); - } - - - - public static final String ALLOW_UNSTABLE_FEATURE_GENERATION_DESC = "" - + " 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"; - public static final boolean ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT = false; - - public boolean getAllowUnstableFeatureGeneration() - { - return LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.getAllowUnstableFeatureGeneration(); - } - public void setAllowUnstableFeatureGeneration(boolean newAllowUnstableFeatureGeneration) - { - LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.setAllowUnstableFeatureGeneration(newAllowUnstableFeatureGeneration); - } - - - - public static final String BLOCK_TO_AVOID_DESC = "" - + " " + 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"; - public static final BlockToAvoid BLOCK_TO_AVOID_DEFAULT = BlockToAvoid.BOTH; - - public BlockToAvoid getBlockToAvoid() - { - return LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.getBlockToAvoid(); - } - public void setBlockToAvoid(BlockToAvoid newBlockToAvoid) - { - LodConfigWrapperSingleton.INSTANCE.LodConfigWrapperSingleton.INSTANCE.worldGenerator.setBlockToAvoid(newBlockToAvoid); - } - } - - - - - //============================// - // AdvancedModOptions Configs // - //============================// - public static class AdvancedModOptions - { - - public final Threading threading; - public final Debugging debugging; - public final Buffers buffers; - - public AdvancedModOptions() - { - threading = new Threading(); - debugging = new Debugging(); - buffers = new Buffers(); - } - - public static class Threading - { - public static final String DESC = "These settings control how many CPU threads the mod uses for different tasks."; - - - - public static final String NUMBER_OF_WORLD_GENERATION_THREADS_DESC = "" - + " 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"; - public static final MinDefaultMax NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT = new MinDefaultMax(1, Runtime.getRuntime().availableProcessors() / 2, Runtime.getRuntime().availableProcessors()); - - public int getNumberOfWorldGenerationThreads() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.threading.getNumberOfWorldGenerationThreads(); - } - public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.threading.setNumberOfWorldGenerationThreads(newNumberOfWorldGenerationThreads); - } - - - - public static final String NUMBER_OF_BUFFER_BUILDER_THREADS_DESC = "" - + " 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"; - public static final MinDefaultMax NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX = new MinDefaultMax(1, Runtime.getRuntime().availableProcessors() / 2, Runtime.getRuntime().availableProcessors()); - - public int getNumberOfBufferBuilderThreads() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.threading.getNumberOfBufferBuilderThreads(); - } - public void setNumberOfBufferBuilderThreads(int newNumberOfWorldBuilderThreads) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.threading.setNumberOfBufferBuilderThreads(newNumberOfWorldBuilderThreads); - } - } - - - - - //===============// - // Debug Options // - //===============// - public static class Debugging - { - public static final String DESC = "These settings can be used to look for bugs, or see how certain aspects of the mod work."; - - - - public static final String DRAW_LODS_DESC = "" - + " 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"; - public static final boolean DRAW_LODS_DEFAULT = true; - - public boolean getDrawLods() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.debugging.getDrawLods(); - } - public void setDrawLods(boolean newDrawLods) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.debugging.setDrawLods(newDrawLods); - } - - - - public static final String DEBUG_MODE_DESC = "" - + " " + 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"; - public static final DebugMode DEBUG_MODE_DEFAULT = DebugMode.OFF; - - public DebugMode getDebugMode() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.debugging.getDebugMode(); - } - public void setDebugMode(DebugMode newDebugMode) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.debugging.setDebugMode(newDebugMode); - } - - - - public static final String ENABLE_DEBUG_KEYBINDINGS_DESC = "" - + " 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."; - public static final boolean ENABLE_DEBUG_KEYBINDINGS_DEFAULT = true; - - public boolean getEnableDebugKeybindings() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.debugging.getEnableDebugKeybindings(); - } - public void setEnableDebugKeybindings(boolean newEnableDebugKeybindings) - { - LodConfigWrapperSingleton.INSTANCE.getClient().LodConfigWrapperSingleton.INSTANCE.debugging.setEnableDebugKeybindings(newEnableDebugKeybindings); - } - } - - - public static class Buffers - { - public static final String DESC = "These settings affect how often geometry is rebuilt."; - - - - public static final String REBUILD_TIMES_DESC = "" - + " 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"; - public static final BufferRebuildTimes REBUILD_TIMES_DEFAULT = BufferRebuildTimes.NORMAL; - - public BufferRebuildTimes getDrawLods() - { - return LodConfigWrapperSingleton.INSTANCE.getClient().getAdvancedModOptions().getBuffers().getRebuildTimes(); - } - public void setDrawLods(BufferRebuildTimes newBufferRebuildTimes) - { - LodConfigWrapperSingleton.INSTANCE.getClient().getAdvancedModOptions().getBuffers().setRebuildTimes(newBufferRebuildTimes); - } - } - } - } - -} diff --git a/src/main/java/com/seibel/lod/core/render/LodRenderer.java b/src/main/java/com/seibel/lod/core/render/LodRenderer.java index aba575e83..59f447233 100644 --- a/src/main/java/com/seibel/lod/core/render/LodRenderer.java +++ b/src/main/java/com/seibel/lod/core/render/LodRenderer.java @@ -463,7 +463,7 @@ public class LodRenderer if (fogQuality == FogQuality.FANCY) { // for more realistic fog when using FAR - if (ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.get() == FogDistance.NEAR_AND_FAR) + if (ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.get() == FogDistance.NEAR_AND_FAR) GL15.glFogf(GL15.GL_FOG_START, farPlaneBlockDistance * 1.6f * 0.9f); else GL15.glFogf(GL15.GL_FOG_START, Math.min(vanillaBlockRenderedDistance * 1.5f, farPlaneBlockDistance * 0.9f * 1.6f)); @@ -518,7 +518,7 @@ public class LodRenderer // disable fog if Minecraft wasn't rendering fog // or we want it disabled if (!fogSettings.vanillaIsRenderingFog - || ForgeConfig.CLIENT.graphics.fogQualityOption.disableVanillaFog.get()) + || ForgeConfig.CLIENT.graphics.fogQuality.disableVanillaFog.get()) { // Make fog render a infinite distance away. // This doesn't technically disable Minecraft's fog @@ -698,7 +698,7 @@ public class LodRenderer FogQuality quality = ReflectionHandler.INSTANCE.getFogQuality(); - FogDrawOverride override = ForgeConfig.CLIENT.graphics.fogQualityOption.fogDrawOverride.get(); + FogDrawOverride override = ForgeConfig.CLIENT.graphics.fogQuality.fogDrawOverride.get(); fogSettings.vanillaIsRenderingFog = quality != FogQuality.OFF; @@ -739,7 +739,7 @@ public class LodRenderer fogSettings.near.quality = FogQuality.FANCY; fogSettings.far.quality = FogQuality.FANCY; - switch (ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.get()) + switch (ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.get()) { case NEAR_AND_FAR: fogSettings.near.distance = FogDistance.NEAR; @@ -766,7 +766,7 @@ public class LodRenderer // fog, since the LODs are separated into a near // and far portion; and fast fog is rendered from the // frustrum's perspective instead of the camera - switch (ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.get()) + switch (ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.get()) { case NEAR_AND_FAR: case NEAR: @@ -803,14 +803,14 @@ public class LodRenderer // check if the view distance changed if (ApiShared.previousLodRenderDistance != ForgeConfig.CLIENT.graphics.qualityOption.lodChunkRenderDistance.get() || chunkRenderDistance != prevRenderDistance - || prevFogDistance != ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.get()) + || prevFogDistance != ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.get()) { vanillaRenderedChunks = new boolean[vanillaRenderedChunksWidth][vanillaRenderedChunksWidth]; DetailDistanceUtil.updateSettings(); fullRegen = true; previousPos = LevelPosUtil.createLevelPos((byte) 4, mc.getPlayerChunkPos().getZ(), mc.getPlayerChunkPos().getZ()); - prevFogDistance = ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.get(); + prevFogDistance = ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.get(); prevRenderDistance = chunkRenderDistance; } diff --git a/src/main/java/com/seibel/lod/core/wrapperAdapters/config/ILodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperAdapters/config/ILodConfigWrapperSingleton.java index 16f81da77..df24ee508 100644 --- a/src/main/java/com/seibel/lod/core/wrapperAdapters/config/ILodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperAdapters/config/ILodConfigWrapperSingleton.java @@ -14,25 +14,26 @@ import com.seibel.lod.core.enums.config.VerticalQuality; import com.seibel.lod.core.enums.rendering.DebugMode; import com.seibel.lod.core.enums.rendering.FogDistance; import com.seibel.lod.core.enums.rendering.FogDrawOverride; +import com.seibel.lod.core.objects.MinDefaultMax; +import com.seibel.lod.core.util.LodUtil; /** * 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-15-2021 + * @version 11-16-2021 */ public interface ILodConfigWrapperSingleton { - public ILodConfigWrapperSingleton getInstance(); + public IClient client(); - public IClient getClient(); public interface IClient { - public IGraphics getGraphics(); - public IWorldGenerator getWorldGenerator(); - public IAdvancedModOptions getAdvancedModOptions(); + public IGraphics graphics(); + public IWorldGenerator worldGenerator(); + public IAdvanced advanced(); //==================// @@ -40,58 +41,169 @@ public interface ILodConfigWrapperSingleton //==================// public interface IGraphics { - public IQualityOption getQualityOption(); - public IFogQualityOption getFogQualityOption(); - public IAdvancedGraphicsOption getAdvancedGraphicsOption(); + public static final String DESC = "These settings control how the mod will look in game"; + + public IQuality quality(); + public IFogQuality fogQuality(); + public IAdvancedGraphics advancedGraphics(); - public interface IQualityOption + public interface IQuality { + public static final String DESC = "These settings control how detailed the fake chunks will be."; + + HorizontalResolution DRAW_RESOLUTION_DEFAULT = HorizontalResolution.BLOCK; + public static final String DRAW_RESOLUTION_DESC = "" + + " What is the maximum detail fake chunks should be drawn at? \n" + + " " + HorizontalResolution.CHUNK + ": render 1 LOD for each Chunk. \n" + + " " + HorizontalResolution.HALF_CHUNK + ": render 4 LODs for each Chunk. \n" + + " " + HorizontalResolution.FOUR_BLOCKS + ": render 16 LODs for each Chunk. \n" + + " " + HorizontalResolution.TWO_BLOCKS + ": render 64 LODs for each Chunk. \n" + + " " + HorizontalResolution.BLOCK + ": render 256 LODs for each Chunk. \n"; public HorizontalResolution getDrawResolution(); public void setDrawResolution(HorizontalResolution newHorizontalResolution); + MinDefaultMax LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX = new MinDefaultMax(16, 64, 1024); + String LOD_CHUNK_RENDER_DISTANCE_DESC = "" + + " The mod's render distance, measured in chunks. \n"; public int getLodChunkRenderDistance(); public void setLodChunkRenderDistance(int newLodChunkRenderDistance); + VerticalQuality VERTICAL_QUALITY_DEFAULT = VerticalQuality.MEDIUM; + String VERTICAL_QUALITY_DESC = "" + + " This indicates how detailed fake chunks will represent \n" + + " overhangs, caves, floating islands, ect. \n" + + " Higher options will use more memory and increase GPU usage. \n" + + " " + VerticalQuality.LOW + ": uses at max 2 columns per position. \n" + + " " + VerticalQuality.MEDIUM + ": uses at max 4 columns per position. \n" + + " " + VerticalQuality.HIGH + ": uses at max 8 columns per position. \n"; public VerticalQuality getVerticalQuality(); public void setVerticalQuality(VerticalQuality newVerticalQuality); + HorizontalScale HORIZONTAL_SCALE_DEFAULT = HorizontalScale.MEDIUM; + String HORIZONTAL_SCALE_DESC = "" + + " This indicates how quickly fake chunks drop off in quality. \n" + + " " + HorizontalScale.LOW + ": quality drops every " + HorizontalScale.LOW.distanceUnit / 16 + " chunks. \n" + + " " + HorizontalScale.MEDIUM + ": quality drops every " + HorizontalScale.MEDIUM.distanceUnit / 16 + " chunks. \n" + + " " + HorizontalScale.HIGH + ": quality drops every " + HorizontalScale.HIGH.distanceUnit / 16 + " chunks. \n"; public HorizontalScale getHorizontalScale(); public void setHorizontalScale(HorizontalScale newHorizontalScale); + HorizontalQuality HORIZONTAL_QUALITY_DEFAULT = HorizontalQuality.MEDIUM; + String HORIZONTAL_QUALITY_DESC = "" + + " This indicates the exponential base of the quadratic drop-off \n" + + " " + HorizontalQuality.LOWEST + ": base " + HorizontalQuality.LOWEST.quadraticBase + ". \n" + + " " + HorizontalQuality.LOW + ": base " + HorizontalQuality.LOW.quadraticBase + ". \n" + + " " + HorizontalQuality.MEDIUM + ": base " + HorizontalQuality.MEDIUM.quadraticBase + ". \n" + + " " + HorizontalQuality.HIGH + ": base " + HorizontalQuality.HIGH.quadraticBase + ". \n"; public HorizontalQuality getHorizontalQuality(); public void setHorizontalQuality(HorizontalQuality newHorizontalQuality); } - public interface IFogQualityOption + public interface IFogQuality { + String DESC = "These settings control the fog quality."; + + FogDistance FOG_DISTANCE_DEFAULT = FogDistance.FAR; + String FOG_DISTANCE_DESC = "" + + " 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"; public FogDistance getFogDistance(); public void setFogDistance(FogDistance newFogDistance); + FogDrawOverride FOG_DRAW_OVERRIDE_DEFAULT = FogDrawOverride.FANCY; + String FOG_DRAW_OVERRIDE_DESC = "" + + " 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"; public FogDrawOverride getFogDrawOverride(); public void setFogDrawOverride(FogDrawOverride newFogDrawOverride); + boolean DISABLE_VANILLA_FOG_DEFAULT = false; + String DISABLE_VANILLA_FOG_DESC = "" + + " 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"; public boolean getDisableVanillaFog(); public void setDisableVanillaFog(boolean newDisableVanillaFog); } - public interface IAdvancedGraphicsOption + public interface IAdvancedGraphics { + String DESC = "Graphics options that are a bit more technical."; + + LodTemplate LOD_TEMPLATE_DEFAULT = LodTemplate.CUBIC; + String LOD_TEMPLATE_DESC = "" + + " 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"; public LodTemplate getLodTemplate(); public void setLodTemplate(LodTemplate newLodTemplate); + boolean DISABLE_DIRECTIONAL_CULLING_DEFAULT = false; + String DISABLE_DIRECTIONAL_CULLING_DESC = "" + + " 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"; public boolean getDisableDirectionalCulling(); public void setDisableDirectionalCulling(boolean newDisableDirectionalCulling); + boolean ALWAYS_DRAW_AT_MAD_QUALITY_DEFAULT = false; + String ALWAYS_DRAW_AT_MAD_QUALITY_DESC = "" + + " 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"; public boolean getAlwaysDrawAtMaxQuality(); public void setAlwaysDrawAtMaxQuality(boolean newAlwaysDrawAtMaxQuality); + VanillaOverdraw VANILLA_OVERDRAW_DEFAULT = VanillaOverdraw.DYNAMIC; + String VANILLA_OVERDRAW_DESC = "" + + " 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"; public VanillaOverdraw getVanillaOverdraw(); public void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw); + GpuUploadMethod GPU_UPLOAD_METHOD_DEFAULT = GpuUploadMethod.BUFFER_STORAGE; + String GPU_UPLOAD_METHOD_DESC = "" + + " 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"; public GpuUploadMethod getGpuUploadMethod(); public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog); + boolean USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT = false; + String USE_EXTENDED_NEAR_CLIP_PLANE_DESC = "" + + " Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n" + + " especially when in/near an ocean. \n"; public boolean getUseExtendedNearClipPlane(); public void setUseExtendedNearClipPlane(boolean newUseExtendedNearClipPlane); } @@ -105,15 +217,93 @@ public interface ILodConfigWrapperSingleton //========================// public interface IWorldGenerator { + String DESC = "These settings control how fake chunks outside your normal view range are generated."; + + GenerationPriority GENERATION_PRIORITY_DEFAULT = GenerationPriority.FAR_FIRST; + String GENERATION_PRIORITY_DESC = "" + + " " + 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"; public GenerationPriority getGenerationPriority(); public void setGenerationPriority(GenerationPriority newGenerationPriority); - + + DistanceGenerationMode DISTANCE_GENERATION_MODE_DEFAULT = DistanceGenerationMode.SURFACE; + String DISTANCE_GENERATION_MODE_DESC = "" + + " 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"; public DistanceGenerationMode getDistanceGenerationMode(); public void setDistanceGenerationMode(DistanceGenerationMode newDistanceGenerationMode); + boolean ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT = false; + String ALLOW_UNSTABLE_FEATURE_GENERATION_DESC = "" + + " 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"; public boolean getAllowUnstableFeatureGeneration(); public void setAllowUnstableFeatureGeneration(boolean newAllowUnstableFeatureGeneration); + BlockToAvoid BLOCK_TO_AVOID_DEFAULT = BlockToAvoid.BOTH; + String BLOCK_TO_AVOID_DESC = "" + + " " + 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"; public BlockToAvoid getBlockToAvoid(); public void setBlockToAvoid(BlockToAvoid newBlockToAvoid); } @@ -124,36 +314,87 @@ public interface ILodConfigWrapperSingleton //============================// // AdvancedModOptions Configs // //============================// - public interface IAdvancedModOptions + public interface IAdvanced { - public IThreading getThreading(); - public IDebugging getDebugging(); - public IBuffers getBuffers(); + public static final String DESC = "Advanced mod settings"; + + public IThreading threading(); + public IDebugging debugging(); + public IBuffers buffers(); public interface IThreading { + String DESC = "These settings control how many CPU threads the mod uses for different tasks."; + + MinDefaultMax NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT + = new MinDefaultMax(1, + Runtime.getRuntime().availableProcessors() / 2, + Runtime.getRuntime().availableProcessors()); + String NUMBER_OF_WORLD_GENERATION_THREADS_DESC = "" + + " 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"; public int getNumberOfWorldGenerationThreads(); public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads); + MinDefaultMax NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX + = new MinDefaultMax(1, + Runtime.getRuntime().availableProcessors() / 2, + Runtime.getRuntime().availableProcessors()); + String NUMBER_OF_BUFFER_BUILDER_THREADS_DESC = "" + + " 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"; public int getNumberOfBufferBuilderThreads(); public void setNumberOfBufferBuilderThreads(int newNumberOfWorldBuilderThreads); } public interface IDebugging { + String DESC = "These settings can be used to look for bugs, or see how certain aspects of the mod work."; + + boolean DRAW_LODS_DEFAULT = true; + String DRAW_LODS_DESC = "" + + " 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"; public boolean getDrawLods(); public void setDrawLods(boolean newDrawLods); + DebugMode DEBUG_MODE_DEFAULT = DebugMode.OFF; + String DEBUG_MODE_DESC = "" + + " " + 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"; public DebugMode getDebugMode(); public void setDebugMode(DebugMode newDebugMode); - + + boolean ENABLE_DEBUG_KEYBINDINGS_DEFAULT = true; + String ENABLE_DEBUG_KEYBINDINGS_DESC = "" + + " 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."; public boolean getEnableDebugKeybindings(); public void setEnableDebugKeybindings(boolean newEnableDebugKeybindings); } public interface IBuffers { + String DESC = "These settings affect how often geometry is rebuilt."; + + String REBUILD_TIMES_DESC = "" + + " 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"; + BufferRebuildTimes REBUILD_TIMES_DEFAULT = BufferRebuildTimes.NORMAL; public BufferRebuildTimes getRebuildTimes(); public void setRebuildTimes(BufferRebuildTimes newBufferRebuildTimes); } diff --git a/src/main/java/com/seibel/lod/wrappers/config/LodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/wrappers/config/LodConfigWrapperSingleton.java index 27b417b6e..78d8227b7 100644 --- a/src/main/java/com/seibel/lod/wrappers/config/LodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/wrappers/config/LodConfigWrapperSingleton.java @@ -22,21 +22,16 @@ import com.seibel.lod.core.wrapperAdapters.config.ILodConfigWrapperSingleton; * that should be hooked into the host mod loader (Fabric, Forge, etc.). * * @author James Seibel - * @version 11-14-2021 + * @version 11-16-2021 */ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { public static final LodConfigWrapperSingleton INSTANCE = new LodConfigWrapperSingleton(); - @Override - public ILodConfigWrapperSingleton getInstance() - { - return INSTANCE; - } private static final Client client = new Client(); @Override - public IClient getClient() + public IClient client() { return client; } @@ -45,25 +40,25 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { public final IGraphics graphics; public final IWorldGenerator worldGenerator; - public final IAdvancedModOptions advancedModOptions; + public final IAdvanced advanced; @Override - public IGraphics getGraphics() + public IGraphics graphics() { return graphics; } @Override - public IWorldGenerator getWorldGenerator() + public IWorldGenerator worldGenerator() { return worldGenerator; } @Override - public IAdvancedModOptions getAdvancedModOptions() + public IAdvanced advanced() { - return advancedModOptions; + return advanced; } @@ -75,7 +70,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { graphics = new Graphics(); worldGenerator = new WorldGenerator(); - advancedModOptions = new AdvancedModOptions(); + advanced = new Advanced(); } @@ -84,40 +79,40 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton //==================// public static class Graphics implements IGraphics { - public final IQualityOption qualityOption; - public final IFogQualityOption fogQualityOption; - public final IAdvancedGraphicsOption advancedGraphicsOption; + public final IQuality quality; + public final IFogQuality fogQuality; + public final IAdvancedGraphics advancedGraphics; @Override - public IQualityOption getQualityOption() + public IQuality quality() { - return qualityOption; + return quality; } @Override - public IFogQualityOption getFogQualityOption() + public IFogQuality fogQuality() { - return fogQualityOption; + return fogQuality; } @Override - public IAdvancedGraphicsOption getAdvancedGraphicsOption() + public IAdvancedGraphics advancedGraphics() { - return advancedGraphicsOption; + return advancedGraphics; } Graphics() { - qualityOption = new QualityOption(); - advancedGraphicsOption = new AdvancedGraphicsOption(); - fogQualityOption = new FogQualityOption(); + quality = new Quality(); + advancedGraphics = new AdvancedGraphics(); + fogQuality = new FogQuality(); } - public static class QualityOption implements IQualityOption + public static class Quality implements IQuality { @Override public HorizontalResolution getDrawResolution() @@ -180,46 +175,46 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton } - public static class FogQualityOption implements IFogQualityOption + public static class FogQuality implements IFogQuality { @Override public FogDistance getFogDistance() { - return ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.get(); + return ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.get(); } @Override public void setFogDistance(FogDistance newFogDistance) { - ForgeConfig.CLIENT.graphics.fogQualityOption.fogDistance.set(newFogDistance); + ForgeConfig.CLIENT.graphics.fogQuality.fogDistance.set(newFogDistance); } @Override public FogDrawOverride getFogDrawOverride() { - return ForgeConfig.CLIENT.graphics.fogQualityOption.fogDrawOverride.get(); + return ForgeConfig.CLIENT.graphics.fogQuality.fogDrawOverride.get(); } @Override public void setFogDrawOverride(FogDrawOverride newFogDrawOverride) { - ForgeConfig.CLIENT.graphics.fogQualityOption.fogDrawOverride.set(newFogDrawOverride); + ForgeConfig.CLIENT.graphics.fogQuality.fogDrawOverride.set(newFogDrawOverride); } @Override public boolean getDisableVanillaFog() { - return ForgeConfig.CLIENT.graphics.fogQualityOption.disableVanillaFog.get(); + return ForgeConfig.CLIENT.graphics.fogQuality.disableVanillaFog.get(); } @Override public void setDisableVanillaFog(boolean newDisableVanillaFog) { - ForgeConfig.CLIENT.graphics.fogQualityOption.disableVanillaFog.set(newDisableVanillaFog); + ForgeConfig.CLIENT.graphics.fogQuality.disableVanillaFog.set(newDisableVanillaFog); } } - public static class AdvancedGraphicsOption implements IAdvancedGraphicsOption + public static class AdvancedGraphics implements IAdvancedGraphics { @Override public LodTemplate getLodTemplate() @@ -356,7 +351,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton //============================// // AdvancedModOptions Configs // //============================// - public static class AdvancedModOptions implements IAdvancedModOptions + public static class Advanced implements IAdvanced { public final IThreading threading; public final IDebugging debugging; @@ -364,27 +359,27 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton @Override - public IThreading getThreading() + public IThreading threading() { return threading; } @Override - public IDebugging getDebugging() + public IDebugging debugging() { return debugging; } @Override - public IBuffers getBuffers() + public IBuffers buffers() { return buffers; } - public AdvancedModOptions() + public Advanced() { threading = new Threading(); debugging = new Debugging();