Removed the need for any config category. The config now guesses the category
This commit is contained in:
@@ -20,12 +20,14 @@
|
||||
package com.seibel.lod.common;
|
||||
|
||||
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
||||
import com.seibel.lod.common.wrappers.world.DimensionTypeWrapper;
|
||||
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.IClient.IAdvanced.*;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.*;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator;
|
||||
import net.minecraft.client.renderer.DimensionSpecialEffects;
|
||||
|
||||
/**
|
||||
* This handles any configuration the user has access to.
|
||||
@@ -60,53 +62,42 @@ public class Config extends ConfigGui
|
||||
|
||||
public static class Client
|
||||
{
|
||||
@ConfigAnnotations.Category("client")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static Graphics graphics;
|
||||
|
||||
@ConfigAnnotations.Category("client")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static WorldGenerator worldGenerator;
|
||||
|
||||
@ConfigAnnotations.Category("client")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static Advanced advanced;
|
||||
|
||||
|
||||
public static class Graphics
|
||||
{
|
||||
@ConfigAnnotations.Category("client.graphics")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static Quality quality;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static FogQuality fogQuality;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static CloudQuality cloudQuality;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static AdvancedGraphics advancedGraphics;
|
||||
|
||||
|
||||
public static class Quality
|
||||
{
|
||||
@ConfigAnnotations.Category("client.graphics.quality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static HorizontalResolution drawResolution = IQuality.DRAW_RESOLUTION_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.quality")
|
||||
@ConfigAnnotations.Entry(minValue = 16, maxValue = 1024)
|
||||
public static int lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.defaultValue;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.quality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static VerticalQuality verticalQuality = IQuality.VERTICAL_QUALITY_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.quality")
|
||||
@ConfigAnnotations.Entry(minValue = 2, maxValue = 32)
|
||||
public static int horizontalScale = IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.defaultValue;
|
||||
|
||||
@@ -118,19 +109,15 @@ public class Config extends ConfigGui
|
||||
|
||||
public static class FogQuality
|
||||
{
|
||||
@ConfigAnnotations.Category("client.graphics.fogQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static FogDistance fogDistance = IFogQuality.FOG_DISTANCE_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.fogQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static FogDrawMode fogDrawMode = IFogQuality.FOG_DRAW_MODE_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.fogQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static FogColorMode fogColorMode = IFogQuality.FOG_COLOR_MODE_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.fogQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean disableVanillaFog = IFogQuality.DISABLE_VANILLA_FOG_DEFAULT;
|
||||
}
|
||||
@@ -138,45 +125,34 @@ public class Config extends ConfigGui
|
||||
|
||||
public static class CloudQuality
|
||||
{
|
||||
@ConfigAnnotations.Category("client.graphics.cloudQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
// public static boolean customClouds = ICloudQuality.CUSTOM_CLOUDS_DEFAULT;
|
||||
public static boolean customClouds = false;
|
||||
public static boolean customClouds = ICloudQuality.CUSTOM_CLOUDS_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.cloudQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean fabulousClouds = ICloudQuality.FABULOUS_CLOUDS_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.cloudQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean extendClouds = ICloudQuality.EXTEND_CLOUDS_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.cloudQuality")
|
||||
@ConfigAnnotations.Entry
|
||||
public static double cloudHeight = 128;
|
||||
public static double cloudHeight = DimensionSpecialEffects.OverworldEffects.CLOUD_LEVEL;
|
||||
}
|
||||
|
||||
|
||||
public static class AdvancedGraphics
|
||||
{
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.advancedGraphics")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean disableDirectionalCulling = IAdvancedGraphics.DISABLE_DIRECTIONAL_CULLING_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.advancedGraphics")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean alwaysDrawAtMaxQuality = IAdvancedGraphics.ALWAYS_DRAW_AT_MAD_QUALITY_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.advancedGraphics")
|
||||
@ConfigAnnotations.Entry
|
||||
public static VanillaOverdraw vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.advancedGraphics")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean useExtendedNearClipPlane = IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.graphics.advancedGraphics")
|
||||
@ConfigAnnotations.Entry(minValue = 0, maxValue = 512)
|
||||
public static int backsideCullingRange = IAdvancedGraphics.VANILLA_CULLING_RANGE_MIN_DEFAULT_MAX.defaultValue;
|
||||
}
|
||||
@@ -185,45 +161,37 @@ public class Config extends ConfigGui
|
||||
|
||||
public static class WorldGenerator
|
||||
{
|
||||
@ConfigAnnotations.Category("client.worldGenerator")
|
||||
@ConfigAnnotations.Entry
|
||||
public static GenerationPriority generationPriority = IWorldGenerator.GENERATION_PRIORITY_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.worldGenerator")
|
||||
@ConfigAnnotations.Entry
|
||||
public static DistanceGenerationMode distanceGenerationMode = IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.worldGenerator")
|
||||
// FIXME: Temperary override. In 1.18, the newer Unstable gnerator is more usable
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean allowUnstableFeatureGeneration = IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT;
|
||||
public static boolean allowUnstableFeatureGeneration = true;//IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.worldGenerator")
|
||||
@ConfigAnnotations.Entry
|
||||
public static BlocksToAvoid blocksToAvoid = IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT;
|
||||
}
|
||||
|
||||
public static class Advanced
|
||||
{
|
||||
@ConfigAnnotations.Category("client.advanced")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static Threading threading;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static Debugging debugging;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced")
|
||||
@ConfigAnnotations.ScreenEntry
|
||||
public static Buffers buffers;
|
||||
|
||||
|
||||
public static class Threading
|
||||
{
|
||||
@ConfigAnnotations.Category("client.advanced.threading")
|
||||
@ConfigAnnotations.Entry(minValue = 1, maxValue = 50)
|
||||
public static int numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.defaultValue;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced.threading")
|
||||
@ConfigAnnotations.Entry(minValue = 1, maxValue = 50)
|
||||
public static int numberOfBufferBuilderThreads = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_MIN_DEFAULT_MAX.defaultValue;
|
||||
}
|
||||
@@ -231,15 +199,12 @@ public class Config extends ConfigGui
|
||||
|
||||
public static class Debugging
|
||||
{
|
||||
@ConfigAnnotations.Category("client.advanced.debugging")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean drawLods = IDebugging.DRAW_LODS_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced.debugging")
|
||||
@ConfigAnnotations.Entry
|
||||
public static DebugMode debugMode = IDebugging.DEBUG_MODE_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced.debugging")
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT;
|
||||
}
|
||||
@@ -247,15 +212,12 @@ public class Config extends ConfigGui
|
||||
|
||||
public static class Buffers
|
||||
{
|
||||
@ConfigAnnotations.Category("client.advanced.buffers")
|
||||
@ConfigAnnotations.Entry
|
||||
public static GpuUploadMethod gpuUploadMethod = IBuffers.GPU_UPLOAD_METHOD_DEFAULT;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced.buffers")
|
||||
@ConfigAnnotations.Entry(minValue = 0, maxValue = 5000)
|
||||
public static int gpuUploadPerMegabyteInMilliseconds = IBuffers.GPU_UPLOAD_PER_MEGABYTE_IN_MILLISECONDS_DEFAULT.defaultValue;
|
||||
|
||||
@ConfigAnnotations.Category("client.advanced.buffers")
|
||||
@ConfigAnnotations.Entry
|
||||
public static BufferRebuildTimes rebuildTimes = IBuffers.REBUILD_TIMES_DEFAULT;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public abstract class ConfigGui
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
configFilePath = mc.gameDirectory.toPath().resolve("config").resolve(MOD_NAME + ".toml");
|
||||
|
||||
initNestedClass(config);
|
||||
initNestedClass(config, "");
|
||||
|
||||
for (EntryInfo info : entries) {
|
||||
if (info.field.isAnnotationPresent(ConfigAnnotations.Entry.class)) {
|
||||
@@ -154,7 +154,7 @@ public abstract class ConfigGui
|
||||
loadFromFile();
|
||||
}
|
||||
|
||||
private static void initNestedClass(Class<?> config)
|
||||
private static void initNestedClass(Class<?> config, String category)
|
||||
{
|
||||
for (Field field : config.getFields())
|
||||
{
|
||||
@@ -162,8 +162,9 @@ public abstract class ConfigGui
|
||||
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);
|
||||
initClient(field, info, category);
|
||||
}
|
||||
|
||||
if (field.isAnnotationPresent(ConfigAnnotations.Entry.class))
|
||||
@@ -177,7 +178,7 @@ public abstract class ConfigGui
|
||||
}
|
||||
|
||||
if (field.isAnnotationPresent(ConfigAnnotations.ScreenEntry.class))
|
||||
initNestedClass(field.getType());
|
||||
initNestedClass(field.getType(), (!category.isEmpty() ? category + "." : "") + field.getName());
|
||||
|
||||
|
||||
info.field = field;
|
||||
@@ -185,10 +186,9 @@ public abstract class ConfigGui
|
||||
}
|
||||
|
||||
/** This adds the buttons to the queue to be rendered */
|
||||
private static void initClient(Field field, EntryInfo info)
|
||||
private static void initClient(Field field, EntryInfo info, String category)
|
||||
{
|
||||
Class<?> fieldClass = field.getType();
|
||||
ConfigAnnotations.Category category = field.getAnnotation(ConfigAnnotations.Category.class);
|
||||
ConfigAnnotations.Entry entry = field.getAnnotation(ConfigAnnotations.Entry.class);
|
||||
ConfigAnnotations.ScreenEntry screenEntry = field.getAnnotation(ConfigAnnotations.ScreenEntry.class);
|
||||
|
||||
@@ -197,9 +197,6 @@ public abstract class ConfigGui
|
||||
else if (screenEntry != null)
|
||||
info.width = screenEntry.width();
|
||||
|
||||
info.category = category != null ? category.value() : "";
|
||||
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
if (!entry.name().equals(""))
|
||||
@@ -413,6 +410,8 @@ public abstract class ConfigGui
|
||||
if (!reload)
|
||||
loadFromFile();
|
||||
|
||||
// addRenderableWidget in 1.17 and over
|
||||
// addButton in 1.16 and below
|
||||
this.addButton(new Button(this.width / 2 - 154, this.height - 28, 150, 20, CommonComponents.GUI_CANCEL, button -> {
|
||||
loadFromFile();
|
||||
Objects.requireNonNull(minecraft).setScreen(parent);
|
||||
|
||||
Reference in New Issue
Block a user