diff --git a/build.gradle b/build.gradle index 04cdeaa5c..8676c7084 100644 --- a/build.gradle +++ b/build.gradle @@ -131,8 +131,9 @@ subprojects { p -> //Manifold annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}" - // Toml + // Toml & Json for config implementation("com.electronwill.night-config:toml:${rootProject.toml_version}") + implementation("com.googlecode.json-simple:json-simple:1.1.1") if (p != project(":forge")) { // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies diff --git a/common/src/main/java/com/seibel/lod/common/Config.java b/common/src/main/java/com/seibel/lod/common/Config.java deleted file mode 100644 index 445eb822d..000000000 --- a/common/src/main/java/com/seibel/lod/common/Config.java +++ /dev/null @@ -1,482 +0,0 @@ -/* - * 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.common; - -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.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 12-12-2021 - */ - -public class Config -//public class Config extends TinyConfig -{ - // CONFIG STRUCTURE - // -> Client - // | - // |-> Graphics - // | |-> Quality - // | |-> FogQuality - // | |-> AdvancedGraphics - // | - // |-> World Generation - // | - // |-> Advanced - // |-> Threads - // |-> Buffers - // |-> Debugging - - // Since the original config system uses forge stuff, that means we have to rewrite the whole config system - - @ConfigAnnotations.ScreenEntry - public static Client client; - - @ConfigAnnotations.FileComment - public static String _optionsButton = ILodConfigWrapperSingleton.IClient.OPTIONS_BUTTON_DESC; - // I know this option should be in Client - // This is a hacky method to not show the button in the options screen but show it in the mod menu - // Tough it is in client in the wrapper singleton - @ConfigAnnotations.Entry - public static boolean optionsButton = true; - - public static class Client - { - @ConfigAnnotations.ScreenEntry - public static Graphics graphics; - - @ConfigAnnotations.ScreenEntry - public static WorldGenerator worldGenerator; - - @ConfigAnnotations.ScreenEntry - public static Multiplayer multiplayer; - - @ConfigAnnotations.ScreenEntry - public static Advanced advanced; - - - public static class Graphics - { - @ConfigAnnotations.ScreenEntry - public static Quality quality; - - @ConfigAnnotations.ScreenEntry - public static FogQuality fogQuality; - - @ConfigAnnotations.ScreenEntry - public static AdvancedGraphics advancedGraphics; - - - public static class Quality - { - @ConfigAnnotations.FileComment - public static String _drawResolution = IQuality.DRAW_RESOLUTION_DESC; - @ConfigAnnotations.Entry - public static HorizontalResolution drawResolution = IQuality.DRAW_RESOLUTION_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC; - @ConfigAnnotations.Entry(minValue = 32, maxValue = 2048) - public static int lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _verticalQuality = IQuality.VERTICAL_QUALITY_DESC; - @ConfigAnnotations.Entry - public static VerticalQuality verticalQuality = IQuality.VERTICAL_QUALITY_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _horizontalScale = IQuality.HORIZONTAL_SCALE_DESC; - @ConfigAnnotations.Entry(minValue = 2, maxValue = 64) - public static int horizontalScale = IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _horizontalQuality = IQuality.HORIZONTAL_SCALE_DESC; - @ConfigAnnotations.Entry - public static HorizontalQuality horizontalQuality = IQuality.HORIZONTAL_QUALITY_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _dropoffQuality = IQuality.DROPOFF_QUALITY_DESC; - @ConfigAnnotations.Entry - public static DropoffQuality dropoffQuality = IQuality.DROPOFF_QUALITY_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _lodBiomeBlending = IQuality.LOD_BIOME_BLENDING_DESC; - @ConfigAnnotations.Entry(minValue = 0, maxValue = 7) - public static int lodBiomeBlending = IQuality.LOD_BIOME_BLENDING_MIN_DEFAULT_MAX.defaultValue; - } - - - public static class FogQuality - { - @ConfigAnnotations.FileComment - public static String _fogDistance = IFogQuality.FOG_DISTANCE_DESC; - @ConfigAnnotations.Entry - public static FogDistance fogDistance = IFogQuality.FOG_DISTANCE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _fogDrawMode = IFogQuality.FOG_DRAW_MODE_DESC; - @ConfigAnnotations.Entry - public static FogDrawMode fogDrawMode = IFogQuality.FOG_DRAW_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _fogColorMode = IFogQuality.FOG_COLOR_MODE_DESC; - @ConfigAnnotations.Entry - public static FogColorMode fogColorMode = IFogQuality.FOG_COLOR_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _disableVanillaFog = IFogQuality.DISABLE_VANILLA_FOG_DESC; - @ConfigAnnotations.Entry - public static boolean disableVanillaFog = IFogQuality.DISABLE_VANILLA_FOG_DEFAULT; - - @ConfigAnnotations.ScreenEntry - public static AdvancedFog advancedFog; - - public static class AdvancedFog { - static final double SQRT2 = 1.4142135623730951; - - @ConfigAnnotations.FileComment - public static String _farFogStart = IAdvancedFog.FAR_FOG_START_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = SQRT2) - public static double farFogStart = IAdvancedFog.FAR_FOG_START_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _farFogEnd = IAdvancedFog.FAR_FOG_END_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = SQRT2) - public static double farFogEnd = IAdvancedFog.FAR_FOG_END_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _farFogMin = IAdvancedFog.FAR_FOG_MIN_DESC; - @ConfigAnnotations.Entry(minValue = -5.0, maxValue = SQRT2) - public static double farFogMin = IAdvancedFog.FAR_FOG_MIN_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _farFogMax = IAdvancedFog.FAR_FOG_MAX_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = 5.0) - public static double farFogMax = IAdvancedFog.FAR_FOG_MAX_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _farFogType = IAdvancedFog.FAR_FOG_TYPE_DESC; - @ConfigAnnotations.Entry - public static FogSetting.FogType farFogType = IAdvancedFog.FAR_FOG_TYPE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _farFogDensity = IAdvancedFog.FAR_FOG_DENSITY_DESC; - @ConfigAnnotations.Entry(minValue = 0.01, maxValue = 50.0) - public static double farFogDensity = IAdvancedFog.FAR_FOG_DENSITY_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.ScreenEntry - public static HeightFog heightFog; - - public static class HeightFog { - - @ConfigAnnotations.FileComment - public static String _heightFogMixMode = IHeightFog.HEIGHT_FOG_MIX_MODE_DESC; - @ConfigAnnotations.Entry - public static HeightFogMixMode heightFogMixMode = IHeightFog.HEIGHT_FOG_MIX_MODE_DEFAULT; - @ConfigAnnotations.FileComment - public static String _heightFogMode = IHeightFog.HEIGHT_FOG_MODE_DESC; - @ConfigAnnotations.Entry - public static HeightFogMode heightFogMode = IHeightFog.HEIGHT_FOG_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _heightFogHeight = IHeightFog.HEIGHT_FOG_HEIGHT_DESC; - @ConfigAnnotations.Entry(minValue = -4096.0, maxValue = 4096.0) - public static double heightFogHeight = IHeightFog.HEIGHT_FOG_HEIGHT_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _heightFogStart = IHeightFog.HEIGHT_FOG_START_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = SQRT2) - public static double heightFogStart = IHeightFog.HEIGHT_FOG_START_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _heightFogEnd = IHeightFog.HEIGHT_FOG_END_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = SQRT2) - public static double heightFogEnd = IHeightFog.HEIGHT_FOG_END_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _heightFogMin = IHeightFog.HEIGHT_FOG_MIN_DESC; - @ConfigAnnotations.Entry(minValue = -5.0, maxValue = SQRT2) - public static double heightFogMin = IHeightFog.HEIGHT_FOG_MIN_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _heightFogMax = IHeightFog.HEIGHT_FOG_MAX_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = 5.0) - public static double heightFogMax = IHeightFog.HEIGHT_FOG_MAX_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _heightFogType = IHeightFog.HEIGHT_FOG_TYPE_DESC; - @ConfigAnnotations.Entry - public static FogSetting.FogType heightFogType = IHeightFog.HEIGHT_FOG_TYPE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _heightFogDensity = IHeightFog.HEIGHT_FOG_DENSITY_DESC; - @ConfigAnnotations.Entry(minValue = 0.01, maxValue = 50.0) - public static double heightFogDensity = IHeightFog.HEIGHT_FOG_DENSITY_MIN_DEFAULT_MAX.defaultValue; - - } - } - } - - - public static class AdvancedGraphics - { - @ConfigAnnotations.FileComment - public static String _disableDirectionalCulling = IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DESC; - @ConfigAnnotations.Entry - public static boolean disableDirectionalCulling = IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DESC; - @ConfigAnnotations.Entry - public static VanillaOverdraw vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _overdrawOffset = IAdvancedGraphics.OVERDRAW_OFFSET_DESC; - @ConfigAnnotations.Entry(minValue = -16, maxValue = 16) - public static int overdrawOffset = IAdvancedGraphics.OVERDRAW_OFFSET_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _useExtendedNearClipPlane = IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC; - @ConfigAnnotations.Entry - public static boolean useExtendedNearClipPlane = IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _brightnessMultiplier = IAdvancedGraphics.BRIGHTNESS_MULTIPLIER_DESC; - @ConfigAnnotations.Entry - public static double brightnessMultiplier = IAdvancedGraphics.BRIGHTNESS_MULTIPLIER_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _saturationMultiplier = IAdvancedGraphics.SATURATION_MULTIPLIER_DESC; - @ConfigAnnotations.Entry - public static double saturationMultiplier = IAdvancedGraphics.SATURATION_MULTIPLIER_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _enableCaveCulling = IAdvancedGraphics.ENABLE_CAVE_CULLING_DESC; - @ConfigAnnotations.Entry - public static boolean enableCaveCulling = IAdvancedGraphics.ENABLE_CAVE_CULLING_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _caveCullingHeight = IAdvancedGraphics.CAVE_CULLING_HEIGHT_DESC; - @ConfigAnnotations.Entry(minValue = -4096, maxValue = 4096) - public static int caveCullingHeight = IAdvancedGraphics.CAVE_CULLING_HEIGHT_MIN_DEFAULT_MAX.defaultValue; - - @ConfigAnnotations.FileComment - public static String _earthCurveRatio = IAdvancedGraphics.EARTH_CURVE_RATIO_DESC; - @ConfigAnnotations.Entry(minValue = 0, maxValue = 5000) - public static int earthCurveRatio = IAdvancedGraphics.EARTH_CURVE_RATIO_MIN_DEFAULT_MAX.defaultValue; - - /* - @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; - */ - } - } - - - public static class WorldGenerator - { - @ConfigAnnotations.FileComment - public static String _enableDistantGeneration = IWorldGenerator.ENABLE_DISTANT_GENERATION_DESC; - @ConfigAnnotations.Entry - public static boolean enableDistantGeneration = IWorldGenerator.ENABLE_DISTANT_GENERATION_DEFAULT; - - // @ConfigAnnotations.FileComment -// public static String _distanceGenerationMode = IWorldGenerator.getDistanceGenerationModeDesc(); - @ConfigAnnotations.Entry - public static DistanceGenerationMode distanceGenerationMode = IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _lightGenerationMode = IWorldGenerator.LIGHT_GENERATION_MODE_DESC; - @ConfigAnnotations.Entry - public static LightGenerationMode lightGenerationMode = IWorldGenerator.LIGHT_GENERATION_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _generationPriority = IWorldGenerator.GENERATION_PRIORITY_DESC; - @ConfigAnnotations.Entry - public static GenerationPriority generationPriority = IWorldGenerator.GENERATION_PRIORITY_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _blocksToAvoid = IWorldGenerator.BLOCKS_TO_AVOID_DESC; - @ConfigAnnotations.Entry - public static BlocksToAvoid blocksToAvoid = IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT; - } - - - public static class Multiplayer - { - @ConfigAnnotations.FileComment - public static String _serverFolderNameMode = IMultiplayer.SERVER_FOLDER_NAME_MODE_DESC; - @ConfigAnnotations.Entry - public static ServerFolderNameMode serverFolderNameMode = IMultiplayer.SERVER_FOLDER_NAME_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _multiDimensionRequiredSimilarity = IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_DESC; - @ConfigAnnotations.Entry(minValue = 0.0, maxValue = 1.0) - public static double multiDimensionRequiredSimilarity = IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_MIN_DEFAULT_MAX.defaultValue; - - } - - - public static class Advanced - { - @ConfigAnnotations.ScreenEntry - public static Threading threading; - - @ConfigAnnotations.ScreenEntry - public static Debugging debugging; - - @ConfigAnnotations.ScreenEntry - public static Buffers buffers; - - @ConfigAnnotations.FileComment - public static String _lodOnlyMode = IAdvanced.LOD_ONLY_MODE_DESC; - @ConfigAnnotations.Entry - public static boolean lodOnlyMode = IAdvanced.LOD_ONLY_MODE_DEFAULT; - - - public static class Threading - { - @ConfigAnnotations.FileComment - public static String _numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC; - @ConfigAnnotations.Entry(minValue = 0.1, maxValue = 50.0) - public static double numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.defaultValue; - - @ConfigAnnotations.FileComment - public static String _numberOfBufferBuilderThreads = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_DESC; - @ConfigAnnotations.Entry(minValue = 1, maxValue = 50) - public static int numberOfBufferBuilderThreads = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX.defaultValue; - } - - - public static class Debugging - { - @ConfigAnnotations.FileComment - public static String _rendererType = IDebugging.RENDERER_TYPE_DESC; - @ConfigAnnotations.Entry - public static RendererType rendererType = IDebugging.RENDERER_TYPE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _debugMode = IDebugging.DEBUG_MODE_DESC; - @ConfigAnnotations.Entry - public static DebugMode debugMode = IDebugging.DEBUG_MODE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DESC; - @ConfigAnnotations.Entry - public static boolean enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT; - - @ConfigAnnotations.ScreenEntry - public static DebugSwitch debugSwitch; - - public static class DebugSwitch { - /* The logging switches available: - * WorldGenEvent - * WorldGenPerformance - * WorldGenLoadEvent - * LodBuilderEvent - * RendererBufferEvent - * RendererGLEvent - * FileReadWriteEvent - * FileSubDimEvent - * NetworkEvent //NOT IMPL YET - */ - @ConfigAnnotations.FileComment - public static String _logWorldGenEvent = IDebugSwitch.LOG_WORLDGEN_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logWorldGenEvent = IDebugSwitch.LOG_WORLDGEN_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logWorldGenPerformance = IDebugSwitch.LOG_WORLDGEN_PERFORMANCE_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logWorldGenPerformance = IDebugSwitch.LOG_WORLDGEN_PERFORMANCE_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logWorldGenLoadEvent = IDebugSwitch.LOG_WORLDGEN_LOAD_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logWorldGenLoadEvent = IDebugSwitch.LOG_WORLDGEN_LOAD_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logLodBuilderEvent = IDebugSwitch.LOG_LODBUILDER_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logLodBuilderEvent = IDebugSwitch.LOG_LODBUILDER_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logRendererBufferEvent = IDebugSwitch.LOG_RENDERER_BUFFER_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logRendererBufferEvent = IDebugSwitch.LOG_RENDERER_BUFFER_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logRendererGLEvent = IDebugSwitch.LOG_RENDERER_GL_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logRendererGLEvent = IDebugSwitch.LOG_RENDERER_GL_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logFileReadWriteEvent = IDebugSwitch.LOG_FILE_READWRITE_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logFileReadWriteEvent = IDebugSwitch.LOG_FILE_READWRITE_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logFileSubDimEvent = IDebugSwitch.LOG_FILE_SUB_DIM_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logFileSubDimEvent = IDebugSwitch.LOG_FILE_SUB_DIM_EVENT_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _logNetworkEvent = IDebugSwitch.LOG_NETWORK_EVENT_DESC; - @ConfigAnnotations.Entry - public static LoggerMode logNetworkEvent = IDebugSwitch.LOG_NETWORK_EVENT_DEFAULT; - } - } - - - public static class Buffers - { - @ConfigAnnotations.FileComment - public static String _gpuUploadMethod = IBuffers.GPU_UPLOAD_METHOD_DESC; - @ConfigAnnotations.Entry - public static GpuUploadMethod gpuUploadMethod = IBuffers.GPU_UPLOAD_METHOD_DEFAULT; - - @ConfigAnnotations.FileComment - public static String _gpuUploadPerMegabyteInMilliseconds = IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DESC; - @ConfigAnnotations.Entry(minValue = 0, maxValue = 50) - public static int gpuUploadPerMegabyteInMilliseconds = IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DEFAULT.defaultValue; - - @ConfigAnnotations.FileComment - public static String _rebuildTimes = IBuffers.REBUILD_TIMES_DESC; - @ConfigAnnotations.Entry - public static BufferRebuildTimes rebuildTimes = IBuffers.REBUILD_TIMES_DEFAULT; - } - } - } -} diff --git a/common/src/main/java/com/seibel/lod/common/LodCommonMain.java b/common/src/main/java/com/seibel/lod/common/LodCommonMain.java index 74729857a..b1a86f2bc 100644 --- a/common/src/main/java/com/seibel/lod/common/LodCommonMain.java +++ b/common/src/main/java/com/seibel/lod/common/LodCommonMain.java @@ -22,7 +22,8 @@ package com.seibel.lod.common; import com.seibel.lod.common.forge.LodForgeMethodCaller; import com.seibel.lod.common.networking.NetworkInterface; import com.seibel.lod.common.wrappers.DependencySetup; -import com.seibel.lod.common.wrappers.config.ConfigGui; +import com.seibel.lod.core.Config; +import com.seibel.lod.core.config.ConfigBase; /** * This is the common main class @@ -53,6 +54,6 @@ public class LodCommonMain { public static void initConfig() { - ConfigGui.init(Config.class); + ConfigBase.init(Config.class); } } diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java b/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java index 6b2a8d7d5..dd307d9ad 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/DependencySetup.java @@ -20,6 +20,8 @@ package com.seibel.lod.common.wrappers; import com.seibel.lod.common.LodCommonMain; +import com.seibel.lod.common.wrappers.config.ConfigWrapper; +import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper; import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper; import com.seibel.lod.common.wrappers.minecraft.MinecraftRenderWrapper; import com.seibel.lod.core.handlers.IReflectionHandler; @@ -43,6 +45,7 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; public class DependencySetup { public static void createInitialBindings() { + SingletonHandler.bind(IConfigWrapper.class, ConfigWrapper.INSTANCE); SingletonHandler.bind(IVersionConstants.class, VersionConstants.INSTANCE); if (!LodCommonMain.serverSided) { diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/ClassicConfigGUI.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/ClassicConfigGUI.java new file mode 100644 index 000000000..5e1b17406 --- /dev/null +++ b/common/src/main/java/com/seibel/lod/common/wrappers/config/ClassicConfigGUI.java @@ -0,0 +1,418 @@ +package com.seibel.lod.common.wrappers.config; + +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +// Logger (for debug stuff) + +import com.seibel.lod.core.config.file.ConfigFileHandling; +import com.seibel.lod.core.config.types.AbstractConfigType; +import com.seibel.lod.core.config.types.ConfigCategory; +import com.seibel.lod.core.config.types.ConfigEntry; + +// Uses https://github.com/TheElectronWill/night-config for toml (only for Fabric since Forge already includes this) + +// Gets info from our own mod + +import com.seibel.lod.core.ModInfo; +import com.seibel.lod.core.config.*; + +// Minecraft imports + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.ContainerObjectSelectionList; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.client.resources.language.I18n; // translation +//#if POST_MC_1_17_1 +import net.minecraft.client.gui.narration.NarratableEntry; +//#endif + +/** + * Based upon TinyConfig but is highly modified + * https://github.com/Minenash/TinyConfig + * + * Credits to Motschen + * + * @author coolGi2007 + * @version 4-28-2022 + */ +@SuppressWarnings("unchecked") +public abstract class ClassicConfigGUI { + /* + This would be removed later on + */ + + + //==============// + // Initializers // + //==============// + + // Some regexes to check if an input is valid + private static final Pattern INTEGER_ONLY_REGEX = Pattern.compile("(-?[0-9]*)"); + private static final Pattern DECIMAL_ONLY_REGEX = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)"); + + private static class ConfigScreenConfigs { + // This contains all the configs for the configs + public static final int SpaceFromRightScreen = 10; + public static final int ButtonWidthSpacing = 5; + public static final int ResetButtonWidth = 40; + } + + /** + * The terribly coded old stuff + */ + public static class EntryInfo { + Object widget; + Map.Entry error; + String tempValue; + int index; + } + + private static void initEntry(AbstractConfigType info) { + info.guiValue = new EntryInfo(); + Class fieldClass = info.getType(); + + if (ConfigEntry.class.isAssignableFrom(info.getClass())) { + if (fieldClass == Integer.class) { + // For int + textField(info, Integer::parseInt, INTEGER_ONLY_REGEX, true); + } else if (fieldClass == Double.class) { + // For double + textField(info, Double::parseDouble, DECIMAL_ONLY_REGEX, false); + } else if (fieldClass == String.class || fieldClass == List.class) { + // For string or list + textField(info, String::length, null, true); + } else if (fieldClass == Boolean.class) { + // For boolean + Function func = value -> new TextComponent((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED); + ((EntryInfo) info.guiValue).widget = new AbstractMap.SimpleEntry>(button -> { + ((ConfigEntry) info).setWTSave(!(Boolean) info.get()); + button.setMessage(func.apply(info.get())); + }, func); + } + else if (fieldClass.isEnum()) + { + // For enum + List values = Arrays.asList(info.getType().getEnumConstants()); + Function func = value -> new TranslatableComponent(ModInfo.ID + ".config." + "enum." + fieldClass.getSimpleName() + "." + info.get().toString()); + ((EntryInfo) info.guiValue).widget = new AbstractMap.SimpleEntry>(button -> { + int index = values.indexOf(info.get()) + 1; + info.set(values.get(index >= values.size() ? 0 : index)); + button.setMessage(func.apply(info.get())); + }, func); + } + } else if (ConfigCategory.class.isAssignableFrom(info.getClass())) { +// if (!info.info.getName().equals("")) +// info.name = new TranslatableComponent(info.info.getName()); + } +// return info; + } + + + /** + * creates a text field + */ + private static void textField(AbstractConfigType info, Function func, Pattern pattern, boolean cast) { + boolean isNumber = pattern != null; + ((EntryInfo) info.guiValue).widget = (BiFunction>) (editBox, button) -> stringValue -> + { + stringValue = stringValue.trim(); + if (!(stringValue.isEmpty() || !isNumber || pattern.matcher(stringValue).matches())) + return false; + + Number value = 0; + ((EntryInfo) info.guiValue).error = null; + if (isNumber && !stringValue.isEmpty() && !stringValue.equals("-") && !stringValue.equals(".")) { + value = func.apply(stringValue); + ((EntryInfo) info.guiValue).error = ((ConfigEntry) info).isValid(value) == 0 ? null : new AbstractMap.SimpleEntry<>(editBox, new TextComponent(((ConfigEntry) info).isValid(value) == -1 ? + "§cMinimum " + "length" + (cast ? " is " + (int) ((ConfigEntry) info).getMin() : " is " + ((ConfigEntry) info).getMin()) : + "§cMaximum " + "length" + (cast ? " is " + (int) ((ConfigEntry) info).getMax() : " is " + ((ConfigEntry) info).getMax()))); + } + + ((EntryInfo) info.guiValue).tempValue = stringValue; + editBox.setTextColor(((ConfigEntry) info).isValid(value) == 0 ? 0xFFFFFFFF : 0xFFFF7777); +// button.active = entries.stream().allMatch(e -> e.inLimits); + + + if (((ConfigEntry) info).isValid(value) == 0 && info.getType() != List.class) { + if (!cast) + ((ConfigEntry) info).setWTSave(value); + else + ((ConfigEntry) info).setWTSave(value.intValue()); + } +// else if (((ConfigEntry) info).isValid() == 0) +// { +// if (((List) info.get()).size() == ((EntryInfo) info.guiValue).index) +// info.set(((List) info.get()).add("")); +// info.set(((List) info.get()).set(((EntryInfo) info.guiValue).index, Arrays.stream(((EntryInfo) info.guiValue).tempValue.replace("[", "").replace("]", "").split(", ")).collect(Collectors.toList()).get(0))); +// } + + return true; + }; + } + + //==============// + // GUI handling // + //==============// + + /** + * if you want to get this config gui's screen call this + */ + public static Screen getScreen(Screen parent, String category) { + return new ConfigScreen(parent, category); + } + + /** + * Pain + */ + private static class ConfigScreen extends Screen { + protected ConfigScreen(Screen parent, String category) { + super(new TranslatableComponent( + I18n.exists(ModInfo.ID + ".config" + (category.isEmpty() ? "." + category : "") + ".title") ? + ModInfo.ID + ".config.title" : + ModInfo.ID + ".config" + (category.isEmpty() ? "" : "." + category) + ".title") + ); + this.parent = parent; + this.category = category; + this.translationPrefix = ModInfo.ID + ".config."; + } + + private final String translationPrefix; + private final Screen parent; + private final String category; + private ConfigListWidget list; + private boolean reload = false; + + // Real Time config update // + @Override + public void tick() { + super.tick(); + } + + + /** + * When you close it, it goes to the previous screen and saves + */ + @Override + public void onClose() { + ConfigFileHandling.saveToFile(); + Objects.requireNonNull(minecraft).setScreen(this.parent); + } + + // addRenderableWidget in 1.17 and over + // addButton in 1.16 and below + private Button addBtn(Button button) { +// #if PRE_MC_1_17_1 +// this.addButton(button); +// #else + this.addRenderableWidget(button); +// #endif + return button; + } + + @Override + protected void init() { + super.init(); + if (!reload) + ConfigFileHandling.loadFromFile(); + + addBtn(new Button(this.width / 2 - 154, this.height - 28, 150, 20, CommonComponents.GUI_CANCEL, button -> { + ConfigFileHandling.loadFromFile(); + Objects.requireNonNull(minecraft).setScreen(parent); + })); + Button done = addBtn(new Button(this.width / 2 + 4, this.height - 28, 150, 20, CommonComponents.GUI_DONE, (button) -> { + ConfigFileHandling.saveToFile(); + Objects.requireNonNull(minecraft).setScreen(parent); + })); + + this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, this.height - 32, 25); + if (this.minecraft != null && this.minecraft.level != null) + this.list.setRenderBackground(false); + this.addWidget(this.list); + for (AbstractConfigType info : ConfigBase.entries) { + if (info.getCategory().matches(category) && info.getAppearance().showInGui) { + initEntry(info); + TranslatableComponent name = new TranslatableComponent(translationPrefix + info.getNameWCategory()); + if (ConfigEntry.class.isAssignableFrom(info.getClass())) { + Button resetButton = new Button(this.width - ConfigScreenConfigs.SpaceFromRightScreen - 150 - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth, 0, ConfigScreenConfigs.ResetButtonWidth, 20, new TextComponent("Reset").withStyle(ChatFormatting.RED), (button -> { + ((ConfigEntry) info).setWTSave(((ConfigEntry) info).getDefaultValue()); + ((EntryInfo) info.guiValue).index = 0; + this.reload = true; + Objects.requireNonNull(minecraft).setScreen(this); + })); + + if (((EntryInfo) info.guiValue).widget instanceof Map.Entry) { + Map.Entry> widget = (Map.Entry>) ((EntryInfo) info.guiValue).widget; + if (info.getType().isEnum()) + widget.setValue(value -> new TranslatableComponent(translationPrefix + "enum." + info.getType().getSimpleName() + "." + info.get().toString())); + this.list.addButton(new Button(this.width - 150 - ConfigScreenConfigs.SpaceFromRightScreen, 0, 150, 20, widget.getValue().apply(info.get()), widget.getKey()), resetButton, null, name); + } else if (((EntryInfo) info.guiValue).widget != null) { + EditBox widget = new EditBox(font, this.width - 150 - ConfigScreenConfigs.SpaceFromRightScreen + 2, 0, 150 - 4, 20, null); + widget.setMaxLength(150); + widget.insertText(String.valueOf(info.get())); + Predicate processor = ((BiFunction>) ((EntryInfo) info.guiValue).widget).apply(widget, done); + widget.setFilter(processor); + this.list.addButton(widget, resetButton, null, name); + } + } else if (ConfigCategory.class.isAssignableFrom(info.getClass())) { + Button widget = new Button(this.width / 2 - 100, this.height - 28, 100 * 2, 20, name, (button -> { + ConfigFileHandling.saveToFile(); + Objects.requireNonNull(minecraft).setScreen(ClassicConfigGUI.getScreen(this, ((ConfigCategory) info).getDestination())); + })); + this.list.addButton(widget, null, null, null); + } + } + } + + } + + @Override + public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + this.renderBackground(matrices); // Renders background + this.list.render(matrices, mouseX, mouseY, delta); // Render buttons + drawCenteredString(matrices, font, title, width / 2, 15, 0xFFFFFF); // Render title + + // Render the tooltip only if it can find a tooltip in the language file + for (AbstractConfigType info : ConfigBase.entries) { // idk why this is using the normal entries but as long as it works, it works + if (info.getCategory().matches(category) && info.getAppearance().showInGui) { + if (list.getHoveredButton(mouseX, mouseY).isPresent()) { + AbstractWidget buttonWidget = list.getHoveredButton(mouseX, mouseY).get(); + Component text = ButtonEntry.buttonsWithText.get(buttonWidget); + TranslatableComponent name = new TranslatableComponent(this.translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.getName()); + String key = translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.getName() + ".@tooltip"; + + if (((EntryInfo) info.guiValue).error != null && text.equals(name)) + renderTooltip(matrices, (Component) ((EntryInfo) info.guiValue).error.getValue(), mouseX, mouseY); + else if (I18n.exists(key) && (text != null && text.equals(name))) { + List list = new ArrayList<>(); + for (String str : I18n.get(key).split("\n")) + list.add(new TextComponent(str)); + renderComponentTooltip(matrices, list, mouseX, mouseY); + } + } + } + } + super.render(matrices, mouseX, mouseY, delta); + } + } + + + + + + + + + + public static class ConfigListWidget extends ContainerObjectSelectionList { + Font textRenderer; + + public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l, int m) { + super(minecraftClient, i, j, k, l, m); + this.centerListVertically = false; + textRenderer = minecraftClient.font; + } + + public void addButton(AbstractWidget button, AbstractWidget resetButton, AbstractWidget indexButton, Component text) { + this.addEntry(ButtonEntry.create(button, text, resetButton, indexButton)); + } + + @Override + public int getRowWidth() { + return 10000; + } + + public Optional getHoveredButton(double mouseX, double mouseY) { + for (ButtonEntry buttonEntry : this.children()) { + if (buttonEntry.button != null && buttonEntry.button.isMouseOver(mouseX, mouseY)) { + return Optional.of(buttonEntry.button); + } + } + return Optional.empty(); + } + } + + + public static class ButtonEntry extends ContainerObjectSelectionList.Entry { + private static final Font textRenderer = Minecraft.getInstance().font; + public final AbstractWidget button; + private final AbstractWidget resetButton; + private final AbstractWidget indexButton; + private final Component text; + private final List children = new ArrayList<>(); + public static final Map buttonsWithText = new HashMap<>(); + + private ButtonEntry(AbstractWidget button, Component text, AbstractWidget resetButton, AbstractWidget indexButton) { + buttonsWithText.put(button, text); + this.button = button; + this.resetButton = resetButton; + this.text = text; + this.indexButton = indexButton; + if (button != null) + children.add(button); + if (resetButton != null) + children.add(resetButton); + if (indexButton != null) + children.add(indexButton); + } + + public static ButtonEntry create(AbstractWidget button, Component text, AbstractWidget resetButton, AbstractWidget indexButton) { + return new ButtonEntry(button, text, resetButton, indexButton); + } + + @Override + public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { + if (button != null) { + button.y = y; + button.render(matrices, mouseX, mouseY, tickDelta); + } + if (resetButton != null) { + resetButton.y = y; + resetButton.render(matrices, mouseX, mouseY, tickDelta); + } + if (indexButton != null) { + indexButton.y = y; + indexButton.render(matrices, mouseX, mouseY, tickDelta); + } + if (text != null && (!text.getString().contains("spacer") || button != null)) + GuiComponent.drawString(matrices, textRenderer, text, 12, y + 5, 0xFFFFFF); + } + + @Override + public List children() { + return children; + } + + // Only for 1.17 and over + // Remove in 1.16 and below +// #if POST_MC_1_17_1 + @Override + public List narratables() { + return children; + } +// #endif + } +} diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigGui.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigGui.java deleted file mode 100644 index 1e75a1219..000000000 --- a/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigGui.java +++ /dev/null @@ -1,774 +0,0 @@ -package com.seibel.lod.common.wrappers.config; - -import java.lang.reflect.Field; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -// Logger (for debug stuff) - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -// Uses https://github.com/TheElectronWill/night-config for toml (only for Fabric since Forge already includes this) - -import com.electronwill.nightconfig.core.file.CommentedFileConfig; - -// Gets info from our own mod - -import com.seibel.lod.common.LodCommonMain; -import com.seibel.lod.core.ModInfo; -import com.seibel.lod.core.config.*; - -// Minecraft imports - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.components.ContainerObjectSelectionList; -import net.minecraft.client.gui.components.EditBox; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.CommonComponents; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; -import net.minecraft.client.resources.language.I18n; // translation -#if POST_MC_1_17_1 -import net.minecraft.client.gui.narration.NarratableEntry; -#endif - -/** - * Based upon TinyConfig - * https://github.com/Minenash/TinyConfig - * - * This config should work for both Fabric and Forge as long as you use Mojang mappings - * - * Credits to Motschen - * - * @author coolGi2007 - * @version 1-14-2022 - */ -@SuppressWarnings("unchecked") -public abstract class ConfigGui -{ - /* - TODO list - - Fix floats not working - Make a wiki - Make it so you can enable and disable buttons from showing - Make min and max not final - Move the ConfigScreenConfigs class to the config class that extends this - */ - /* - List of hacky things that are done that should be done properly - - The buttons that don't show are still loaded but just not rendered - The screen with is set to double so the scroll bar doesn't show - */ - - - private static final Pattern INTEGER_ONLY_REGEX = Pattern.compile("(-?[0-9]*)"); - private static final Pattern DECIMAL_ONLY_REGEX = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)"); - - private static final List entries = new ArrayList<>(); - public static final Map entryMap = new HashMap<>(); - - // Change these to your own mod - private static final String MOD_NAME = ModInfo.NAME; // For file saving and identifying - private static final String MOD_NAME_READABLE = ModInfo.READABLE_NAME; // For logs - // private static final Logger LOGGER = ApiShared.LOGGER; // For logs - private static final Logger LOGGER = LogManager.getLogger(ModInfo.NAME); // For logs (this inits before ClientAPI so this is a temp fix) - - - - - //==============// - // Initializers // - //==============// - - private static class ConfigScreenConfigs - { - // This contains all the configs for the configs - public static final int SpaceFromRightScreen = 10; - public static final int ButtonWidthSpacing = 5; - public static final int ResetButtonWidth = 40; - } - - public static class EntryInfo - { - Field field; - Object widget; - int width = 0; - int max; - Map.Entry error; - Object defaultValue; - Object value; - String tempValue; - boolean inLimits = true; - TranslatableComponent name; - int index; - /** Hides the button */ - boolean hideOption = false; - /** This asks if it is a button to goto a new screen */ - boolean screenButton = false; - /** This is only called if button is true */ - String gotoScreen = ""; - String category; - Class varClass; - - - @Deprecated - boolean fileComment = false; - } - - private static Path configFilePath; - - - - public static void init(Class config) - { - Minecraft mc = Minecraft.getInstance(); - configFilePath = mc.gameDirectory.toPath().resolve("config").resolve(MOD_NAME + ".toml"); - - initNestedClass(config, ""); - - for (EntryInfo info : entries) { - if (info.field.isAnnotationPresent(ConfigAnnotations.Entry.class)) { - try { - info.value = info.field.get(null); - info.tempValue = info.value.toString(); - } catch (IllegalAccessException ignored) { - } - } - } - - loadFromFile(); - } - - private static void initNestedClass(Class config, String category) - { - for (Field field : config.getFields()) - { - EntryInfo info = new EntryInfo(); - if (field.isAnnotationPresent(ConfigAnnotations.Entry.class) || field.isAnnotationPresent(ConfigAnnotations.Comment.class) || field.isAnnotationPresent(ConfigAnnotations.ScreenEntry.class)) - { - // If putting in your own mod then put your own check for server sided - info.category = category; - if (!LodCommonMain.serverSided) - initClient(field, info, category); - } - - if (field.isAnnotationPresent(ConfigAnnotations.Entry.class)) - { - entryMap.put((!category.isEmpty() ? category + "." : "") + field.getName(), info); - info.varClass = field.getType(); - try - { - info.defaultValue = field.get(null); - } - catch (IllegalAccessException ignored) {} - } - - if (field.isAnnotationPresent(ConfigAnnotations.ScreenEntry.class)) - initNestedClass(field.getType(), (!category.isEmpty() ? category + "." : "") + field.getName()); - - // File comment (WILL BE REMOVED SOON) - if (field.isAnnotationPresent(ConfigAnnotations.FileComment.class)) { - entryMap.put((!category.isEmpty() ? category + "." : "") + field.getName(), info); - info.fileComment = true; - try - { - info.value = info.defaultValue = field.get(null); - } - catch (IllegalAccessException ignored) {} - } - - info.field = field; - } - } - - /** This adds the buttons to the queue to be rendered */ - private static void initClient(Field field, EntryInfo info, String category) - { - Class fieldClass = field.getType(); - ConfigAnnotations.Entry entry = field.getAnnotation(ConfigAnnotations.Entry.class); - ConfigAnnotations.ScreenEntry screenEntry = field.getAnnotation(ConfigAnnotations.ScreenEntry.class); - - if (entry != null) - info.width = entry.width(); - else if (screenEntry != null) - info.width = screenEntry.width(); - - if (entry != null) - { - if (!entry.name().equals("")) - info.name = new TranslatableComponent(entry.name()); - - - if (fieldClass == int.class) - { - // For int - textField(info, Integer::parseInt, INTEGER_ONLY_REGEX, entry.minValue(), entry.maxValue(), true); - } - else if (fieldClass == double.class) - { - // For double - textField(info, Double::parseDouble, DECIMAL_ONLY_REGEX, entry.minValue(), entry.maxValue(), false); - } - else if (fieldClass == String.class || fieldClass == List.class) - { - // For string or list - info.max = entry.maxValue() == Double.MAX_VALUE ? Integer.MAX_VALUE : (int) entry.maxValue(); - textField(info, String::length, null, Math.min(entry.minValue(), 0), Math.max(entry.maxValue(), 1), true); - } - else if (fieldClass == boolean.class) - { - // For boolean - Function func = value -> new TextComponent((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED); - info.widget = new AbstractMap.SimpleEntry>(button -> { - info.value = !(Boolean) info.value; - button.setMessage(func.apply(info.value)); - }, func); - } - else if (fieldClass.isEnum()) - { - // For enum - List values = Arrays.asList(field.getType().getEnumConstants()); - Function func = value -> new TranslatableComponent(MOD_NAME + ".config." + "enum." + fieldClass.getSimpleName() + "." + info.value.toString()); - info.widget = new AbstractMap.SimpleEntry>(button -> { - int index = values.indexOf(info.value) + 1; - info.value = values.get(index >= values.size() ? 0 : index); - button.setMessage(func.apply(info.value)); - }, func); - } - } - else if (screenEntry != null) - { - if (!screenEntry.name().equals("")) - info.name = new TranslatableComponent(screenEntry.name()); - - info.screenButton = true; - info.gotoScreen = (!info.category.isEmpty() ? info.category + "." : "") + field.getName(); - } - entries.add(info); - } - - - - - /** creates a text field */ - private static void textField(EntryInfo info, Function func, Pattern pattern, double minValue, double maxValue, boolean cast) - { - boolean isNumber = pattern != null; - info.widget = (BiFunction>) (editBox, button) -> stringValue -> - { - stringValue = stringValue.trim(); - if (!(stringValue.isEmpty() || !isNumber || pattern.matcher(stringValue).matches())) - return false; - - Number value = 0; - boolean inLimits = false; - info.error = null; - if (isNumber && !stringValue.isEmpty() && !stringValue.equals("-") && !stringValue.equals(".")) - { - value = func.apply(stringValue); - inLimits = value.doubleValue() >= minValue && value.doubleValue() <= maxValue; - info.error = inLimits ? null : new AbstractMap.SimpleEntry<>(editBox, new TextComponent(value.doubleValue() < minValue ? - "§cMinimum " + "length" + (cast ? " is " + (int) minValue : " is " + minValue) : - "§cMaximum " + "length" + (cast ? " is " + (int) maxValue : " is " + maxValue))); - } - - info.tempValue = stringValue; - editBox.setTextColor(inLimits ? 0xFFFFFFFF : 0xFFFF7777); - info.inLimits = inLimits; - button.active = entries.stream().allMatch(e -> e.inLimits); - - - if (inLimits && info.field.getType() != List.class) - { - info.value = value; - } - else if (inLimits) - { - if (((List) info.value).size() == info.index) - ((List) info.value).add(""); - ((List) info.value).set(info.index, Arrays.stream(info.tempValue.replace("[", "").replace("]", "").split(", ")).collect(Collectors.toList()).get(0)); - } - - return true; - }; - } - - - - - //===============// - // File Handling // - //===============// - - /** Grabs what is in the config and puts it in modid.toml */ - public static void saveToFile() - { - CommentedFileConfig config = CommentedFileConfig.builder(configFilePath.toFile()).build(); - - // First try to create a config file - try { - if (!Files.exists(configFilePath)) - Files.createFile(configFilePath); - } - catch (Exception e) { - LOGGER.info("Failed creating config file for " + MOD_NAME_READABLE + " at the path [" + configFilePath.toString() + "]."); - e.printStackTrace(); - } - - loadFileWithErrorCheck(config); - - - // Just put this here for the future - config.setComment("_Version", " DONT TOUCH THIS, IF YOU DO THEN CONFIG FILE WOULD BREAK"); - config.set("_Versions", ModInfo.VERSION); - - - for (EntryInfo info : entries) { - if (info.field.isAnnotationPresent(ConfigAnnotations.Entry.class)) { - editSingleOption.saveOption(info, config); - - if (editSingleOption.getEntry((info.category.isEmpty() ? "" : info.category + ".") + "_" + info.field.getName()) != null) - config.setComment((info.category.isEmpty() ? "" : info.category + ".") + info.field.getName(), String.valueOf(editSingleOption.getEntry((info.category.isEmpty() ? "" : info.category + ".") + "_" + info.field.getName()).defaultValue)); - } - } - - config.save(); - config.close(); - } - - /** - * Grabs what is in modid.toml and puts it into the config - * If the file doesn't exist then it runs saveToFile - */ - public static void loadFromFile() - { - CommentedFileConfig config = CommentedFileConfig.builder(configFilePath.toFile()).autosave().build(); - - // First checks if the config file was already made - if (!Files.exists(configFilePath)) { - LOGGER.info("Config file not found for " + MOD_NAME_READABLE + ". Creating config..."); - saveToFile(); - return; - } - - loadFileWithErrorCheck(config); - - - // Just put this here for the future - config.setComment("_Version", " DONT TOUCH THIS, IF YOU DO THEN CONFIG FILE WOULD BREAK"); - config.set("_Versions", ModInfo.VERSION); - - - // Puts everything into its variable - for (EntryInfo info : entries) { - if (info.field.isAnnotationPresent(ConfigAnnotations.Entry.class)) { - editSingleOption.loadOption(info, config); - - // File comments (WILL REMOVE SOON) - if (editSingleOption.getEntry((info.category.isEmpty() ? "" : info.category + ".") + "_" + info.field.getName()) != null) - config.setComment((info.category.isEmpty() ? "" : info.category + ".") + info.field.getName(), String.valueOf(editSingleOption.getEntry((info.category.isEmpty() ? "" : info.category + ".") + "_" + info.field.getName()).defaultValue)); - } - } - - config.close(); - } - - public static class editSingleOption { - /** Get the entry info of an item using its string name */ - public static EntryInfo getEntry(String name) - { - return entryMap.get(name); - } - - /** Save a single item using its string name */ - public static void saveOption(String name) - { - saveOption(entryMap.get(name)); - } - - /** Saves a single item using entry info */ - public static void saveOption(EntryInfo info) - { - CommentedFileConfig config = CommentedFileConfig.builder(configFilePath.toFile()).autosave().build(); - - loadFileWithErrorCheck(config); - - saveOption(info, config); - - config.close(); - } - - /** Saves a single item using its entry info and its config builder */ - public static void saveOption(EntryInfo info, CommentedFileConfig config) - { - config.set((info.category.isEmpty() ? "" : info.category + ".") + info.field.getName(), info.value); - } - - /** Load a single item using its string name */ - public static void loadOption(String name) - { - loadOption(entryMap.get(name)); - } - - /** Load a single item using entry info */ - public static void loadOption(EntryInfo info) - { - CommentedFileConfig config = CommentedFileConfig.builder(configFilePath.toFile()).autosave().build(); - - loadFileWithErrorCheck(config); - - loadOption(info, config); - - config.close(); - } - - /** Loads a single item using its entry info and its config builder */ - public static void loadOption(EntryInfo info, CommentedFileConfig config) - { - String itemPath = (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName(); - if (config.contains(itemPath)) { - if (info.field.getType().isEnum()) - info.value = config.getEnum(itemPath, info.varClass); - else - info.value = config.get(itemPath); - } else - config.set(itemPath, info.value); - - try { - info.field.set(null, info.value); - } catch (IllegalAccessException ignored) { - } - } - } - - /** Dose config.load(); but with error checking to avoid crashes */ - public static void loadFileWithErrorCheck(CommentedFileConfig config) { - try { - config.load(); - } catch (Exception e) { - LOGGER.info("Error loading config for " + MOD_NAME_READABLE + " at the path [" + configFilePath.toString() + "]."); - LOGGER.info("Creating a new config..."); - try { - Files.deleteIfExists(configFilePath); - saveToFile(); - } catch (Exception f) { - LOGGER.info("Failed creating config file for " + MOD_NAME_READABLE + " at the path [" + configFilePath.toString() + "]."); - f.printStackTrace(); - } - } - } - - - - - //==============// - // GUI handling // - //==============// - - public static Screen getScreen(Screen parent, String category) - { - return new ConfigScreen(parent, category); - } - - private static class ConfigScreen extends Screen - { - protected ConfigScreen(Screen parent, String category) - { - super(new TranslatableComponent( - I18n.exists(MOD_NAME + ".config" + (category.isEmpty()? "." + category : "") + ".title") ? - MOD_NAME + ".config.title" : - MOD_NAME + ".config" + (category.isEmpty() ? "" : "." + category) + ".title") - ); - this.parent = parent; - this.category = category; - this.translationPrefix = MOD_NAME + ".config."; - } - - private final String translationPrefix; - private final Screen parent; - private final String category; - private ConfigListWidget list; - private boolean reload = false; - - // Real Time config update // - @Override - public void tick() - { - super.tick(); - } - - - /** When you close it, it goes to the previous screen and saves */ - @Override - public void onClose() - { - saveToFile(); - Objects.requireNonNull(minecraft).setScreen(this.parent); - } - - // addRenderableWidget in 1.17 and over - // addButton in 1.16 and below - private Button addBtn(Button button) { - #if PRE_MC_1_17_1 - this.addButton(button); - #else - this.addRenderableWidget(button); - #endif - return button; - } - - @Override - protected void init() - { - super.init(); - if (!reload) - loadFromFile(); - - addBtn(new Button(this.width / 2 - 154, this.height - 28, 150, 20, CommonComponents.GUI_CANCEL, button -> { - loadFromFile(); - Objects.requireNonNull(minecraft).setScreen(parent); - })); - Button done = addBtn(new Button(this.width / 2 + 4, this.height - 28, 150, 20, CommonComponents.GUI_DONE, (button) -> { - saveToFile(); - Objects.requireNonNull(minecraft).setScreen(parent); - })); - - this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, this.height - 32, 25); - if (this.minecraft != null && this.minecraft.level != null) - this.list.setRenderBackground(false); - this.addWidget(this.list); - for (EntryInfo info : entries) - { - if (info.category.matches(category) && !info.hideOption) - { - TranslatableComponent name = (info.name == null ? new TranslatableComponent(translationPrefix + (!info.category.isEmpty() ? info.category + "." : "") + info.field.getName()) : info.name); - Button resetButton = new Button(this.width - ConfigScreenConfigs.SpaceFromRightScreen - info.width - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth, 0, ConfigScreenConfigs.ResetButtonWidth, 20, new TextComponent("Reset").withStyle(ChatFormatting.RED), (button -> { - info.value = info.defaultValue; - info.tempValue = info.defaultValue.toString(); - info.index = 0; - this.reload = true; - Objects.requireNonNull(minecraft).setScreen(this); - })); - - if (info.widget instanceof Map.Entry) - { - Map.Entry> widget = (Map.Entry>) info.widget; - if (info.field.getType().isEnum()) - widget.setValue(value -> new TranslatableComponent(translationPrefix + "enum." + info.field.getType().getSimpleName() + "." + info.value.toString())); - this.list.addButton(new Button(this.width - info.width - ConfigScreenConfigs.SpaceFromRightScreen, 0, info.width, 20, widget.getValue().apply(info.value), widget.getKey()), resetButton, null, name); - } - else if (info.field.getType() == List.class) - { - if (!reload) - info.index = 0; - EditBox widget = new EditBox(font, this.width - info.width - ConfigScreenConfigs.SpaceFromRightScreen, 0, info.width, 20, null); - widget.setMaxLength(info.width); - if (info.index < ((List) info.value).size()) - widget.insertText((String.valueOf(((List) info.value).get(info.index)))); - else - widget.insertText(""); - Predicate processor = ((BiFunction>) info.widget).apply(widget, done); - widget.setFilter(processor); - resetButton.setWidth(20); - resetButton.setMessage(new TextComponent("R").withStyle(ChatFormatting.RED)); - Button cycleButton = new Button(this.width - 185, 0, 20, 20, new TextComponent(String.valueOf(info.index)).withStyle(ChatFormatting.GOLD), (button -> { - ((List) info.value).remove(""); - this.reload = true; - info.index = info.index + 1; - if (info.index > ((List) info.value).size()) - info.index = 0; - Objects.requireNonNull(minecraft).setScreen(this); - })); - this.list.addButton(widget, resetButton, cycleButton, name); - } - else if (info.widget != null) - { - EditBox widget = new EditBox(font, this.width - info.width - ConfigScreenConfigs.SpaceFromRightScreen + 2, 0, info.width - 4, 20, null); - widget.setMaxLength(info.width); - widget.insertText(String.valueOf(info.value)); - Predicate processor = ((BiFunction>) info.widget).apply(widget, done); - widget.setFilter(processor); - this.list.addButton(widget, resetButton, null, name); - } - else if (info.screenButton) - { - Button widget = new Button(this.width / 2 - info.width, this.height - 28, info.width * 2, 20, name, (button -> { - saveToFile(); - Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, info.gotoScreen)); - })); - this.list.addButton(widget, null, null, null); - } - else if (!info.fileComment) - { - this.list.addButton(null, null, null, name); - } - } - } - - } - - @Override - public void render(PoseStack matrices, int mouseX, int mouseY, float delta) - { - this.renderBackground(matrices); // Renders background - this.list.render(matrices, mouseX, mouseY, delta); // Render buttons - drawCenteredString(matrices, font, title, width / 2, 15, 0xFFFFFF); // Render title - - // Render the tooltip only if it can find a tooltip in the language file - for (EntryInfo info : entries) { - if (info.category.matches(category) && !info.hideOption) { - if (list.getHoveredButton(mouseX,mouseY).isPresent()) { - AbstractWidget buttonWidget = list.getHoveredButton(mouseX,mouseY).get(); - Component text = ButtonEntry.buttonsWithText.get(buttonWidget); - TranslatableComponent name = new TranslatableComponent(this.translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName()); - String key = translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName() + ".@tooltip"; - - if (info.error != null && text.equals(name)) renderTooltip(matrices, (Component) info.error.getValue(), mouseX, mouseY); - else if (I18n.exists(key) && (text != null && text.equals(name))) { - List list = new ArrayList<>(); - for (String str : I18n.get(key).split("\n")) - list.add(new TextComponent(str)); - renderComponentTooltip(matrices, list, mouseX, mouseY); - } - } - } - } - super.render(matrices, mouseX, mouseY, delta); - } - } - - - - - public static class ConfigListWidget extends ContainerObjectSelectionList - { - Font textRenderer; - - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l, int m) - { - super(minecraftClient, i, j, k, l, m); - this.centerListVertically = false; - textRenderer = minecraftClient.font; - } - - public void addButton(AbstractWidget button, AbstractWidget resetButton, AbstractWidget indexButton, Component text) - { - this.addEntry(ButtonEntry.create(button, text, resetButton, indexButton)); - } - - @Override - public int getRowWidth() - { - return 10000; - } - - public Optional getHoveredButton(double mouseX, double mouseY) - { - for (ButtonEntry buttonEntry : this.children()) - { - if (buttonEntry.button != null && buttonEntry.button.isMouseOver(mouseX, mouseY)) - { - return Optional.of(buttonEntry.button); - } - } - return Optional.empty(); - } - } - - - - - - public static class ButtonEntry extends ContainerObjectSelectionList.Entry - { - private static final Font textRenderer = Minecraft.getInstance().font; - public final AbstractWidget button; - private final AbstractWidget resetButton; - private final AbstractWidget indexButton; - private final Component text; - private final List children = new ArrayList<>(); - public static final Map buttonsWithText = new HashMap<>(); - - private ButtonEntry(AbstractWidget button, Component text, AbstractWidget resetButton, AbstractWidget indexButton) - { - buttonsWithText.put(button, text); - this.button = button; - this.resetButton = resetButton; - this.text = text; - this.indexButton = indexButton; - if (button != null) - children.add(button); - if (resetButton != null) - children.add(resetButton); - if (indexButton != null) - children.add(indexButton); - } - - public static ButtonEntry create(AbstractWidget button, Component text, AbstractWidget resetButton, AbstractWidget indexButton) - { - return new ButtonEntry(button, text, resetButton, indexButton); - } - - @Override - public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) - { - if (button != null) - { - button.y = y; - button.render(matrices, mouseX, mouseY, tickDelta); - } - if (resetButton != null) - { - resetButton.y = y; - resetButton.render(matrices, mouseX, mouseY, tickDelta); - } - if (indexButton != null) - { - indexButton.y = y; - indexButton.render(matrices, mouseX, mouseY, tickDelta); - } - if (text != null && (!text.getString().contains("spacer") || button != null)) - GuiComponent.drawString(matrices, textRenderer, text, 12, y + 5, 0xFFFFFF); - } - - @Override - public List children() - { - return children; - } - - // Only for 1.17 and over - // Remove in 1.16 and below - #if POST_MC_1_17_1 - @Override - public List narratables() - { - return children; - } - #endif - } -} diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigScreenMC.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigScreenMC.java new file mode 100644 index 000000000..75ed37206 --- /dev/null +++ b/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigScreenMC.java @@ -0,0 +1,83 @@ +package com.seibel.lod.common.wrappers.config; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.seibel.lod.core.ModInfo; +import com.seibel.lod.core.config.gui.AbstractScreen; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.components.ContainerObjectSelectionList; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.TranslatableComponent; + +import java.util.*; + +public class ConfigScreenMC { + public static Screen getScreen(Screen parent, AbstractScreen screen) { + + return new ConfigScreenRenderer(parent, screen); + } + + private static class ConfigScreenRenderer extends Screen { + private final Screen parent; + private ConfigListWidget list; + private AbstractScreen screen; + protected ConfigScreenRenderer(Screen parent, AbstractScreen screen) { + super(new TranslatableComponent(ModInfo.ID + ".config.title")); + this.parent = parent; + this.screen = screen; + } + + @Override + protected void init() { +// super.init(); + screen.width = this.width; + screen.height = this.height; + screen.init(); // Init our own config screen + + this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, this.height, 25); // Select the area to tint + if (this.minecraft != null && this.minecraft.level != null) // Check if in game + this.list.setRenderBackground(false); // Disable from rendering + this.addWidget(this.list); // Add the tint to the things to be rendered + } + + @Override + public void render(PoseStack matrices, int mouseX, int mouseY, float delta) { + this.renderBackground(matrices); // Render background + this.list.render(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker) + + screen.width = this.width; // Is there a way to only call this when the window changes the size + screen.height = this.height; // Is there a way to only call this when the window changes the size + screen.mouseX = mouseX; + screen.mouseY = mouseY; + screen.render(delta); // Render everything on the main screen + + super.render(matrices, mouseX, mouseY, delta); // Render the vanilla stuff (currently only used for the background and tint) + } + + @Override + public void tick() { + screen.tick(); + if (screen.close) + onClose(); + } + + @Override + public void onClose() { + screen.onClose(); + Objects.requireNonNull(minecraft).setScreen(this.parent); // Goto the parent screen + } + + // For checking if it should close when you press the escape key + @Override + public boolean shouldCloseOnEsc() { + return screen.shouldCloseOnEsc; + } + } + + public static class ConfigListWidget extends ContainerObjectSelectionList { + public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l, int m) { + super(minecraftClient, i, j, k, l, m); + this.centerListVertically = false; + } + } + +} diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigWrapper.java new file mode 100644 index 000000000..06b1aea70 --- /dev/null +++ b/common/src/main/java/com/seibel/lod/common/wrappers/config/ConfigWrapper.java @@ -0,0 +1,17 @@ +package com.seibel.lod.common.wrappers.config; + +import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper; +import net.minecraft.client.resources.language.I18n; + +public class ConfigWrapper implements IConfigWrapper { + public static final ConfigWrapper INSTANCE = new ConfigWrapper(); + @Override + public boolean langExists(String str) { + return I18n.exists(str); + } + + @Override + public String getLang(String str) { + return I18n.get(str); + } +} diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/GetConfigScreen.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/GetConfigScreen.java new file mode 100644 index 000000000..5284a2a0c --- /dev/null +++ b/common/src/main/java/com/seibel/lod/common/wrappers/config/GetConfigScreen.java @@ -0,0 +1,26 @@ +package com.seibel.lod.common.wrappers.config; + +import com.seibel.lod.core.config.gui.ConfigScreen; +import net.minecraft.client.gui.screens.Screen; + +public class GetConfigScreen { + public static type useScreen = type.Classic; + public static enum type { + Classic, + OpenGL, + New; + } + + public static Screen getScreen(Screen parent) { + if (useScreen == type.Classic) { + return ClassicConfigGUI.getScreen(parent, ""); + } else if (useScreen == type.OpenGL) { + return ConfigScreenMC.getScreen(parent, new ConfigScreen()); + } else if (useScreen == type.New) { + System.out.println("This is not made yet"); + return null; + } + + return null; + } +} \ No newline at end of file diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java deleted file mode 100644 index b210c2359..000000000 --- a/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java +++ /dev/null @@ -1,966 +0,0 @@ -package com.seibel.lod.common.wrappers.config; - -import com.seibel.lod.core.enums.config.*; -import com.seibel.lod.core.enums.rendering.*; -import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; -import com.seibel.lod.common.Config; - -/** - * 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-16-2021 - */ -public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton -{ - public static final LodConfigWrapperSingleton INSTANCE = new LodConfigWrapperSingleton(); - - - private static final Client client = new Client(); - @Override - public IClient client() - { - return client; - } - - public static class Client implements IClient - { - public final IGraphics graphics; - public final IWorldGenerator worldGenerator; - public final IMultiplayer multiplayer; - public final IAdvanced advanced; - - - @Override - public IGraphics graphics() - { - return graphics; - } - - @Override - public IWorldGenerator worldGenerator() - { - return worldGenerator; - } - - @Override - public IMultiplayer multiplayer() { - return multiplayer; - } - - @Override - public IAdvanced advanced() - { - return advanced; - } - - - @Override - public boolean getOptionsButton() - { - return Config.optionsButton; - } - @Override - public void setOptionsButton(boolean newOptionsButton) - { - ConfigGui.editSingleOption.getEntry("optionsButton").value = newOptionsButton; - ConfigGui.editSingleOption.saveOption("optionsButton"); - } - - - //================// - // Client Configs // - //================// - public Client() - { - graphics = new Graphics(); - worldGenerator = new WorldGenerator(); - multiplayer = new Multiplayer(); - advanced = new Advanced(); - } - - - //==================// - // Graphics Configs // - //==================// - public static class Graphics implements IGraphics - { - public final IQuality quality; - public final IFogQuality fogQuality; - public final IAdvancedGraphics advancedGraphics; - - - - @Override - public IQuality quality() - { - return quality; - } - - @Override - public IFogQuality fogQuality() - { - return fogQuality; - } - - @Override - public IAdvancedGraphics advancedGraphics() - { - return advancedGraphics; - } - - - Graphics() - { - quality = new Quality(); - fogQuality = new FogQuality(); - advancedGraphics = new AdvancedGraphics(); - } - - - public static class Quality implements IQuality - { - @Override - public HorizontalResolution getDrawResolution() - { - return Config.Client.Graphics.Quality.drawResolution; - } - @Override - public void setDrawResolution(HorizontalResolution newHorizontalResolution) - { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.drawResolution").value = newHorizontalResolution; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.drawResolution"); - } - - - @Override - public int getLodChunkRenderDistance() - { - return Config.Client.Graphics.Quality.lodChunkRenderDistance; - } - @Override - public void setLodChunkRenderDistance(int newLodChunkRenderDistance) - { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.lodChunkRenderDistance").value = newLodChunkRenderDistance; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.lodChunkRenderDistance"); - } - - - @Override - public VerticalQuality getVerticalQuality() - { - return Config.Client.Graphics.Quality.verticalQuality; - } - @Override - public void setVerticalQuality(VerticalQuality newVerticalQuality) - { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.verticalQuality").value = newVerticalQuality; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.verticalQuality"); - } - - - @Override - public int getHorizontalScale() - { - return Config.Client.Graphics.Quality.horizontalScale; - } - @Override - public void setHorizontalScale(int newHorizontalScale) - { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.horizontalScale").value = newHorizontalScale; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.horizontalScale"); - } - - - @Override - public HorizontalQuality getHorizontalQuality() - { - return Config.Client.Graphics.Quality.horizontalQuality; - } - @Override - public void setHorizontalQuality(HorizontalQuality newHorizontalQuality) - { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.horizontalQuality").value = newHorizontalQuality; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.horizontalQuality"); - } - - @Override - public DropoffQuality getDropoffQuality() { - return Config.Client.Graphics.Quality.dropoffQuality; - } - @Override - public void setDropoffQuality(DropoffQuality newDropoffQuality) { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.dropoffQuality").value = newDropoffQuality; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.dropoffQuality"); - } - - @Override - public int getLodBiomeBlending() { - return Config.Client.Graphics.Quality.lodBiomeBlending; - } - - @Override - public void setLodBiomeBlending(int newLodBiomeBlending) { - ConfigGui.editSingleOption.getEntry("client.graphics.quality.lodBiomeBlending").value = newLodBiomeBlending; - ConfigGui.editSingleOption.saveOption("client.graphics.quality.lodBiomeBlending"); - } - } - - - public static class FogQuality implements IFogQuality - { - public final IAdvancedFog advancedFog; - - FogQuality() - { - advancedFog = new AdvancedFog(); - } - - @Override - public FogDistance getFogDistance() - { - return Config.Client.Graphics.FogQuality.fogDistance; - } - @Override - public void setFogDistance(FogDistance newFogDistance) - { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.fogDistance").value = newFogDistance; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.fogDistance"); - } - - - @Override - public FogDrawMode getFogDrawMode() - { - return Config.Client.Graphics.FogQuality.fogDrawMode; - } - - @Override - public void setFogDrawMode(FogDrawMode setFogDrawMode) - { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.fogDrawMode").value = setFogDrawMode; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.fogDrawMode"); - } - - - @Override - public FogColorMode getFogColorMode() - { - return Config.Client.Graphics.FogQuality.fogColorMode; - } - - @Override - public void setFogColorMode(FogColorMode newFogColorMode) - { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.fogColorMode").value = newFogColorMode; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.fogColorMode"); - } - - - @Override - public boolean getDisableVanillaFog() - { - return Config.Client.Graphics.FogQuality.disableVanillaFog; - } - @Override - public void setDisableVanillaFog(boolean newDisableVanillaFog) - { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.disableVanillaFog").value = newDisableVanillaFog; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.disableVanillaFog"); - } - - @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; - } - @Override - public double getFarFogEnd() { - return Config.Client.Graphics.FogQuality.AdvancedFog.farFogEnd; - } - @Override - public double getFarFogMin() { - return Config.Client.Graphics.FogQuality.AdvancedFog.farFogMin; - } - @Override - public double getFarFogMax() { - return Config.Client.Graphics.FogQuality.AdvancedFog.farFogMax; - } - @Override - public FogSetting.FogType getFarFogType() { - return Config.Client.Graphics.FogQuality.AdvancedFog.farFogType; - } - @Override - public double getFarFogDensity() { - return Config.Client.Graphics.FogQuality.AdvancedFog.farFogDensity; - } - - @Override - public void setFarFogStart(double newFarFogStart) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.farFogStart").value = newFarFogStart; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.farFogStart"); - } - @Override - public void setFarFogEnd(double newFarFogEnd) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.farFogEnd").value = newFarFogEnd; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.farFogEnd"); - } - @Override - public void setFarFogMin(double newFarFogMin) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.farFogMin").value = newFarFogMin; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.farFogMin"); - } - @Override - public void setFarFogMax(double newFarFogMax) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.farFogMax").value = newFarFogMax; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.farFogMax"); - } - @Override - public void setFarFogType(FogSetting.FogType newFarFogType) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.farFogType").value = newFarFogType; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.farFogType"); - } - @Override - public void setFarFogDensity(double newFarFogDensity) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.farFogDensity").value = newFarFogDensity; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.farFogDensity"); - } - - @Override - public IHeightFog heightFog() { - return heightFog; - } - - public static class HeightFog implements IHeightFog { - - @Override - public HeightFogMixMode getHeightFogMixMode() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogMixMode; - } - @Override - public HeightFogMode getHeightFogMode() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogMode; - } - @Override - public double getHeightFogHeight() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogHeight; - } - @Override - public double getHeightFogStart() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogStart; - } - @Override - public double getHeightFogEnd() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogEnd; - } - @Override - public double getHeightFogMin() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogMin; - } - @Override - public double getHeightFogMax() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogMax; - } - @Override - public FogSetting.FogType getHeightFogType() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogType; - } - @Override - public double getHeightFogDensity() { - return Config.Client.Graphics.FogQuality.AdvancedFog.heightFog.heightFogDensity; - } - - @Override - public void setHeightFogMixMode(HeightFogMixMode newHeightFogMixMode) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogMixMode").value = newHeightFogMixMode; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogMixMode"); - } - @Override - public void setHeightFogMode(HeightFogMode newHeightFogMode) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogMode").value = newHeightFogMode; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogMode"); - } - @Override - public void setHeightFogHeight(double newHeightFogHeight) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogHeight").value = newHeightFogHeight; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogHeight"); - } - @Override - public void setHeightFogStart(double newHeightFogStart) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogStart").value = newHeightFogStart; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogStart"); - } - @Override - public void setHeightFogEnd(double newHeightFogEnd) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogEnd").value = newHeightFogEnd; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogEnd"); - } - @Override - public void setHeightFogMin(double newHeightFogMin) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogMin").value = newHeightFogMin; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogMin"); - } - @Override - public void setHeightFogMax(double newHeightFogMax) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogMax").value = newHeightFogMax; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogMax"); - } - @Override - public void setHeightFogType(FogSetting.FogType newHeightFogType) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogType").value = newHeightFogType; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogType"); - } - @Override - public void setHeightFogDensity(double newHeightFogDensity) { - ConfigGui.editSingleOption.getEntry("client.graphics.fogQuality.advancedFog.heightFog.heightFogDensity").value = newHeightFogDensity; - ConfigGui.editSingleOption.saveOption("client.graphics.fogQuality.advancedFog.heightFog.heightFogDensity"); - } - } - } - - } - - - public static class AdvancedGraphics implements IAdvancedGraphics - { - @Override - public boolean getDisableDirectionalCulling() - { - return Config.Client.Graphics.AdvancedGraphics.disableDirectionalCulling; - } - @Override - public void setDisableDirectionalCulling(boolean newDisableDirectionalCulling) - { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.disableDirectionalCulling").value = newDisableDirectionalCulling; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.disableDirectionalCulling"); - } - - - @Override - public VanillaOverdraw getVanillaOverdraw() - { - return Config.Client.Graphics.AdvancedGraphics.vanillaOverdraw; - } - @Override - public void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw) - { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.vanillaOverdraw").value = newVanillaOverdraw; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.vanillaOverdraw"); - } - - @Override - public int getOverdrawOffset() { - return Config.Client.Graphics.AdvancedGraphics.overdrawOffset; - } - - @Override - public void setOverdrawOffset(int newOverdrawOffset) { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.overdrawOffset").value = newOverdrawOffset; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.overdrawOffset"); - } - /* - @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() - { - return Config.Client.Graphics.AdvancedGraphics.useExtendedNearClipPlane; - } - @Override - public void setUseExtendedNearClipPlane(boolean newUseExtendedNearClipPlane) - { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.useExtendedNearClipPlane").value = newUseExtendedNearClipPlane; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.useExtendedNearClipPlane"); - } - - @Override - public double getBrightnessMultiplier() - { - return Config.Client.Graphics.AdvancedGraphics.brightnessMultiplier; - } - @Override - public void setBrightnessMultiplier(double newBrightnessMultiplier) - { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.brightnessMultiplier").value = newBrightnessMultiplier; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.brightnessMultiplier"); - } - - @Override - public double getSaturationMultiplier() - { - return Config.Client.Graphics.AdvancedGraphics.saturationMultiplier; - } - @Override - public void setSaturationMultiplier(double newSaturationMultiplier) - { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.saturationMultiplier").value = newSaturationMultiplier; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.saturationMultiplier"); - } - - @Override - public boolean getEnableCaveCulling() { - return Config.Client.Graphics.AdvancedGraphics.enableCaveCulling; - } - - @Override - public void setEnableCaveCulling(boolean newEnableCaveCulling) { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.enableCaveCulling").value = newEnableCaveCulling; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.enableCaveCulling"); - - } - - @Override - public int getCaveCullingHeight() { - return Config.Client.Graphics.AdvancedGraphics.caveCullingHeight; - } - - @Override - public void setCaveCullingHeight(int newCaveCullingHeight) { - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.caveCullingHeight").value = newCaveCullingHeight; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.caveCullingHeight"); - - } - - @Override - public int getEarthCurveRatio() - { - return (int) ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.earthCurveRatio").value; - } - @Override - public void setEarthCurveRatio(int newEarthCurveRatio) - { - if (newEarthCurveRatio < 50) newEarthCurveRatio = 0; - ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.earthCurveRatio").value = newEarthCurveRatio; - ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.earthCurveRatio"); - } - } - } - - - - - //========================// - // WorldGenerator Configs // - //========================// - public static class WorldGenerator implements IWorldGenerator - { - @Override - public GenerationPriority getGenerationPriority() - { - return Config.Client.WorldGenerator.generationPriority; - } - @Override - public void setGenerationPriority(GenerationPriority newGenerationPriority) - { - ConfigGui.editSingleOption.getEntry("client.worldGenerator.generationPriority").value = newGenerationPriority; - ConfigGui.editSingleOption.saveOption("client.worldGenerator.generationPriority"); - } - - - @Override - public DistanceGenerationMode getDistanceGenerationMode() - { - return Config.Client.WorldGenerator.distanceGenerationMode; - } - @Override - public void setDistanceGenerationMode(DistanceGenerationMode newDistanceGenerationMode) - { - ConfigGui.editSingleOption.getEntry("client.worldGenerator.distanceGenerationMode").value = newDistanceGenerationMode; - ConfigGui.editSingleOption.saveOption("client.worldGenerator.distanceGenerationMode"); - } - - /* - @Override - public boolean getAllowUnstableFeatureGeneration() - { - return Config.Client.WorldGenerator.allowUnstableFeatureGeneration; - } - @Override - public void setAllowUnstableFeatureGeneration(boolean newAllowUnstableFeatureGeneration) - { - ConfigGui.editSingleOption.getEntry("client.worldGenerator.allowUnstableFeatureGeneration").value = newAllowUnstableFeatureGeneration; - ConfigGui.editSingleOption.saveOption("client.worldGenerator.allowUnstableFeatureGeneration"); - }*/ - - - @Override - public BlocksToAvoid getBlocksToAvoid() - { - return Config.Client.WorldGenerator.blocksToAvoid; - } - @Override - public void setBlockToAvoid(BlocksToAvoid newBlockToAvoid) - { - ConfigGui.editSingleOption.getEntry("client.worldGenerator.blocksToAvoid").value = newBlockToAvoid; - ConfigGui.editSingleOption.saveOption("client.worldGenerator.blocksToAvoid"); - } - @Override - public boolean getEnableDistantGeneration() - { - return (boolean) ConfigGui.editSingleOption.getEntry("client.worldGenerator.enableDistantGeneration").value; - } - @Override - public void setEnableDistantGeneration(boolean newEnableDistantGeneration) - { - ConfigGui.editSingleOption.getEntry("client.worldGenerator.enableDistantGeneration").value = newEnableDistantGeneration; - ConfigGui.editSingleOption.saveOption("client.worldGenerator.enableDistantGeneration"); - } - @Override - public LightGenerationMode getLightGenerationMode() - { - return Config.Client.WorldGenerator.lightGenerationMode; - } - @Override - public void setLightGenerationMode(LightGenerationMode newLightGenerationMode) - { - ConfigGui.editSingleOption.getEntry("client.worldGenerator.lightGenerationMode").value = newLightGenerationMode; - ConfigGui.editSingleOption.saveOption("client.worldGenerator.lightGenerationMode"); - } - } - - - - //=====================// - // Multiplayer Configs // - //=====================// - public static class Multiplayer implements IMultiplayer - { - @Override - public ServerFolderNameMode getServerFolderNameMode() - { - return Config.Client.Multiplayer.serverFolderNameMode; - } - @Override - public void setServerFolderNameMode(ServerFolderNameMode newServerFolderNameMode) - { - ConfigGui.editSingleOption.getEntry("client.multiplayer.serverFolderNameMode").value = newServerFolderNameMode; - ConfigGui.editSingleOption.saveOption("client.multiplayer.serverFolderNameMode"); - } - - @Override - public double getMultiDimensionRequiredSimilarity() - { - return Config.Client.Multiplayer.multiDimensionRequiredSimilarity; - } - - @Override - public void setMultiDimensionRequiredSimilarity(double newMultiDimensionMinimumSimilarityPercent) - { - ConfigGui.editSingleOption.getEntry("client.multiplayer.multiDimensionMinimumSimilarityPercent").value = newMultiDimensionMinimumSimilarityPercent; - ConfigGui.editSingleOption.saveOption("client.multiplayer.multiDimensionMinimumSimilarityPercent"); - } - } - - - - //============================// - // AdvancedModOptions Configs // - //============================// - public static class Advanced implements IAdvanced - { - public final IThreading threading; - public final IDebugging debugging; - public final IBuffers buffers; - - - @Override - public IThreading threading() - { - return threading; - } - - - @Override - public IDebugging debugging() - { - return debugging; - } - - - @Override - public IBuffers buffers() - { - return buffers; - } - - - public Advanced() - { - threading = new Threading(); - debugging = new Debugging(); - buffers = new Buffers(); - } - - public static class Threading implements IThreading - { - @Override - public double getNumberOfWorldGenerationThreads() - { - return Config.Client.Advanced.Threading.numberOfWorldGenerationThreads; - } - @Override - public void setNumberOfWorldGenerationThreads(double newNumberOfWorldGenerationThreads) - { - ConfigGui.editSingleOption.getEntry("client.advanced.threading.numberOfWorldGenerationThreads").value = newNumberOfWorldGenerationThreads; - ConfigGui.editSingleOption.saveOption("client.advanced.threading.numberOfWorldGenerationThreads"); - } - - - @Override - public int getNumberOfBufferBuilderThreads() - { - return Config.Client.Advanced.Threading.numberOfBufferBuilderThreads; - } - @Override - public void setNumberOfBufferBuilderThreads(int newNumberOfWorldBuilderThreads) - { - ConfigGui.editSingleOption.getEntry("client.advanced.threading.numberOfBufferBuilderThreads").value = newNumberOfWorldBuilderThreads; - ConfigGui.editSingleOption.saveOption("client.advanced.threading.numberOfBufferBuilderThreads"); - } - } - - - - - //===============// - // Debug Options // - //===============// - public static class Debugging implements IDebugging - { - public final IDebugSwitch debugSwitch; - - @Override - public IDebugSwitch debugSwitch() - { - return debugSwitch; - } - - /* RendererType: - * DEFAULT - * DEBUG - * DISABLED - * */ - @Override - public RendererType getRendererType() { - return (RendererType) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.rendererType").value; - } - @Override - public void setRendererType(RendererType newRenderType) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.rendererType").value = newRenderType; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.rendererType"); - } - - @Override - public DebugMode getDebugMode() - { - return (DebugMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugMode").value; - } - @Override - public void setDebugMode(DebugMode newDebugMode) - { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugMode").value = newDebugMode; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugMode"); - } - - - @Override - public boolean getDebugKeybindingsEnabled() - { - return (boolean) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.enableDebugKeybindings").value; - } - @Override - public void setDebugKeybindingsEnabled(boolean newEnableDebugKeybindings) - { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.enableDebugKeybindings").value = newEnableDebugKeybindings; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.enableDebugKeybindings"); - } - - 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 (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenEvent").value; - } - @Override - public void setLogWorldGenEvent(LoggerMode newLogWorldGenEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenEvent").value = newLogWorldGenEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logWorldGenEvent"); - } - - @Override - public LoggerMode getLogWorldGenPerformance() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenPerformance").value; - } - @Override - public void setLogWorldGenPerformance(LoggerMode newLogWorldGenPerformance) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenPerformance").value = newLogWorldGenPerformance; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logWorldGenPerformance"); - } - - @Override - public LoggerMode getLogWorldGenLoadEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenLoadEvent").value; - } - @Override - public void setLogWorldGenLoadEvent(LoggerMode newLogWorldGenLoadEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenLoadEvent").value = newLogWorldGenLoadEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logWorldGenLoadEvent"); - } - - @Override - public LoggerMode getLogLodBuilderEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logLodBuilderEvent").value; - } - @Override - public void setLogLodBuilderEvent(LoggerMode newLogLodBuilderEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logLodBuilderEvent").value = newLogLodBuilderEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logLodBuilderEvent"); - } - - @Override - public LoggerMode getLogRendererBufferEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererBufferEvent").value; - } - @Override - public void setLogRendererBufferEvent(LoggerMode newLogRendererBufferEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererBufferEvent").value = newLogRendererBufferEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logRendererBufferEvent"); - } - - @Override - public LoggerMode getLogRendererGLEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererGLEvent").value; - } - @Override - public void setLogRendererGLEvent(LoggerMode newLogRendererGLEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererGLEvent").value = newLogRendererGLEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logRendererGLEvent"); - } - - @Override - public LoggerMode getLogFileReadWriteEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileReadWriteEvent").value; - } - @Override - public void setLogFileReadWriteEvent(LoggerMode newLogFileReadWriteEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileReadWriteEvent").value = newLogFileReadWriteEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logFileReadWriteEvent"); - } - - @Override - public LoggerMode getLogFileSubDimEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileSubDimEvent").value; - } - @Override - public void setLogFileSubDimEvent(LoggerMode newLogFileSubDimEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileSubDimEvent").value = newLogFileSubDimEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logFileSubDimEvent"); - } - - @Override - public LoggerMode getLogNetworkEvent() { - return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logNetworkEvent").value; - } - @Override - public void setLogNetworkEvent(LoggerMode newLogNetworkEvent) { - ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logNetworkEvent").value = newLogNetworkEvent; - ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logNetworkEvent"); - } - } - } - - - public static class Buffers implements IBuffers - { - - @Override - public GpuUploadMethod getGpuUploadMethod() - { - return Config.Client.Advanced.Buffers.gpuUploadMethod; - } - @Override - public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog) - { - ConfigGui.editSingleOption.getEntry("client.advanced.buffers.gpuUploadMethod").value = newDisableVanillaFog; - ConfigGui.editSingleOption.saveOption("client.advanced.buffers.gpuUploadMethod"); - } - - - @Override - public int getGpuUploadPerMegabyteInMilliseconds() - { - return Config.Client.Advanced.Buffers.gpuUploadPerMegabyteInMilliseconds; - } - @Override - public void setGpuUploadPerMegabyteInMilliseconds(int newMilliseconds) { - ConfigGui.editSingleOption.getEntry("client.advanced.buffers.gpuUploadPerMegabyteInMilliseconds").value = newMilliseconds; - ConfigGui.editSingleOption.saveOption("client.advanced.buffers.gpuUploadPerMegabyteInMilliseconds"); - } - - - @Override - public BufferRebuildTimes getRebuildTimes() - { - return Config.Client.Advanced.Buffers.rebuildTimes; - } - @Override - public void setRebuildTimes(BufferRebuildTimes newBufferRebuildTimes) - { - ConfigGui.editSingleOption.getEntry("client.advanced.buffers.newBufferRebuildTimes").value = newBufferRebuildTimes; - ConfigGui.editSingleOption.saveOption("client.advanced.buffers.newBufferRebuildTimes"); - } - } - - @Override - public boolean getLodOnlyMode() { - return Config.Client.Advanced.lodOnlyMode; - } - - @Override - public void setLodOnlyMode(boolean newLodOnlyMode) { - ConfigGui.editSingleOption.getEntry("client.advanced.buffers.lodOnlyMode").value = newLodOnlyMode; - ConfigGui.editSingleOption.saveOption("client.advanced.buffers.lodOnlyMode"); - - } - } - } -} diff --git a/core b/core index 7ee05282d..431072164 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 7ee05282dd74771b0c3054fb8ebbc4cff4c6456d +Subproject commit 43107216405b8bd8ac9902fc718fb2ad98515ddb diff --git a/fabric/build.gradle b/fabric/build.gradle index 015ba6746..6d7dbe70f 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -83,8 +83,9 @@ dependencies { - // Toml + // Toml & Json for config shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {} + shadowMe("com.googlecode.json-simple:json-simple:1.1.1") {} common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowMe(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } @@ -116,10 +117,14 @@ runClient { shadowJar { configurations = [project.configurations.shadowMe] + // Compression relocate 'org.tukaani', 'shaded.tukaani' relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress' + // Toml & Json for config relocate 'com.electronwill.nightconfig', 'shaded.electronwill.nightconfig' + relocate 'com.googlecode.json-simple', 'shaded.googlecode.json-simple' + // Our own code relocate 'com.seibel.lod.common', 'fabric.com.seibel.lod.common' classifier "dev-shadow" diff --git a/fabric/src/main/java/com/seibel/lod/fabric/Main.java b/fabric/src/main/java/com/seibel/lod/fabric/Main.java index e49fb52de..32a0b9dd0 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/Main.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/Main.java @@ -68,10 +68,10 @@ public class Main implements ClientModInitializer // This loads the mod after minecraft loads which doesn't causes a lot of issues public static void init() { - LodCommonMain.initConfig(); LodCommonMain.startup(null, false, new NetworkHandler()); FabricDependencySetup.createInitialBindings(); FabricDependencySetup.finishBinding(); + LodCommonMain.initConfig(); LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); // Check if this works @@ -91,10 +91,10 @@ public class Main implements ClientModInitializer } public static void initServer() { - LodCommonMain.initConfig(); LodCommonMain.startup(null, true, new NetworkHandler()); FabricDependencySetup.createInitialBindings(); FabricDependencySetup.finishBinding(); + LodCommonMain.initConfig(); LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION); } } diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinOptionsScreen.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinOptionsScreen.java index 294149895..d2b3b9d3f 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinOptionsScreen.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinOptionsScreen.java @@ -19,7 +19,7 @@ package com.seibel.lod.fabric.mixins; -import com.seibel.lod.common.wrappers.config.ConfigGui; +import com.seibel.lod.common.wrappers.config.GetConfigScreen; import com.seibel.lod.common.wrappers.config.TexturedButtonWidget; import com.seibel.lod.core.ModInfo; import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; @@ -65,7 +65,7 @@ public class MixinOptionsScreen extends Screen { 20, ICON_TEXTURE, 20, 40, // Create the button and tell it where to go // For now it goes to the client option by default - (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")), + (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the screen new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title"))); } diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java index 53b0db64a..aa750fe14 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java @@ -21,8 +21,8 @@ package com.seibel.lod.fabric.mixins; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; -import com.seibel.lod.common.Config; import com.seibel.lod.common.wrappers.McObjectConverter; +import com.seibel.lod.core.Config; import com.seibel.lod.core.api.internal.ClientApi; import com.seibel.lod.core.objects.math.Mat4f; import net.minecraft.client.renderer.LevelRenderer; @@ -84,7 +84,7 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } - if (Config.Client.Advanced.lodOnlyMode) { + if (Config.Client.Advanced.lodOnlyMode.get()) { callback.cancel(); } } @@ -109,7 +109,7 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } - if (Config.Client.Advanced.lodOnlyMode) { + if (Config.Client.Advanced.lodOnlyMode.get()) { callback.cancel(); } } diff --git a/fabric/src/main/java/com/seibel/lod/fabric/wrappers/FabricDependencySetup.java b/fabric/src/main/java/com/seibel/lod/fabric/wrappers/FabricDependencySetup.java index c64b0d1f6..d99f8a6c5 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/wrappers/FabricDependencySetup.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/wrappers/FabricDependencySetup.java @@ -21,7 +21,7 @@ package com.seibel.lod.fabric.wrappers; import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; -import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton; +import com.seibel.lod.core.wrapperInterfaces.config.LodConfigWrapperSingleton; import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker; import com.seibel.lod.fabric.wrappers.modAccessor.ModChecker; diff --git a/fabric/src/main/java/com/seibel/lod/fabric/wrappers/config/ModMenuIntegration.java b/fabric/src/main/java/com/seibel/lod/fabric/wrappers/config/ModMenuIntegration.java index e7cd0a347..f49468601 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/wrappers/config/ModMenuIntegration.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/wrappers/config/ModMenuIntegration.java @@ -19,7 +19,8 @@ package com.seibel.lod.fabric.wrappers.config; -import com.seibel.lod.common.wrappers.config.ConfigGui; +import com.seibel.lod.common.wrappers.config.ConfigScreenMC; +import com.seibel.lod.common.wrappers.config.GetConfigScreen; import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; import net.fabricmc.api.EnvType; @@ -33,6 +34,6 @@ public class ModMenuIntegration implements ModMenuApi { // For the custom config code @Override public ConfigScreenFactory getModConfigScreenFactory() { - return parent -> ConfigGui.getScreen(parent, ""); + return parent -> GetConfigScreen.getScreen(parent); } } diff --git a/forge/build.gradle b/forge/build.gradle index 8f023fda4..745f7e7ac 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -46,8 +46,9 @@ dependencies { // forgeDependencies(project(":core")) { transitive false } - // Toml + // Toml & Json for config shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {} + shadowMe("com.googlecode.json-simple:json-simple:1.1.1") {} // Compression forgeDependencies('org.tukaani:xz:1.9') @@ -63,15 +64,20 @@ processResources { } shadowJar { + // Remove the fabric stuff from forge dependencies { exclude(dependency("net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}")) } exclude "fabric.mod.json" configurations = [project.configurations.shadowMe] + // Compression relocate 'org.tukaani', 'shaded.tukaani' relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress' - relocate 'com.electronwill.nightconfig', 'shaded.electronwill.nightconfig' // This is already included with forge + // Toml & Json for config + relocate 'com.electronwill.nightconfig', 'shaded.electronwill.nightconfig' + relocate 'com.googlecode.json-simple', 'shaded.googlecode.json-simple' + // Our own code relocate 'com.seibel.lod.common', 'forge.com.seibel.lod.common' classifier "dev-shadow" diff --git a/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java b/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java index f6ab7c715..941d4934e 100644 --- a/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java +++ b/forge/src/main/java/com/seibel/lod/forge/ForgeMain.java @@ -21,7 +21,7 @@ package com.seibel.lod.forge; import com.seibel.lod.common.LodCommonMain; import com.seibel.lod.common.forge.LodForgeMethodCaller; -import com.seibel.lod.common.wrappers.config.ConfigGui; +import com.seibel.lod.common.wrappers.config.GetConfigScreen; import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper; import com.seibel.lod.core.ModInfo; import com.seibel.lod.core.api.internal.InternalApiShared; @@ -81,10 +81,10 @@ public class ForgeMain implements LodForgeMethodCaller private void init(final FMLCommonSetupEvent event) { // make sure the dependencies are set up before the mod needs them - LodCommonMain.initConfig(); LodCommonMain.startup(this, !FMLLoader.getDist().isClient(), new NetworkHandler()); ForgeDependencySetup.createInitialBindings(); ForgeDependencySetup.finishBinding(); + LodCommonMain.initConfig(); LOGGER.info("Distant Horizons initializing..."); } @@ -105,10 +105,10 @@ public class ForgeMain implements LodForgeMethodCaller #if PRE_MC_1_17_1 ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, - () -> (client, parent) -> ConfigGui.getScreen(parent, "")); + () -> (client, parent) -> GetConfigScreen.getScreen(parent)); #else ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class, - () -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> ConfigGui.getScreen(parent, ""))); + () -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> GetConfigScreen.getScreen(parent))); #endif forgeClientProxy = new ForgeClientProxy(); MinecraftForge.EVENT_BUS.register(forgeClientProxy); diff --git a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinOptionsScreen.java b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinOptionsScreen.java index 756da0c76..dfc4df6bd 100644 --- a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinOptionsScreen.java +++ b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinOptionsScreen.java @@ -19,7 +19,7 @@ package com.seibel.lod.forge.mixins; -import com.seibel.lod.common.wrappers.config.ConfigGui; +import com.seibel.lod.common.wrappers.config.GetConfigScreen; import com.seibel.lod.common.wrappers.config.TexturedButtonWidget; import com.seibel.lod.core.ModInfo; import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; @@ -65,7 +65,7 @@ public class MixinOptionsScreen extends Screen { 20, ICON_TEXTURE, 20, 40, // Create the button and tell it where to go // For now it goes to the client option by default - (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")), + (buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(GetConfigScreen.getScreen(this)), // Add a title to the screen new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title"))); } diff --git a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java index f0b159431..3da44186f 100644 --- a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java +++ b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java @@ -21,8 +21,8 @@ package com.seibel.lod.forge.mixins; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; -import com.seibel.lod.common.Config; import com.seibel.lod.common.wrappers.McObjectConverter; +import com.seibel.lod.core.Config; import com.seibel.lod.core.api.internal.ClientApi; import com.seibel.lod.core.objects.math.Mat4f; import net.minecraft.client.renderer.LevelRenderer; @@ -81,7 +81,7 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } - if (Config.Client.Advanced.lodOnlyMode) { + if (Config.Client.Advanced.lodOnlyMode.get()) { callback.cancel(); } } @@ -106,7 +106,7 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } - if (Config.Client.Advanced.lodOnlyMode) { + if (Config.Client.Advanced.lodOnlyMode.get()) { callback.cancel(); } } diff --git a/forge/src/main/java/com/seibel/lod/forge/wrappers/ForgeDependencySetup.java b/forge/src/main/java/com/seibel/lod/forge/wrappers/ForgeDependencySetup.java index 2af9b09dc..7ca3b01d7 100644 --- a/forge/src/main/java/com/seibel/lod/forge/wrappers/ForgeDependencySetup.java +++ b/forge/src/main/java/com/seibel/lod/forge/wrappers/ForgeDependencySetup.java @@ -20,9 +20,9 @@ package com.seibel.lod.forge.wrappers; import com.seibel.lod.common.LodCommonMain; -import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton; import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; +import com.seibel.lod.core.wrapperInterfaces.config.LodConfigWrapperSingleton; import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker; import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;