diff --git a/src/main/java/com/seibel/lod/core/config/Config.java b/src/main/java/com/seibel/lod/core/config/Config.java index e41ed1001..f63d24f6b 100644 --- a/src/main/java/com/seibel/lod/core/config/Config.java +++ b/src/main/java/com/seibel/lod/core/config/Config.java @@ -173,10 +173,8 @@ public class Config { public static ConfigEntry fogDistance = new ConfigEntry.Builder() .set(EFogDistance.FAR) - .comment("" - + "At what distance should Fog be drawn on the fake chunks? \n" - + "\n" - + "This setting shouldn't affect performance.") + .comment("At what distance should Fog be drawn on the fake chunks?") + .setPerformance(ConfigEntryPerformance.NONE) .build(); public static ConfigEntry fogDrawMode = new ConfigEntry.Builder() @@ -396,9 +394,8 @@ public class Config + " LODs will render on top of distant vanilla chunks to hide delayed loading. \n" + " Will dynamically decide the border offset based on vanilla render distance. \n" + EVanillaOverdraw.ALWAYS + ": \n" - + " LODs will render on all vanilla chunks preventing all holes in the world. \n" - + "\n" - + "This setting shouldn't affect performance.") + + " LODs will render on all vanilla chunks preventing all holes in the world.") + .setPerformance(ConfigEntryPerformance.NONE) .build(); public static ConfigEntry overdrawOffset = new ConfigEntry.Builder() @@ -417,9 +414,8 @@ public class Config .set(true) .comment("" + "Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n" - + " especially when in/near an ocean. \n" - + "\n" - + "This setting shouldn't affect performance.") + + " especially when in/near an ocean.") + .setPerformance(ConfigEntryPerformance.NONE) .build(); public static ConfigEntry brightnessMultiplier = new ConfigEntry.Builder() // TODO: Make this a float (the ClassicConfigGUI dosnt support floats) @@ -589,9 +585,8 @@ public class Config + "\n" + EGenerationPriority.AUTO + " \n" + "Uses " + EGenerationPriority.BALANCED + " when on a single player world \n" - + " and " + EGenerationPriority.NEAR_FIRST + " when connected to a server. \n" - + "\n" - + "This shouldn't affect performance.") + + " and " + EGenerationPriority.NEAR_FIRST + " when connected to a server.") + .setPerformance(ConfigEntryPerformance.NONE) .build(); public static ConfigEntry blocksToAvoid = new ConfigEntry.Builder() @@ -605,9 +600,8 @@ public class Config + EBlocksToAvoid.NONE + ": Use all blocks when generating fake chunks \n" + 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 \n" - + "\n" - + "This wont't affect performance.") + + EBlocksToAvoid.BOTH + ": Only use full solid blocks when generating fake chunks") + .setPerformance(ConfigEntryPerformance.NONE) .build(); public static ConfigEntry tintWithAvoidedBlocks = new ConfigEntry.Builder() diff --git a/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java b/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java index 6213174b3..967560af2 100644 --- a/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java +++ b/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java @@ -15,7 +15,7 @@ public class ConfigEntry extends AbstractConfigType> private String comment; private T min; private T max; - + // API control // /** * If true this config can be controlled by the API
@@ -23,17 +23,21 @@ public class ConfigEntry extends AbstractConfigType> */ public final boolean allowApiOverride; private T apiValue; - - - + private Runnable runnable; // What to run when the value gets changed + + private ConfigEntryPerformance performance; + + /** Creates the entry */ - private ConfigEntry(ConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean allowApiOverride) { + private ConfigEntry(ConfigEntryAppearance appearance, T value, String comment, T min, T max, boolean allowApiOverride, Runnable runnable, ConfigEntryPerformance performance) { super(appearance, value); this.defaultValue = value; this.comment = comment; this.min = min; this.max = max; this.allowApiOverride = allowApiOverride; + this.runnable = runnable; + this.performance = performance; } @@ -99,6 +103,10 @@ public class ConfigEntry extends AbstractConfigType> this.comment = newComment; } + /** Gets the performance impact of an option */ + public ConfigEntryPerformance getPerformance() { + return this.performance; + } /** * Checks if the option is valid @@ -151,11 +159,24 @@ public class ConfigEntry extends AbstractConfigType> } } + public Runnable getRunnable() { + return this.runnable; + } + public void setRunnable(Runnable runnable) { + this.runnable = runnable; + } + public void runRunnable() { + if (runnable != null) + runnable.run(); + } + public static class Builder extends AbstractConfigType.Builder> { private String tmpComment = null; private T tmpMin; private T tmpMax; private boolean tmpUseApiOverwrite; + private Runnable runnable; + private ConfigEntryPerformance performance = ConfigEntryPerformance.DONT_SHOW; public Builder comment(String newComment) { this.tmpComment = newComment; @@ -188,9 +209,20 @@ public class ConfigEntry extends AbstractConfigType> return this; } + public Builder setRunnable(Runnable runnable) { + this.runnable = runnable; + return this; + } + + public Builder setPerformance(ConfigEntryPerformance performance) { + this.performance = performance; + return this; + } + + public ConfigEntry build() { - return new ConfigEntry(tmpAppearance, tmpValue, tmpComment, tmpMin, tmpMax, tmpUseApiOverwrite); + return new ConfigEntry(tmpAppearance, tmpValue, tmpComment, tmpMin, tmpMax, tmpUseApiOverwrite, runnable, performance); } } } diff --git a/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java b/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java new file mode 100644 index 000000000..7c45aa2e1 --- /dev/null +++ b/src/main/java/com/seibel/lod/core/config/types/ConfigEntryPerformance.java @@ -0,0 +1,17 @@ +package com.seibel.lod.core.config.types; + +/** + * What is the performance impact of an entry + * + * @author coolGi + */ +public enum ConfigEntryPerformance { + NONE, + VERY_LOW, + LOW, + MEDIUM, + HIGH, + VERY_HIGH, + + DONT_SHOW +}