From 43107216405b8bd8ac9902fc718fb2ad98515ddb Mon Sep 17 00:00:00 2001 From: coolGi2007 Date: Fri, 29 Apr 2022 14:18:29 +0930 Subject: [PATCH] New config finally done --- src/main/java/com/seibel/lod/core/Config.java | 365 ++++++++++++--- .../java/com/seibel/lod/core/ModInfo.java | 10 +- .../seibel/lod/core/config/ConfigBase.java | 5 +- .../core/config/file/ConfigFileHandling.java | 12 +- .../lod/core/config/types/ConfigCategory.java | 1 - .../lod/core/config/types/ConfigEntry.java | 44 +- .../lod/core/jar/JarDependencySetup.java | 2 +- .../lod/core/objects/MinDefaultMax.java | 1 + .../config/IConfigWrapper.java | 4 +- .../config/ILodConfigWrapperSingleton.java | 10 +- .../config/LodConfigWrapperSingleton.java | 420 +++++++++++++++++- src/main/resources/assets/lod/lang/en_us.json | 8 +- 12 files changed, 763 insertions(+), 119 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/Config.java b/src/main/java/com/seibel/lod/core/Config.java index 6135e82a7..dd407d38d 100644 --- a/src/main/java/com/seibel/lod/core/Config.java +++ b/src/main/java/com/seibel/lod/core/Config.java @@ -1,19 +1,48 @@ +/* + * This file is part of the Distant Horizons mod (formerly the LOD Mod), + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2022 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + package com.seibel.lod.core; + import com.seibel.lod.core.config.*; -import com.seibel.lod.core.config.types.ConfigCategory; -import com.seibel.lod.core.config.types.ConfigEntry; +import com.seibel.lod.core.config.types.*; + import com.seibel.lod.core.enums.config.*; import com.seibel.lod.core.enums.rendering.*; -import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; -import java.util.HashMap; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced.*; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.*; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.IAdvancedFog; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.IAdvancedFog.IHeightFog; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IMultiplayer; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.*; + /** * This handles any configuration the user has access to. * @author coolGi2007 - * @version 02-07-2022 + * @version 04-29-2022 */ + public class Config { // CONFIG STRUCTURE @@ -31,26 +60,26 @@ public class Config // |-> Buffers // |-> Debugging + // Since the original config system uses forge stuff, that means we have to rewrite the whole config system + public static ConfigCategory client = new ConfigCategory.Builder().set(Client.class).build(); + public static class Client { public static ConfigCategory graphics = new ConfigCategory.Builder().set(Graphics.class).build(); public static ConfigCategory worldGenerator = new ConfigCategory.Builder().set(WorldGenerator.class).build(); - public static ConfigCategory advanced = new ConfigCategory.Builder().set(Advanced.class).build(); + public static ConfigCategory multiplayer = new ConfigCategory.Builder().set(Multiplayer.class).build(); + public static ConfigCategory advanced = new ConfigCategory.Builder().set(Advanced.class).build(); public static ConfigEntry optionsButton = new ConfigEntry.Builder() .comment(ILodConfigWrapperSingleton.IClient.OPTIONS_BUTTON_DESC) .set(ILodConfigWrapperSingleton.IClient.OPTIONS_BUTTON_DEFAULT) .build(); -// public static ConfigEntry> testMultiOption = new ConfigEntry.Builder>() -// .set(new HashMap<>() {{put("overworld", true); put("nether", false);}}) -// .build(); - public static class Graphics { @@ -63,36 +92,39 @@ public class Config public static class Quality { - public static ConfigEntry drawResolution = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.DRAW_RESOLUTION_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.DRAW_RESOLUTION_DEFAULT) + public static ConfigEntry drawResolution = new ConfigEntry.Builder() + .comment(IQuality.DRAW_RESOLUTION_DESC) + .set(IQuality.DRAW_RESOLUTION_DEFAULT) .build(); public static ConfigEntry lodChunkRenderDistance = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.defaultValue) - .setMinMax(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.minValue, ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.maxValue) + .comment(IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC) + .setMinDefaultMax(IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX) .build(); public static ConfigEntry verticalQuality = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.VERTICAL_QUALITY_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.VERTICAL_QUALITY_DEFAULT) + .comment(IQuality.VERTICAL_QUALITY_DESC) + .set(IQuality.VERTICAL_QUALITY_DEFAULT) .build(); public static ConfigEntry horizontalScale = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.HORIZONTAL_SCALE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.defaultValue) - .setMinMax(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.minValue, ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.maxValue) + .comment(IQuality.HORIZONTAL_SCALE_DESC) + .setMinDefaultMax(IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX) .build(); public static ConfigEntry horizontalQuality = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.HORIZONTAL_SCALE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.HORIZONTAL_QUALITY_DEFAULT) + .comment(IQuality.HORIZONTAL_SCALE_DESC) + .set(IQuality.HORIZONTAL_QUALITY_DEFAULT) .build(); public static ConfigEntry dropoffQuality = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.DROPOFF_QUALITY_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IQuality.DROPOFF_QUALITY_DEFAULT) + .comment(IQuality.DROPOFF_QUALITY_DESC) + .set(IQuality.DROPOFF_QUALITY_DEFAULT) + .build(); + + public static ConfigEntry lodBiomeBlending = new ConfigEntry.Builder() + .comment(IQuality.LOD_BIOME_BLENDING_DESC) + .setMinDefaultMax(IQuality.LOD_BIOME_BLENDING_MIN_DEFAULT_MAX) .build(); } @@ -100,45 +132,163 @@ public class Config public static class FogQuality { public static ConfigEntry fogDistance = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.FOG_DISTANCE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.FOG_DISTANCE_DEFAULT) + .comment(IFogQuality.FOG_DISTANCE_DESC) + .set(IFogQuality.FOG_DISTANCE_DEFAULT) .build(); public static ConfigEntry fogDrawMode = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.FOG_DRAW_MODE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.FOG_DRAW_MODE_DEFAULT) + .comment(IFogQuality.FOG_DRAW_MODE_DESC) + .set(IFogQuality.FOG_DRAW_MODE_DEFAULT) .build(); public static ConfigEntry fogColorMode = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.FOG_COLOR_MODE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.FOG_COLOR_MODE_DEFAULT) + .comment(IFogQuality.FOG_COLOR_MODE_DESC) + .set(IFogQuality.FOG_COLOR_MODE_DEFAULT) .build(); public static ConfigEntry disableVanillaFog = new ConfigEntry.Builder() .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.DISABLE_VANILLA_FOG_DESC) .set(ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.DISABLE_VANILLA_FOG_DEFAULT) .build(); + + public static ConfigCategory advancedFog = new ConfigCategory.Builder().set(AdvancedFog.class).build(); + + + public static class AdvancedFog { + public static ConfigEntry farFogStart = new ConfigEntry.Builder() + .comment(IAdvancedFog.FAR_FOG_START_DESC) + .setMinDefaultMax(IAdvancedFog.FAR_FOG_START_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry farFogEnd = new ConfigEntry.Builder() + .comment(IAdvancedFog.FAR_FOG_END_DESC) + .setMinDefaultMax(IAdvancedFog.FAR_FOG_END_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry farFogMin = new ConfigEntry.Builder() + .comment(IAdvancedFog.FAR_FOG_MIN_DESC) + .setMinDefaultMax(IAdvancedFog.FAR_FOG_MIN_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry farFogMax = new ConfigEntry.Builder() + .comment(IAdvancedFog.FAR_FOG_MAX_DESC) + .setMinDefaultMax(IAdvancedFog.FAR_FOG_MAX_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry farFogType = new ConfigEntry.Builder() + .comment(IAdvancedFog.FAR_FOG_TYPE_DESC) + .set(IAdvancedFog.FAR_FOG_TYPE_DEFAULT) + .build(); + + public static ConfigEntry farFogDensity = new ConfigEntry.Builder() + .comment(IAdvancedFog.FAR_FOG_DENSITY_DESC) + .setMinDefaultMax(IAdvancedFog.FAR_FOG_DENSITY_MIN_DEFAULT_MAX) + .build(); + + public static ConfigCategory heightFog = new ConfigCategory.Builder().set(HeightFog.class).build(); + + + public static class HeightFog { + public static ConfigEntry heightFogMixMode = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_MIX_MODE_DESC) + .set(IHeightFog.HEIGHT_FOG_MIX_MODE_DEFAULT) + .build(); + + public static ConfigEntry heightFogMode = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_MODE_DESC) + .set(IHeightFog.HEIGHT_FOG_MODE_DEFAULT) + .build(); + + public static ConfigEntry heightFogHeight = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_HEIGHT_DESC) + .setMinDefaultMax(IHeightFog.HEIGHT_FOG_HEIGHT_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry heightFogStart = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_START_DESC) + .setMinDefaultMax(IHeightFog.HEIGHT_FOG_START_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry heightFogEnd = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_END_DESC) + .setMinDefaultMax(IHeightFog.HEIGHT_FOG_END_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry heightFogMin = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_MIN_DESC) + .setMinDefaultMax(IHeightFog.HEIGHT_FOG_MIN_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry heightFogMax = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_MAX_DESC) + .setMinDefaultMax(IHeightFog.HEIGHT_FOG_MAX_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry heightFogType = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_TYPE_DESC) + .set(IHeightFog.HEIGHT_FOG_TYPE_DEFAULT) + .build(); + + public static ConfigEntry heightFogDensity = new ConfigEntry.Builder() + .comment(IHeightFog.HEIGHT_FOG_DENSITY_DESC) + .setMinDefaultMax(IHeightFog.HEIGHT_FOG_DENSITY_MIN_DEFAULT_MAX) + .build(); + + } + } } public static class AdvancedGraphics { public static ConfigEntry disableDirectionalCulling = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DEFAULT) + .comment(IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DESC) + .set(IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DEFAULT) .build(); public static ConfigEntry vanillaOverdraw = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics.VANILLA_OVERDRAW_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT) + .comment(IAdvancedGraphics.VANILLA_OVERDRAW_DESC) + .set(IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT) + .build(); + + public static ConfigEntry overdrawOffset = new ConfigEntry.Builder() + .comment(IAdvancedGraphics.OVERDRAW_OFFSET_DESC) + .setMinDefaultMax(IAdvancedGraphics.OVERDRAW_OFFSET_MIN_DEFAULT_MAX) .build(); public static ConfigEntry useExtendedNearClipPlane = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IGraphics.IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT) + .comment(IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC) + .set(IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT) + .build(); + + public static ConfigEntry brightnessMultiplier = new ConfigEntry.Builder() + .comment(IAdvancedGraphics.BRIGHTNESS_MULTIPLIER_DESC) + .set(IAdvancedGraphics.BRIGHTNESS_MULTIPLIER_DEFAULT) + .build(); + + public static ConfigEntry saturationMultiplier = new ConfigEntry.Builder() + .comment(IAdvancedGraphics.SATURATION_MULTIPLIER_DESC) + .set(IAdvancedGraphics.SATURATION_MULTIPLIER_DEFAULT) + .build(); + + public static ConfigEntry enableCaveCulling = new ConfigEntry.Builder() + .comment(IAdvancedGraphics.ENABLE_CAVE_CULLING_DESC) + .set(IAdvancedGraphics.ENABLE_CAVE_CULLING_DEFAULT) + .build(); + + public static ConfigEntry caveCullingHeight = new ConfigEntry.Builder() + .comment(IAdvancedGraphics.CAVE_CULLING_HEIGHT_DESC) + .setMinDefaultMax(IAdvancedGraphics.CAVE_CULLING_HEIGHT_MIN_DEFAULT_MAX) + .build(); + + public static ConfigEntry earthCurveRatio = new ConfigEntry.Builder() + .comment(IAdvancedGraphics.EARTH_CURVE_RATIO_DESC) + .setMinDefaultMax(IAdvancedGraphics.EARTH_CURVE_RATIO_MIN_DEFAULT_MAX) .build(); /* + @ConfigAnnotations.FileComment + public static String _backsideCullingRange = IAdvancedGraphics.VANILLA_CULLING_RANGE_DESC; @ConfigAnnotations.Entry(minValue = 0, maxValue = 512) public static int backsideCullingRange = IAdvancedGraphics.VANILLA_CULLING_RANGE_MIN_DEFAULT_MAX.defaultValue; */ @@ -149,31 +299,47 @@ public class Config public static class WorldGenerator { public static ConfigEntry enableDistantGeneration = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IWorldGenerator.ENABLE_DISTANT_GENERATION_DESC) - .set(ILodConfigWrapperSingleton.IClient.IWorldGenerator.ENABLE_DISTANT_GENERATION_DEFAULT) + .comment(IWorldGenerator.ENABLE_DISTANT_GENERATION_DESC) + .set(IWorldGenerator.ENABLE_DISTANT_GENERATION_DEFAULT) .build(); public static ConfigEntry distanceGenerationMode = new ConfigEntry.Builder() - //.comment(ILodConfigWrapperSingleton.IClient.IWorldGenerator.getDistanceGenerationModeDesc()) - .set(ILodConfigWrapperSingleton.IClient.IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT) +// .comment(IWorldGenerator.getDistanceGenerationModeDesc()) + .set(IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT) .build(); public static ConfigEntry lightGenerationMode = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IWorldGenerator.LIGHT_GENERATION_MODE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IWorldGenerator.LIGHT_GENERATION_MODE_DEFAULT) + .comment(IWorldGenerator.LIGHT_GENERATION_MODE_DESC) + .set(IWorldGenerator.LIGHT_GENERATION_MODE_DEFAULT) .build(); public static ConfigEntry generationPriority = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IWorldGenerator.GENERATION_PRIORITY_DESC) - .set(ILodConfigWrapperSingleton.IClient.IWorldGenerator.GENERATION_PRIORITY_DEFAULT) + .comment(IWorldGenerator.GENERATION_PRIORITY_DESC) + .set(IWorldGenerator.GENERATION_PRIORITY_DEFAULT) .build(); public static ConfigEntry blocksToAvoid = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IWorldGenerator.BLOCKS_TO_AVOID_DESC) - .set(ILodConfigWrapperSingleton.IClient.IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT) + .comment(IWorldGenerator.BLOCKS_TO_AVOID_DESC) + .set(IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT) .build(); } + + public static class Multiplayer + { + public static ConfigEntry serverFolderNameMode = new ConfigEntry.Builder() + .comment(IMultiplayer.SERVER_FOLDER_NAME_MODE_DESC) + .set(IMultiplayer.SERVER_FOLDER_NAME_MODE_DEFAULT) + .build(); + + public static ConfigEntry multiDimensionRequiredSimilarity = new ConfigEntry.Builder() + .comment(IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_DESC) + .setMinDefaultMax(IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_MIN_DEFAULT_MAX) + .build(); + + } + + public static class Advanced { public static ConfigCategory threading = new ConfigCategory.Builder().set(Threading.class).build(); @@ -182,58 +348,121 @@ public class Config public static ConfigCategory buffers = new ConfigCategory.Builder().set(Buffers.class).build(); + public static ConfigEntry lodOnlyMode = new ConfigEntry.Builder() + .comment(IAdvanced.LOD_ONLY_MODE_DESC) + .set(IAdvanced.LOD_ONLY_MODE_DEFAULT) + .build(); + public static class Threading { - public static ConfigEntry numberOfWorldGenerationThreads = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.defaultValue) - .setMinMax(ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.minValue, ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.maxValue) + public static ConfigEntry numberOfWorldGenerationThreads = new ConfigEntry.Builder() + .comment(IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC) + .setMinDefaultMax(IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT) .build(); public static ConfigEntry numberOfBufferBuilderThreads = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX.defaultValue) - .setMinMax(ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX.minValue, ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX.maxValue) + .comment(IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_DESC) + .setMinDefaultMax(IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX) .build(); } public static class Debugging { - public static ConfigEntry drawLods = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.DRAW_LODS_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.DRAW_LODS_DEFAULT) + public static ConfigEntry rendererType = new ConfigEntry.Builder() + .comment(IDebugging.RENDERER_TYPE_DESC) + .set(IDebugging.RENDERER_TYPE_DEFAULT) .build(); public static ConfigEntry debugMode = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.DEBUG_MODE_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.DEBUG_MODE_DEFAULT) + .comment(IDebugging.DEBUG_MODE_DESC) + .set(IDebugging.DEBUG_MODE_DEFAULT) .build(); public static ConfigEntry enableDebugKeybindings = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.DEBUG_KEYBINDINGS_ENABLED_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT) + .comment(IDebugging.DEBUG_KEYBINDINGS_ENABLED_DESC) + .set(IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT) .build(); + + public static ConfigCategory debugSwitch = new ConfigCategory.Builder().set(DebugSwitch.class).build(); + + + public static class DebugSwitch { + /* The logging switches available: + * WorldGenEvent + * WorldGenPerformance + * WorldGenLoadEvent + * LodBuilderEvent + * RendererBufferEvent + * RendererGLEvent + * FileReadWriteEvent + * FileSubDimEvent + * NetworkEvent //NOT IMPL YET + */ + public static ConfigEntry logWorldGenEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_WORLDGEN_EVENT_DESC) + .set(IDebugSwitch.LOG_WORLDGEN_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logWorldGenPerformance = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_WORLDGEN_PERFORMANCE_DESC) + .set(IDebugSwitch.LOG_WORLDGEN_PERFORMANCE_DEFAULT) + .build(); + + public static ConfigEntry logWorldGenLoadEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_WORLDGEN_LOAD_EVENT_DESC) + .set(IDebugSwitch.LOG_WORLDGEN_LOAD_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logLodBuilderEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_LODBUILDER_EVENT_DESC) + .set(IDebugSwitch.LOG_LODBUILDER_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logRendererBufferEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_RENDERER_BUFFER_EVENT_DESC) + .set(IDebugSwitch.LOG_RENDERER_BUFFER_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logRendererGLEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_RENDERER_GL_EVENT_DESC) + .set(IDebugSwitch.LOG_RENDERER_GL_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logFileReadWriteEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_FILE_READWRITE_EVENT_DESC) + .set(IDebugSwitch.LOG_FILE_READWRITE_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logFileSubDimEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_FILE_SUB_DIM_EVENT_DESC) + .set(IDebugSwitch.LOG_FILE_SUB_DIM_EVENT_DEFAULT) + .build(); + + public static ConfigEntry logNetworkEvent = new ConfigEntry.Builder() + .comment(IDebugSwitch.LOG_NETWORK_EVENT_DESC) + .set(IDebugSwitch.LOG_NETWORK_EVENT_DEFAULT) + .build(); + } } public static class Buffers { public static ConfigEntry gpuUploadMethod = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.GPU_UPLOAD_METHOD_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.GPU_UPLOAD_METHOD_DEFAULT) + .comment(IBuffers.GPU_UPLOAD_METHOD_DESC) + .set(IBuffers.GPU_UPLOAD_METHOD_DEFAULT) .build(); public static ConfigEntry gpuUploadPerMegabyteInMilliseconds = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DEFAULT.defaultValue) - .setMinMax(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DEFAULT.minValue, ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DEFAULT.maxValue) + .comment(IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DESC) + .setMinDefaultMax(IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DEFAULT) .build(); public static ConfigEntry rebuildTimes = new ConfigEntry.Builder() - .comment(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.REBUILD_TIMES_DESC) - .set(ILodConfigWrapperSingleton.IClient.IAdvanced.IBuffers.REBUILD_TIMES_DEFAULT) + .comment(IBuffers.REBUILD_TIMES_DESC) + .set(IBuffers.REBUILD_TIMES_DEFAULT) .build(); } } diff --git a/src/main/java/com/seibel/lod/core/ModInfo.java b/src/main/java/com/seibel/lod/core/ModInfo.java index 8b5fb4f46..cfaf60b1a 100644 --- a/src/main/java/com/seibel/lod/core/ModInfo.java +++ b/src/main/java/com/seibel/lod/core/ModInfo.java @@ -28,7 +28,7 @@ import java.util.Locale; * know where to start. * Go to the api/lod package (folder) and take a look at the ClientApi.java file, * Pretty much all of the mod stems from there. - * + * * @author James Seibel * @author Ran * @version 2022-4-27 @@ -40,16 +40,16 @@ public final class ModInfo public static final int PROTOCOL_VERSION = 1; /** The internal mod name */ public static final String NAME = "DistantHorizons"; - /** Human-readable version of NAME */ + /** Human readable version of NAME */ public static final String READABLE_NAME = "Distant Horizons"; public static final String VERSION = "1.7.0a-dev"; /** Returns true if the current build is an unstable developer build, false otherwise. */ public static boolean IS_DEV_BUILD = VERSION.toLowerCase().contains("dev"); - + /** This version should only be updated when breaking changes are introduced to the DH API */ public static final int API_MAJOR_VERSION = 1; /** This version should be updated whenever new methods are added to the DH API */ public static final int API_MINOR_VERSION = 1; - - + + } diff --git a/src/main/java/com/seibel/lod/core/config/ConfigBase.java b/src/main/java/com/seibel/lod/core/config/ConfigBase.java index 4d7d6c239..fc3da99bd 100644 --- a/src/main/java/com/seibel/lod/core/config/ConfigBase.java +++ b/src/main/java/com/seibel/lod/core/config/ConfigBase.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.config; -import com.seibel.lod.core.api.ClientApi; +import com.seibel.lod.core.api.internal.ClientApi; import com.seibel.lod.core.config.file.ConfigFileHandling; import com.seibel.lod.core.config.gui.AbstractScreen; import com.seibel.lod.core.config.types.AbstractConfigType; @@ -46,7 +46,8 @@ public class ConfigBase { acceptableInputs.add(HashMap.class); // TODO[CONFIG]: This is handled separately to check the first input is String and the second input is valid } - public static boolean disableMinMax = false; + /** Disables the minimum and maximum of a variable */ + public static boolean disableMinMax = false; // Very fun to use public static final List> entries = new ArrayList<>(); public static void init(Class config) { diff --git a/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java b/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java index bb272d8d2..670fdd5cb 100644 --- a/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java +++ b/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java @@ -2,12 +2,12 @@ package com.seibel.lod.core.config.file; import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.seibel.lod.core.ModInfo; -import com.seibel.lod.core.api.ClientApi; +import com.seibel.lod.core.api.internal.ClientApi; import com.seibel.lod.core.config.ConfigBase; import com.seibel.lod.core.config.types.AbstractConfigType; import com.seibel.lod.core.config.types.ConfigEntry; -import com.seibel.lod.core.util.SingletonHandler; -import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; +import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -23,7 +23,7 @@ import java.util.HashMap; * @author coolGi2007 */ public class ConfigFileHandling { - public static final Path ConfigPath = SingletonHandler.get(IMinecraftWrapper.class).getGameDirectory().toPath().resolve("config").resolve(ModInfo.NAME+".toml"); + public static final Path ConfigPath = SingletonHandler.get(IMinecraftClientWrapper.class).getGameDirectory().toPath().resolve("config").resolve(ModInfo.NAME+".toml"); /** Saves the config to the file */ public static void saveToFile() { @@ -122,7 +122,7 @@ public class ConfigFileHandling { )); } else if (entry.getType().isAssignableFrom(HashMap.class)) { entry.setWTSave((T) getHashMapFromString(workConfig.get(entry.getNameWCategory()))); - } else { // TODO: Made a way to make the number be castable to the correct type + } else { entry.setWTSave((T) workConfig.get(entry.getNameWCategory())); if (entry.isValid() == 0) return; @@ -171,7 +171,7 @@ public class ConfigFileHandling { } catch (IOException ex) { System.out.println("Creating file failed"); ex.printStackTrace(); - SingletonHandler.get(IMinecraftWrapper.class).crashMinecraft("Loading file and resetting config file failed at path ["+ConfigPath+"]. Please check the file is ok and you have the permissions", ex); + SingletonHandler.get(IMinecraftClientWrapper.class).crashMinecraft("Loading file and resetting config file failed at path ["+ConfigPath+"]. Please check the file is ok and you have the permissions", ex); } } } diff --git a/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java b/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java index b15e41dc7..7d29bf497 100644 --- a/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java +++ b/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java @@ -1,6 +1,5 @@ package com.seibel.lod.core.config.types; -import com.seibel.lod.core.api.ClientApi; import com.seibel.lod.core.config.ConfigEntryAppearance; public class ConfigCategory extends AbstractConfigType { diff --git a/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java b/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java index 33d6af95f..68f2f14e3 100644 --- a/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java +++ b/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java @@ -3,13 +3,14 @@ package com.seibel.lod.core.config.types; import com.seibel.lod.core.config.ConfigBase; import com.seibel.lod.core.config.ConfigEntryAppearance; import com.seibel.lod.core.config.file.ConfigFileHandling; +import com.seibel.lod.core.objects.MinDefaultMax; /** * Use for making the config variables * * @author coolGi2007 */ -public class ConfigEntry extends AbstractConfigType { +public class ConfigEntry extends AbstractConfigType> { private T defaultValue; private String comment; private T min; @@ -46,6 +47,13 @@ public class ConfigEntry extends AbstractConfigType { return value; } + public MinDefaultMax getMinValueMax() { + return new MinDefaultMax(min, value, max); + } + public MinDefaultMax getMinDefaultMax() { + return new MinDefaultMax(min, defaultValue, max); + } + /** Sets the value without saving */ public void setWTSave(T newValue) { this.value = newValue; @@ -67,6 +75,11 @@ public class ConfigEntry extends AbstractConfigType { public void setMax(T newMax) { this.max = newMax; } + /** Sets the min and max in 1 setter */ + public void setMinMax(T newMin, T newMax) { + this.max = newMin; + this.min = newMax; + } /** Gets the comment */ public String getComment() { @@ -86,17 +99,7 @@ public class ConfigEntry extends AbstractConfigType { * -1 == number too low */ public byte isValid() { - if (ConfigBase.disableMinMax) - return 0; - if (Number.class.isAssignableFrom(this.value.getClass())) { // Only check min max if it is a number - if (this.max != null && Double.valueOf(this.value.toString()) > Double.valueOf(this.max.toString())) - return 1; - if (this.min != null && Double.valueOf(this.value.toString()) < Double.valueOf(this.min.toString())) - return -1; - - return 0; - } - return 0; + return isValid(value); } /** Checks if a value is valid */ public byte isValid(T value) { @@ -139,7 +142,7 @@ public class ConfigEntry extends AbstractConfigType { } } - public static class Builder extends AbstractConfigType.Builder { + public static class Builder extends AbstractConfigType.Builder> { private String tmpComment; private T tmpMin; private T tmpMax; @@ -150,12 +153,27 @@ public class ConfigEntry extends AbstractConfigType { return this; } + public Builder setMinDefaultMax(MinDefaultMax newMinDefaultMax) { + this.set(newMinDefaultMax.defaultValue); + this.setMinMax(newMinDefaultMax.minValue, newMinDefaultMax.maxValue); + return this; + } + public Builder setMinMax(T newMin, T newMax) { this.tmpMin = newMin; this.tmpMax = newMax; return this; } + public Builder setMin(T newMin) { + this.tmpMin = newMin; + return this; + } + public Builder setMax(T newMax) { + this.tmpMax = newMax; + return this; + } + public Builder setUseApiOverwrite(boolean newUseApiOverwrite) { this.tmpUseApiOverwrite = newUseApiOverwrite; return this; diff --git a/src/main/java/com/seibel/lod/core/jar/JarDependencySetup.java b/src/main/java/com/seibel/lod/core/jar/JarDependencySetup.java index 1181276c2..d30102e2b 100644 --- a/src/main/java/com/seibel/lod/core/jar/JarDependencySetup.java +++ b/src/main/java/com/seibel/lod/core/jar/JarDependencySetup.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.jar; +import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; import com.seibel.lod.core.jar.wrapperInterfaces.config.ConfigWrapper; -import com.seibel.lod.core.util.SingletonHandler; import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper; public class JarDependencySetup { diff --git a/src/main/java/com/seibel/lod/core/objects/MinDefaultMax.java b/src/main/java/com/seibel/lod/core/objects/MinDefaultMax.java index 6b513d998..8c6726df8 100644 --- a/src/main/java/com/seibel/lod/core/objects/MinDefaultMax.java +++ b/src/main/java/com/seibel/lod/core/objects/MinDefaultMax.java @@ -26,6 +26,7 @@ package com.seibel.lod.core.objects; * @version 11-14-2021 * @param The data type this object is storing */ +@Deprecated public class MinDefaultMax { public final T minValue; diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/IConfigWrapper.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/IConfigWrapper.java index 7f25e919b..58cd1b49c 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/IConfigWrapper.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/IConfigWrapper.java @@ -1,6 +1,8 @@ package com.seibel.lod.core.wrapperInterfaces.config; -public interface IConfigWrapper { +import com.seibel.lod.core.handlers.dependencyInjection.IBindable; + +public interface IConfigWrapper extends IBindable { boolean langExists(String str); diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java index 6c6867164..c47344d0f 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java @@ -28,14 +28,10 @@ import com.seibel.lod.core.wrapperInterfaces.IVersionConstants; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; /** - * This holds the config defaults, setters/getters - * that should be hooked into the host mod loader (Fabric, Forge, etc.), and - * the options that should be implemented in a configWrapperSingleton. - * - * @author James Seibel - * @version 12-14-2021 + * Use the real config rather than these getters */ -public interface ILodConfigWrapperSingleton +@Deprecated +public interface ILodConfigWrapperSingleton extends IBindable { IClient client(); diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java index 6bb1a0c5b..96764d9c3 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java @@ -1,11 +1,11 @@ package com.seibel.lod.core.wrapperInterfaces.config; +import com.seibel.lod.core.Config; import com.seibel.lod.core.enums.config.*; import com.seibel.lod.core.enums.rendering.*; -import com.seibel.lod.core.Config; /** - * Will be removed + * Use config getters rather than this */ @Deprecated public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton @@ -24,6 +24,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { public final IGraphics graphics; public final IWorldGenerator worldGenerator; + public final IMultiplayer multiplayer; public final IAdvanced advanced; @@ -39,6 +40,11 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton return worldGenerator; } + @Override + public IMultiplayer multiplayer() { + return multiplayer; + } + @Override public IAdvanced advanced() { @@ -65,6 +71,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { graphics = new Graphics(); worldGenerator = new WorldGenerator(); + multiplayer = new Multiplayer(); advanced = new Advanced(); } @@ -176,11 +183,28 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton public void setDropoffQuality(DropoffQuality newDropoffQuality) { Config.Client.Graphics.Quality.dropoffQuality.set(newDropoffQuality); } + + @Override + public int getLodBiomeBlending() { + return Config.Client.Graphics.Quality.lodBiomeBlending.get(); + } + + @Override + public void setLodBiomeBlending(int newLodBiomeBlending) { + Config.Client.Graphics.Quality.lodBiomeBlending.set(newLodBiomeBlending); + } } public static class FogQuality implements IFogQuality { + public final IAdvancedFog advancedFog; + + FogQuality() + { + advancedFog = new AdvancedFog(); + } + @Override public FogDistance getFogDistance() { @@ -229,6 +253,152 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { Config.Client.Graphics.FogQuality.disableVanillaFog.set(newDisableVanillaFog); } + + @Override + public IAdvancedFog advancedFog() { + return advancedFog; + } + + public static class AdvancedFog implements IAdvancedFog { + public final IHeightFog heightFog; + + public AdvancedFog() { + heightFog = new HeightFog(); + } + + @Override + public double getFarFogStart() { + return Config.Client.Graphics.FogQuality.AdvancedFog.farFogStart.get(); + } + @Override + public double getFarFogEnd() { + return Config.Client.Graphics.FogQuality.AdvancedFog.farFogEnd.get(); + } + @Override + public double getFarFogMin() { + return Config.Client.Graphics.FogQuality.AdvancedFog.farFogMin.get(); + } + @Override + public double getFarFogMax() { + return Config.Client.Graphics.FogQuality.AdvancedFog.farFogMax.get(); + } + @Override + public FogSetting.FogType getFarFogType() { + return Config.Client.Graphics.FogQuality.AdvancedFog.farFogType.get(); + } + @Override + public double getFarFogDensity() { + return Config.Client.Graphics.FogQuality.AdvancedFog.farFogDensity.get(); + } + + @Override + public void setFarFogStart(double newFarFogStart) { + Config.Client.Graphics.FogQuality.AdvancedFog.farFogStart.set(newFarFogStart); + } + @Override + public void setFarFogEnd(double newFarFogEnd) { + Config.Client.Graphics.FogQuality.AdvancedFog.farFogEnd.set(newFarFogEnd); + } + @Override + public void setFarFogMin(double newFarFogMin) { + Config.Client.Graphics.FogQuality.AdvancedFog.farFogMin.set(newFarFogMin); + } + @Override + public void setFarFogMax(double newFarFogMax) { + Config.Client.Graphics.FogQuality.AdvancedFog.farFogMax.set(newFarFogMax); + } + @Override + public void setFarFogType(FogSetting.FogType newFarFogType) { + Config.Client.Graphics.FogQuality.AdvancedFog.farFogType.set(newFarFogType); + } + @Override + public void setFarFogDensity(double newFarFogDensity) { + Config.Client.Graphics.FogQuality.AdvancedFog.farFogDensity.set(newFarFogDensity); + } + + @Override + public IHeightFog heightFog() { + return heightFog; + } + + public static class HeightFog implements IHeightFog { + + @Override + public HeightFogMixMode getHeightFogMixMode() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMixMode.get(); + } + @Override + public HeightFogMode getHeightFogMode() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMode.get(); + } + @Override + public double getHeightFogHeight() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogHeight.get(); + } + @Override + public double getHeightFogStart() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogStart.get(); + } + @Override + public double getHeightFogEnd() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogEnd.get(); + } + @Override + public double getHeightFogMin() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMin.get(); + } + @Override + public double getHeightFogMax() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMax.get(); + } + @Override + public FogSetting.FogType getHeightFogType() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogType.get(); + } + @Override + public double getHeightFogDensity() { + return Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogDensity.get(); + } + + @Override + public void setHeightFogMixMode(HeightFogMixMode newHeightFogMixMode) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMixMode.set(newHeightFogMixMode); + } + @Override + public void setHeightFogMode(HeightFogMode newHeightFogMode) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMode.set(newHeightFogMode); + } + @Override + public void setHeightFogHeight(double newHeightFogHeight) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogHeight.set(newHeightFogHeight); + } + @Override + public void setHeightFogStart(double newHeightFogStart) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogStart.set(newHeightFogStart); + } + @Override + public void setHeightFogEnd(double newHeightFogEnd) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogEnd.set(newHeightFogEnd); + } + @Override + public void setHeightFogMin(double newHeightFogMin) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMin.set(newHeightFogMin); + } + @Override + public void setHeightFogMax(double newHeightFogMax) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogMax.set(newHeightFogMax); + } + @Override + public void setHeightFogType(FogSetting.FogType newHeightFogType) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogType.set(newHeightFogType); + } + @Override + public void setHeightFogDensity(double newHeightFogDensity) { + Config.Client.Graphics.FogQuality.AdvancedFog.HeightFog.heightFogDensity.set(newHeightFogDensity); + } + } + } + } @@ -257,6 +427,27 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton Config.Client.Graphics.AdvancedGraphics.vanillaOverdraw.set(newVanillaOverdraw); } + @Override + public int getOverdrawOffset() { + return Config.Client.Graphics.AdvancedGraphics.overdrawOffset.get(); + } + + @Override + public void setOverdrawOffset(int newOverdrawOffset) { + Config.Client.Graphics.AdvancedGraphics.overdrawOffset.set(newOverdrawOffset); + } + /* + @Override + public int getBacksideCullingRange() + { + return Config.Client.Graphics.AdvancedGraphics.backsideCullingRange; + } + @Override + public void setBacksideCullingRange(int newBacksideCullingRange) + { + ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.backsideCullingRange").value = newBacksideCullingRange; + ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.backsideCullingRange"); + }*/ @Override public boolean getUseExtendedNearClipPlane() @@ -268,6 +459,62 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { Config.Client.Graphics.AdvancedGraphics.useExtendedNearClipPlane.set(newUseExtendedNearClipPlane); } + + @Override + public double getBrightnessMultiplier() + { + return Config.Client.Graphics.AdvancedGraphics.brightnessMultiplier.get(); + } + @Override + public void setBrightnessMultiplier(double newBrightnessMultiplier) + { + Config.Client.Graphics.AdvancedGraphics.brightnessMultiplier.set(newBrightnessMultiplier); + } + + @Override + public double getSaturationMultiplier() + { + return Config.Client.Graphics.AdvancedGraphics.saturationMultiplier.get(); + } + @Override + public void setSaturationMultiplier(double newSaturationMultiplier) + { + Config.Client.Graphics.AdvancedGraphics.saturationMultiplier.set(newSaturationMultiplier); + } + + @Override + public boolean getEnableCaveCulling() { + return Config.Client.Graphics.AdvancedGraphics.enableCaveCulling.get(); + } + + @Override + public void setEnableCaveCulling(boolean newEnableCaveCulling) { + Config.Client.Graphics.AdvancedGraphics.enableCaveCulling.set(newEnableCaveCulling); + + } + + @Override + public int getCaveCullingHeight() { + return Config.Client.Graphics.AdvancedGraphics.caveCullingHeight.get(); + } + + @Override + public void setCaveCullingHeight(int newCaveCullingHeight) { + Config.Client.Graphics.AdvancedGraphics.caveCullingHeight.set(newCaveCullingHeight); + + } + + @Override + public int getEarthCurveRatio() + { + return Config.Client.Graphics.AdvancedGraphics.earthCurveRatio.get(); + } + @Override + public void setEarthCurveRatio(int newEarthCurveRatio) + { +// if (newEarthCurveRatio < 50) newEarthCurveRatio = 0; // TODO: Leetom can you please remove this + Config.Client.Graphics.AdvancedGraphics.earthCurveRatio.set(newEarthCurveRatio); + } } } @@ -350,6 +597,36 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton + //=====================// + // Multiplayer Configs // + //=====================// + public static class Multiplayer implements IMultiplayer + { + @Override + public ServerFolderNameMode getServerFolderNameMode() + { + return Config.Client.Multiplayer.serverFolderNameMode.get(); + } + @Override + public void setServerFolderNameMode(ServerFolderNameMode newServerFolderNameMode) + { + Config.Client.Multiplayer.serverFolderNameMode.set(newServerFolderNameMode); + } + + @Override + public double getMultiDimensionRequiredSimilarity() + { + return Config.Client.Multiplayer.multiDimensionRequiredSimilarity.get(); + } + + @Override + public void setMultiDimensionRequiredSimilarity(double newMultiDimensionMinimumSimilarityPercent) + { + Config.Client.Multiplayer.multiDimensionRequiredSimilarity.set(newMultiDimensionMinimumSimilarityPercent); + } + } + + //============================// // AdvancedModOptions Configs // @@ -392,12 +669,12 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton public static class Threading implements IThreading { @Override - public int getNumberOfWorldGenerationThreads() + public double getNumberOfWorldGenerationThreads() { return Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.get(); } @Override - public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads) + public void setNumberOfWorldGenerationThreads(double newNumberOfWorldGenerationThreads) { Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.set(newNumberOfWorldGenerationThreads); } @@ -423,17 +700,27 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton //===============// public static class Debugging implements IDebugging { + public final IDebugSwitch debugSwitch; + @Override - public boolean getDrawLods() + public IDebugSwitch debugSwitch() { - return Config.Client.Advanced.Debugging.drawLods.get(); - } - @Override - public void setDrawLods(boolean newDrawLods) - { - Config.Client.Advanced.Debugging.drawLods.set(newDrawLods); + return debugSwitch; } + /* RendererType: + * DEFAULT + * DEBUG + * DISABLED + * */ + @Override + public RendererType getRendererType() { + return Config.Client.Advanced.Debugging.rendererType.get(); + } + @Override + public void setRendererType(RendererType newRenderType) { + Config.Client.Advanced.Debugging.rendererType.set(newRenderType); + } @Override public DebugMode getDebugMode() @@ -457,6 +744,107 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { Config.Client.Advanced.Debugging.enableDebugKeybindings.set(newEnableDebugKeybindings); } + + public Debugging() + { + debugSwitch = new DebugSwitch(); + } + + public static class DebugSwitch implements IDebugSwitch { + + /* The logging switches available: + * WorldGenEvent + * WorldGenPerformance + * WorldGenLoadEvent + * LodBuilderEvent + * RendererBufferEvent + * RendererGLEvent + * FileReadWriteEvent + * FileSubDimEvent + * NetworkEvent //NOT IMPL YET + */ + + @Override + public LoggerMode getLogWorldGenEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logWorldGenEvent.get(); + } + @Override + public void setLogWorldGenEvent(LoggerMode newLogWorldGenEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logWorldGenEvent.set(newLogWorldGenEvent); + } + + @Override + public LoggerMode getLogWorldGenPerformance() { + return Config.Client.Advanced.Debugging.DebugSwitch.logWorldGenPerformance.get(); + } + @Override + public void setLogWorldGenPerformance(LoggerMode newLogWorldGenPerformance) { + Config.Client.Advanced.Debugging.DebugSwitch.logWorldGenPerformance.set(newLogWorldGenPerformance); + } + + @Override + public LoggerMode getLogWorldGenLoadEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logWorldGenLoadEvent.get(); + } + @Override + public void setLogWorldGenLoadEvent(LoggerMode newLogWorldGenLoadEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logWorldGenLoadEvent.set(newLogWorldGenLoadEvent); + } + + @Override + public LoggerMode getLogLodBuilderEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logLodBuilderEvent.get(); + } + @Override + public void setLogLodBuilderEvent(LoggerMode newLogLodBuilderEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logLodBuilderEvent.set(newLogLodBuilderEvent); + } + + @Override + public LoggerMode getLogRendererBufferEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logRendererBufferEvent.get(); + } + @Override + public void setLogRendererBufferEvent(LoggerMode newLogRendererBufferEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logRendererBufferEvent.set(newLogRendererBufferEvent); + } + + @Override + public LoggerMode getLogRendererGLEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logRendererGLEvent.get(); + } + @Override + public void setLogRendererGLEvent(LoggerMode newLogRendererGLEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logRendererGLEvent.set(newLogRendererGLEvent); + } + + @Override + public LoggerMode getLogFileReadWriteEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logFileReadWriteEvent.get(); + } + @Override + public void setLogFileReadWriteEvent(LoggerMode newLogFileReadWriteEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logFileReadWriteEvent.set(newLogFileReadWriteEvent); + } + + @Override + public LoggerMode getLogFileSubDimEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logFileSubDimEvent.get(); + } + @Override + public void setLogFileSubDimEvent(LoggerMode newLogFileSubDimEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logFileSubDimEvent.set(newLogFileSubDimEvent); + } + + @Override + public LoggerMode getLogNetworkEvent() { + return Config.Client.Advanced.Debugging.DebugSwitch.logNetworkEvent.get(); + } + @Override + public void setLogNetworkEvent(LoggerMode newLogNetworkEvent) { + Config.Client.Advanced.Debugging.DebugSwitch.logNetworkEvent.set(newLogNetworkEvent); + } + } } @@ -497,6 +885,16 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton Config.Client.Advanced.Buffers.rebuildTimes.set(newBufferRebuildTimes); } } + + @Override + public boolean getLodOnlyMode() { + return Config.Client.Advanced.lodOnlyMode.get(); + } + + @Override + public void setLodOnlyMode(boolean newLodOnlyMode) { + Config.Client.Advanced.lodOnlyMode.set(newLodOnlyMode); + } } } } diff --git a/src/main/resources/assets/lod/lang/en_us.json b/src/main/resources/assets/lod/lang/en_us.json index d1d50b608..42a17888a 100644 --- a/src/main/resources/assets/lod/lang/en_us.json +++ b/src/main/resources/assets/lod/lang/en_us.json @@ -3,12 +3,12 @@ "Distant Horizons", "lod.config.title": "Distant Horizons config", - "lod.config.optionsButton": - "Show options button", - "lod.config.optionsButton.@tooltip": - "Show the config button to the left of the fov button", "lod.config.client": "Client", + "lod.config.client.optionsButton": + "Show options button", + "lod.config.client.optionsButton.@tooltip": + "Show the config button to the left of the fov button", "lod.config.client.graphics": "Graphics", "lod.config.client.graphics.quality":