Prefix "E" to a couple config enums

This commit is contained in:
James Seibel
2023-06-10 09:12:05 -05:00
parent 8f499d7320
commit 10b0cf9d8c
8 changed files with 46 additions and 43 deletions
@@ -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<Integer> lodChunkRenderDistance = new ConfigEntry.Builder<Integer>()
.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<EVerticalQuality> verticalQuality = new ConfigEntry.Builder<EVerticalQuality>()
@@ -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<ETransparency> transparency = new ConfigEntry.Builder<ETransparency>()
@@ -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<EFogDistance> fogDistance = new ConfigEntry.Builder<EFogDistance>()
.set(EFogDistance.FAR)
.comment("At what distance should Fog be drawn on the LODs?")
.setPerformance(ConfigEntryPerformance.NONE)
.setPerformance(EConfigEntryPerformance.NONE)
.build();
public static ConfigEntry<EFogDrawMode> fogDrawMode = new ConfigEntry.Builder<EFogDrawMode>()
@@ -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<EFogColorMode> fogColorMode = new ConfigEntry.Builder<EFogColorMode>()
@@ -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<Boolean> disableVanillaFog = new ConfigEntry.Builder<Boolean>()
@@ -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<Double> brightnessMultiplier = new ConfigEntry.Builder<Double>() // 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<Boolean> resetAllSettings = new ConfigEntry.Builder<Boolean>()
.set(false)
.setAppearance(ConfigEntryAppearance.ONLY_IN_GUI)
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
//.addListener(null) // TODO add listener
.build();
@@ -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<T, S> { // 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<T, S> { // 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<T, S> { // The S is the class that is e
}
protected static abstract class Builder<T, S> {
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;
}
@@ -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<Class, ConfigCategory> {
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<Class, ConfigCategory> {
return this;
}
public Builder setAppearance(ConfigEntryAppearance newAppearance) {
public Builder setAppearance(EConfigEntryAppearance newAppearance) {
this.tmpAppearance = newAppearance;
return this;
}
@@ -31,11 +31,11 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> 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<IConfigListener> listenerList)
private ConfigEntry(EConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean allowApiOverride, EConfigEntryPerformance performance, ArrayList<IConfigListener> listenerList)
{
super(appearance, value);
this.defaultValue = value;
@@ -120,7 +120,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> 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<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
private T tmpMin;
private T tmpMax;
private boolean tmpUseApiOverwrite;
private ConfigEntryPerformance tmpPerformance = ConfigEntryPerformance.DONT_SHOW;
private EConfigEntryPerformance tmpPerformance = EConfigEntryPerformance.DONT_SHOW;
protected ArrayList<IConfigListener> tmpIConfigListener = new ArrayList<>();
public Builder<T> comment(String newComment)
@@ -239,7 +239,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implem
return this;
}
public Builder<T> setPerformance(ConfigEntryPerformance newPerformance)
public Builder<T> setPerformance(EConfigEntryPerformance newPerformance)
{
this.tmpPerformance = newPerformance;
return this;
@@ -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<AbstractConfigType, ConfigLinkedEntry> {
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<AbstractConfigType, Co
public static class Builder extends AbstractConfigType.Builder<AbstractConfigType, Builder> {
/** Appearance shouldn't be changed */
@Override
public Builder setAppearance(ConfigEntryAppearance newAppearance) {
public Builder setAppearance(EConfigEntryAppearance newAppearance) {
return this;
}
@@ -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<String, ConfigUIComment>{
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<String, ConfigUIComment>
public static class Builder extends AbstractConfigType.Builder<String, Builder> {
/** Appearance shouldn't be changed */
@Override
public Builder setAppearance(ConfigEntryAppearance newAppearance) {
public Builder setAppearance(EConfigEntryAppearance newAppearance) {
return this;
}
@@ -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, <br> 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;
}
@@ -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
}