From 10b0cf9d8c61a2484bafd53d61b246bc130f3235 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 10 Jun 2023 09:12:05 -0500 Subject: [PATCH] Prefix "E" to a couple config enums --- .../com/seibel/lod/core/config/Config.java | 30 +++++++++---------- .../core/config/types/AbstractConfigType.java | 14 ++++----- .../lod/core/config/types/ConfigCategory.java | 6 ++-- .../lod/core/config/types/ConfigEntry.java | 10 +++---- .../core/config/types/ConfigLinkedEntry.java | 8 ++--- .../core/config/types/ConfigUIComment.java | 8 ++--- ...rance.java => EConfigEntryAppearance.java} | 8 +++-- ...ance.java => EConfigEntryPerformance.java} | 5 ++-- 8 files changed, 46 insertions(+), 43 deletions(-) rename core/src/main/java/com/seibel/lod/core/config/types/enums/{ConfigEntryAppearance.java => EConfigEntryAppearance.java} (80%) rename core/src/main/java/com/seibel/lod/core/config/types/enums/{ConfigEntryPerformance.java => EConfigEntryPerformance.java} (85%) diff --git a/core/src/main/java/com/seibel/lod/core/config/Config.java b/core/src/main/java/com/seibel/lod/core/config/Config.java index 44600b2e6..c91ebfb6b 100644 --- a/core/src/main/java/com/seibel/lod/core/config/Config.java +++ b/core/src/main/java/com/seibel/lod/core/config/Config.java @@ -72,7 +72,7 @@ public class Config .comment("" + "If true, Distant Horizons will render LODs beyond the vanilla render distance." + "") - .setAppearance(ConfigEntryAppearance.ONLY_IN_GUI) // TODO set when the game boots + .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) // TODO set when the game boots //.addListener(null) // TODO add listener .build(); @@ -86,7 +86,7 @@ public class Config + "\n" + "Higher settings will improve the graphical quality while increasing GPU and memory use.\n" + "") - .setAppearance(ConfigEntryAppearance.ONLY_IN_GUI) // TODO set when the game boots + .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) // TODO set when the game boots //.addListener(null) // TODO add listener .build(); @@ -99,7 +99,7 @@ public class Config + "Higher options will improve LOD generation and loading speed, \n" + "but will increase CPU load and may introduce stuttering.\n" + "") - .setAppearance(ConfigEntryAppearance.ONLY_IN_GUI) // TODO set when the game boots + .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) // TODO set when the game boots //.addListener(null) // TODO add listener .build(); @@ -154,13 +154,13 @@ public class Config + "Lowest Quality: " + EHorizontalResolution.CHUNK + "\n" + "Highest Quality: " + EHorizontalResolution.BLOCK) .addListener(RenderCacheConfigEventHandler.INSTANCE) - .setPerformance(ConfigEntryPerformance.MEDIUM) + .setPerformance(EConfigEntryPerformance.MEDIUM) .build(); public static ConfigEntry lodChunkRenderDistance = new ConfigEntry.Builder() .setMinDefaultMax(32, 128, 4096) .comment("The radius of the mod's render distance. (measured in chunks)") - .setPerformance(ConfigEntryPerformance.HIGH) + .setPerformance(EConfigEntryPerformance.HIGH) .build(); public static ConfigEntry verticalQuality = new ConfigEntry.Builder() @@ -173,7 +173,7 @@ public class Config + "\n" + "Lowest Quality: " + EVerticalQuality.HEIGHT_MAP + "\n" + "Highest Quality: " + EVerticalQuality.ULTRA) - .setPerformance(ConfigEntryPerformance.VERY_HIGH) + .setPerformance(EConfigEntryPerformance.VERY_HIGH) .addListener(RenderCacheConfigEventHandler.INSTANCE) .build(); @@ -192,7 +192,7 @@ public class Config + "This indicates how quickly LODs decrease in quality the further away they are. \n" + "Higher settings will render higher quality fake chunks farther away, \n" + "but will increase memory and GPU usage.") - .setPerformance(ConfigEntryPerformance.MEDIUM) + .setPerformance(EConfigEntryPerformance.MEDIUM) .build(); public static ConfigEntry transparency = new ConfigEntry.Builder() @@ -204,7 +204,7 @@ public class Config + ETransparency.FAKE + ": LODs will be opaque, but shaded to match the blocks underneath. \n" + ETransparency.DISABLED + ": LODs will be opaque. \n" + "") - .setPerformance(ConfigEntryPerformance.MEDIUM) + .setPerformance(EConfigEntryPerformance.MEDIUM) .build(); // TODO fixme @@ -227,7 +227,7 @@ public class Config public static ConfigEntry fogDistance = new ConfigEntry.Builder() .set(EFogDistance.FAR) .comment("At what distance should Fog be drawn on the LODs?") - .setPerformance(ConfigEntryPerformance.NONE) + .setPerformance(EConfigEntryPerformance.NONE) .build(); public static ConfigEntry fogDrawMode = new ConfigEntry.Builder() @@ -241,7 +241,7 @@ public class Config + EFogDrawMode.FOG_DISABLED + ": Always draw fast fog on the LODs \n" + "\n" + "Disabling fog will improve GPU performance.") - .setPerformance(ConfigEntryPerformance.VERY_LOW) + .setPerformance(EConfigEntryPerformance.VERY_LOW) .build(); public static ConfigEntry fogColorMode = new ConfigEntry.Builder() @@ -251,7 +251,7 @@ public class Config + "\n" + EFogColorMode.USE_WORLD_FOG_COLOR + ": Use the world's fog color. \n" + EFogColorMode.USE_SKY_COLOR + ": Use the sky's color.") - .setPerformance(ConfigEntryPerformance.NONE) + .setPerformance(EConfigEntryPerformance.NONE) .build(); public static ConfigEntry disableVanillaFog = new ConfigEntry.Builder() @@ -483,7 +483,7 @@ public class Config .comment("" + "Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n" + " especially when in/near an ocean.") - .setPerformance(ConfigEntryPerformance.NONE) + .setPerformance(EConfigEntryPerformance.NONE) .build(); public static ConfigEntry brightnessMultiplier = new ConfigEntry.Builder() // TODO: Make this a float (the ClassicConfigGUI doesnt support floats) @@ -648,7 +648,7 @@ public class Config + EGenerationPriority.AUTO + " \n" + "Uses " + EGenerationPriority.BALANCED + " when on a single player world \n" + " and " + EGenerationPriority.NEAR_FIRST + " when connected to a server.") - .setPerformance(ConfigEntryPerformance.NONE) + .setPerformance(EConfigEntryPerformance.NONE) .build(); // TODO fixme @@ -664,7 +664,7 @@ public class Config + EBlocksToAvoid.NON_FULL + ": Only use full blocks when generating fake chunks (ignores slabs, lanterns, torches, tall grass, etc.) \n" + EBlocksToAvoid.NO_COLLISION + ": Only use solid blocks when generating fake chunks (ignores tall grass, torches, etc.) \n" + EBlocksToAvoid.BOTH + ": Only use full solid blocks when generating fake chunks") - .setPerformance(ConfigEntryPerformance.NONE) + .setPerformance(EConfigEntryPerformance.NONE) .build(); // TODO fixme @@ -1064,7 +1064,7 @@ public class Config public static ConfigEntry resetAllSettings = new ConfigEntry.Builder() .set(false) - .setAppearance(ConfigEntryAppearance.ONLY_IN_GUI) + .setAppearance(EConfigEntryAppearance.ONLY_IN_GUI) //.addListener(null) // TODO add listener .build(); diff --git a/core/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java b/core/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java index 43ebe4253..e6b866f78 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.config.types; import com.seibel.lod.core.config.ConfigBase; -import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; +import com.seibel.lod.core.config.types.enums.EConfigEntryAppearance; /** * The class where all config options should extend @@ -16,9 +16,9 @@ public abstract class AbstractConfigType { // The S is the class that is e public Object guiValue; // This is a storage variable something like the gui can use - protected ConfigEntryAppearance appearance; + protected EConfigEntryAppearance appearance; - protected AbstractConfigType(ConfigEntryAppearance appearance, T value) { + protected AbstractConfigType(EConfigEntryAppearance appearance, T value) { this.appearance = appearance; this.value = value; } @@ -33,10 +33,10 @@ public abstract class AbstractConfigType { // The S is the class that is e this.value = newValue; } - public ConfigEntryAppearance getAppearance() { + public EConfigEntryAppearance getAppearance() { return appearance; } - public void setAppearance(ConfigEntryAppearance newAppearance) { + public void setAppearance(EConfigEntryAppearance newAppearance) { this.appearance = newAppearance; } @@ -58,12 +58,12 @@ public abstract class AbstractConfigType { // The S is the class that is e } protected static abstract class Builder { - protected ConfigEntryAppearance tmpAppearance = ConfigEntryAppearance.ALL; + protected EConfigEntryAppearance tmpAppearance = EConfigEntryAppearance.ALL; protected T tmpValue; // Put this into your own builder - public S setAppearance(ConfigEntryAppearance newAppearance) { + public S setAppearance(EConfigEntryAppearance newAppearance) { this.tmpAppearance = newAppearance; return (S) this; } diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java index 564fea88b..b51913e13 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigCategory.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.config.types; -import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; +import com.seibel.lod.core.config.types.enums.EConfigEntryAppearance; /** * Adds a categoty to the config @@ -11,7 +11,7 @@ import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; public class ConfigCategory extends AbstractConfigType { public String destination; // Where the category goes to - private ConfigCategory(ConfigEntryAppearance appearance, Class value, String destination) { + private ConfigCategory(EConfigEntryAppearance appearance, Class value, String destination) { super(appearance, value); this.destination = destination; } @@ -35,7 +35,7 @@ public class ConfigCategory extends AbstractConfigType { return this; } - public Builder setAppearance(ConfigEntryAppearance newAppearance) { + public Builder setAppearance(EConfigEntryAppearance newAppearance) { this.tmpAppearance = newAppearance; return this; } diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java index 8114175aa..15c6a664c 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java @@ -31,11 +31,11 @@ public class ConfigEntry extends AbstractConfigType> implem public final boolean allowApiOverride; private T apiValue; - private final ConfigEntryPerformance performance; + private final EConfigEntryPerformance performance; /** Creates the entry */ - private ConfigEntry(ConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean allowApiOverride, ConfigEntryPerformance performance, ArrayList listenerList) + private ConfigEntry(EConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean allowApiOverride, EConfigEntryPerformance performance, ArrayList listenerList) { super(appearance, value); this.defaultValue = value; @@ -120,7 +120,7 @@ public class ConfigEntry extends AbstractConfigType> implem public void setComment(String newComment) { this.comment = newComment; } /** Gets the performance impact of an option */ - public ConfigEntryPerformance getPerformance() { return this.performance; } + public EConfigEntryPerformance getPerformance() { return this.performance; } public void addListener(IConfigListener newListener) { this.listenerList.add(newListener); } public void removeListener(IConfigListener oldListener) { this.listenerList.remove(oldListener); } @@ -197,7 +197,7 @@ public class ConfigEntry extends AbstractConfigType> implem private T tmpMin; private T tmpMax; private boolean tmpUseApiOverwrite; - private ConfigEntryPerformance tmpPerformance = ConfigEntryPerformance.DONT_SHOW; + private EConfigEntryPerformance tmpPerformance = EConfigEntryPerformance.DONT_SHOW; protected ArrayList tmpIConfigListener = new ArrayList<>(); public Builder comment(String newComment) @@ -239,7 +239,7 @@ public class ConfigEntry extends AbstractConfigType> implem return this; } - public Builder setPerformance(ConfigEntryPerformance newPerformance) + public Builder setPerformance(EConfigEntryPerformance newPerformance) { this.tmpPerformance = newPerformance; return this; diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigLinkedEntry.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigLinkedEntry.java index 387032d22..69f19301d 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigLinkedEntry.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigLinkedEntry.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.config.types; -import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; +import com.seibel.lod.core.config.types.enums.EConfigEntryAppearance; /** * Creates a UI element that copies everything from another element. @@ -10,12 +10,12 @@ import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; */ public class ConfigLinkedEntry extends AbstractConfigType { public ConfigLinkedEntry(AbstractConfigType value) { - super(ConfigEntryAppearance.ONLY_IN_GUI, value); + super(EConfigEntryAppearance.ONLY_IN_GUI, value); } /** Appearance shouldn't be changed */ @Override - public void setAppearance(ConfigEntryAppearance newAppearance) {} + public void setAppearance(EConfigEntryAppearance newAppearance) {} /** Value shouldn't be changed after creation */ @Override @@ -25,7 +25,7 @@ public class ConfigLinkedEntry extends AbstractConfigType { /** Appearance shouldn't be changed */ @Override - public Builder setAppearance(ConfigEntryAppearance newAppearance) { + public Builder setAppearance(EConfigEntryAppearance newAppearance) { return this; } diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java index c28b92ce0..e434b1341 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigUIComment.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.config.types; -import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; +import com.seibel.lod.core.config.types.enums.EConfigEntryAppearance; /** * Adds something like a ConfigEntry but without a button to change the input @@ -9,12 +9,12 @@ import com.seibel.lod.core.config.types.enums.ConfigEntryAppearance; */ public class ConfigUIComment extends AbstractConfigType{ public ConfigUIComment() { - super(ConfigEntryAppearance.ONLY_IN_GUI, ""); + super(EConfigEntryAppearance.ONLY_IN_GUI, ""); } /** Appearance shouldn't be changed */ @Override - public void setAppearance(ConfigEntryAppearance newAppearance) {} + public void setAppearance(EConfigEntryAppearance newAppearance) {} /** Pointless to set the value */ @Override @@ -23,7 +23,7 @@ public class ConfigUIComment extends AbstractConfigType public static class Builder extends AbstractConfigType.Builder { /** Appearance shouldn't be changed */ @Override - public Builder setAppearance(ConfigEntryAppearance newAppearance) { + public Builder setAppearance(EConfigEntryAppearance newAppearance) { return this; } diff --git a/core/src/main/java/com/seibel/lod/core/config/types/enums/ConfigEntryAppearance.java b/core/src/main/java/com/seibel/lod/core/config/types/enums/EConfigEntryAppearance.java similarity index 80% rename from core/src/main/java/com/seibel/lod/core/config/types/enums/ConfigEntryAppearance.java rename to core/src/main/java/com/seibel/lod/core/config/types/enums/EConfigEntryAppearance.java index 0679e1119..61c0e73ae 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/enums/ConfigEntryAppearance.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/enums/EConfigEntryAppearance.java @@ -6,7 +6,7 @@ package com.seibel.lod.core.config.types.enums; * * @author coolGi */ -public enum ConfigEntryAppearance +public enum EConfigEntryAppearance { /** Defeat option */ ALL(true, true), @@ -14,13 +14,15 @@ public enum ConfigEntryAppearance ONLY_IN_GUI(true, false), /** Only show the option in the file. There would be no way to access it using the UI */ ONLY_IN_FILE(true, false); - + /** Sets whether the option should show in the UI */ public final boolean showInGui; /** Sets whether to save an option,
If set to false, the option will be reset on game restart */ public final boolean showInFile; - ConfigEntryAppearance(boolean showInGui, boolean showInFile) { // If both are false then the config won't touch the option, but it would still be accessable if explicitly called + EConfigEntryAppearance(boolean showInGui, boolean showInFile) + { + // If both are false then the config won't touch the option, but it would still be accessible if explicitly called this.showInGui = showInGui; this.showInFile = showInFile; } diff --git a/core/src/main/java/com/seibel/lod/core/config/types/enums/ConfigEntryPerformance.java b/core/src/main/java/com/seibel/lod/core/config/types/enums/EConfigEntryPerformance.java similarity index 85% rename from core/src/main/java/com/seibel/lod/core/config/types/enums/ConfigEntryPerformance.java rename to core/src/main/java/com/seibel/lod/core/config/types/enums/EConfigEntryPerformance.java index 37ed59650..a71ffa9c0 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/enums/ConfigEntryPerformance.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/enums/EConfigEntryPerformance.java @@ -6,13 +6,14 @@ package com.seibel.lod.core.config.types.enums; * * @author coolGi */ -public enum ConfigEntryPerformance { +public enum EConfigEntryPerformance +{ NONE, VERY_LOW, LOW, MEDIUM, HIGH, VERY_HIGH, - + DONT_SHOW }