diff --git a/src/main/java/com/seibel/lod/core/api/external/apiObjects/wrapperInterfaces/IDhApiConfig_v1.java b/src/main/java/com/seibel/lod/core/api/external/apiObjects/wrapperInterfaces/IDhApiConfig_v1.java new file mode 100644 index 000000000..343c1fff1 --- /dev/null +++ b/src/main/java/com/seibel/lod/core/api/external/apiObjects/wrapperInterfaces/IDhApiConfig_v1.java @@ -0,0 +1,49 @@ +package com.seibel.lod.core.api.external.apiObjects.wrapperInterfaces; + +/** + * An interface for Distant Horizon's Config. + * + * @param + * @author James Seibel + * @version 2022-6-9 + */ +public interface IDhApiConfig_v1 +{ + /** + * Returns the active value for this config.
+ * Returns the True value if either the config cannot be overridden by + * the API or if it hasn't been set by the API. + */ + public T getValue(); + /** + * Returns the value held by this config.
+ * This is the value stored in the config file. + */ + public T getTrueValue(); + /** + * Returns the value of the config if it was set by the API. + * Returns null if the config wasn't set by the API. + */ + public T getApiValue(); + + /** + * Sets the config's value.
+ * If the newValue is set to null then the config + * will revert to using the True Value.
+ * If the config cannot be set via the API this method will return false. + * + * @return true if the value was set, false otherwise. + */ + public boolean setValue(T newValue); + + /** Returns true if this config can be set via the API, false otherwise. */ + public boolean getCanBeOverrodeByApi(); + + /** Returns the default value for this config. */ + public T getDefaultValue(); + /** Returns the max value for this config, null if there is no max. */ + public T getMaxValue(); + /** Returns the min value for this config, null if there is no min. */ + public T getMinValue(); + +} diff --git a/src/main/java/com/seibel/lod/core/api/external/config/client/DhApiThreading.java b/src/main/java/com/seibel/lod/core/api/external/config/client/DhApiThreading.java index 6951d8812..7e595e63b 100644 --- a/src/main/java/com/seibel/lod/core/api/external/config/client/DhApiThreading.java +++ b/src/main/java/com/seibel/lod/core/api/external/config/client/DhApiThreading.java @@ -1,6 +1,7 @@ package com.seibel.lod.core.api.external.config.client; -import com.seibel.lod.core.api.external.apiObjects.objects.DhApiConfig_v1; +import com.seibel.lod.core.api.external.apiObjects.wrapperInterfaces.IDhApiConfig_v1; +import com.seibel.lod.core.api.externalImplementation.apiObjects.wrappers.DhApiConfig_v1; import com.seibel.lod.core.config.Config.Client.Advanced.Threading; @@ -8,7 +9,7 @@ import com.seibel.lod.core.config.Config.Client.Advanced.Threading; * General Threading settings. * * @author James Seibel - * @version 2022-6-2 + * @version 2022-6-9 */ public class DhApiThreading { @@ -25,12 +26,12 @@ public class DhApiThreading * 1.5 = 2 threads active 100% of the time (partial values are rounded up)
* 2.0 = 2 threads active 100% of the time
*/ - public static DhApiConfig_v1 getWorldGeneratorThreadConfig_v1() + public static IDhApiConfig_v1 getWorldGeneratorThreadConfig_v1() { return new DhApiConfig_v1<>(Threading.numberOfWorldGenerationThreads); } /** Returns the config related to the buffer (GPU Terrain data) builder threads. */ - public static DhApiConfig_v1 getBufferBuilderThreadConfig_v1() + public static IDhApiConfig_v1 getBufferBuilderThreadConfig_v1() { return new DhApiConfig_v1<>(Threading.numberOfBufferBuilderThreads); } } diff --git a/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsFog.java b/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsFog.java index 4752ca5fa..3fb3313f2 100644 --- a/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsFog.java +++ b/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsFog.java @@ -1,8 +1,9 @@ package com.seibel.lod.core.api.external.config.client.graphics; +import com.seibel.lod.core.api.external.apiObjects.wrapperInterfaces.IDhApiConfig_v1; import com.seibel.lod.core.enums.rendering.EFogColorMode; import com.seibel.lod.core.enums.rendering.EFogDistance; -import com.seibel.lod.core.api.external.apiObjects.objects.DhApiConfig_v1; +import com.seibel.lod.core.api.externalImplementation.apiObjects.wrappers.DhApiConfig_v1; import com.seibel.lod.core.config.Config.Client.Graphics.FogQuality; import com.seibel.lod.core.enums.rendering.EFogDrawMode; @@ -10,25 +11,25 @@ import com.seibel.lod.core.enums.rendering.EFogDrawMode; * Any graphics settings related to fog. * * @author James Seibel - * @version 2022-6-2 + * @version 2022-6-9 */ public class DhApiGraphicsFog { /** Returns the config related to when fog is rendered. */ - public static DhApiConfig_v1 getFogDistanceConfig_v1() + public static IDhApiConfig_v1 getFogDistanceConfig_v1() { return new DhApiConfig_v1<>(FogQuality.fogDistance); } /** Returns the config related to when fog is rendered. */ - public static DhApiConfig_v1 getFogRenderConfig_v1() + public static IDhApiConfig_v1 getFogRenderConfig_v1() { return new DhApiConfig_v1<>(FogQuality.fogDrawMode); } /** Returns the config related to the fog draw type. */ - public static DhApiConfig_v1 getFogColorConfig_v1() + public static IDhApiConfig_v1 getFogColorConfig_v1() { return new DhApiConfig_v1<>(FogQuality.fogColorMode); } /** Returns the config related to disabling vanilla fog. */ - public static DhApiConfig_v1 getDisableVanillaFogConfig_v1() + public static IDhApiConfig_v1 getDisableVanillaFogConfig_v1() { return new DhApiConfig_v1<>(FogQuality.disableVanillaFog); } diff --git a/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsGeneral.java b/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsGeneral.java index ae7b61132..4217f0734 100644 --- a/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsGeneral.java +++ b/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/DhApiGraphicsGeneral.java @@ -1,6 +1,7 @@ package com.seibel.lod.core.api.external.config.client.graphics; -import com.seibel.lod.core.api.external.apiObjects.objects.DhApiConfig_v1; +import com.seibel.lod.core.api.external.apiObjects.wrapperInterfaces.IDhApiConfig_v1; +import com.seibel.lod.core.api.externalImplementation.apiObjects.wrappers.DhApiConfig_v1; import com.seibel.lod.core.enums.rendering.ERendererType; import com.seibel.lod.core.config.Config.Client.Graphics.Quality; import com.seibel.lod.core.config.Config.Client.Advanced.Debugging; @@ -9,7 +10,7 @@ import com.seibel.lod.core.config.Config.Client.Advanced.Debugging; * General graphics settings. * * @author James Seibel - * @version 2022-6-2 + * @version 2022-6-9 */ public class DhApiGraphicsGeneral { @@ -18,11 +19,11 @@ public class DhApiGraphicsGeneral * Returns the config related to Distant Horizons render distance.
* The distance is a radius in measured in chunks. */ - public static DhApiConfig_v1 getDhChunkRenderDistanceConfig_v1() + public static IDhApiConfig_v1 getDhChunkRenderDistanceConfig_v1() { return new DhApiConfig_v1<>(Quality.lodChunkRenderDistance); } /** Returns the config related to how Distant Horizons is set to render. */ - public static DhApiConfig_v1 getRenderingTypeConfig_v1() + public static IDhApiConfig_v1 getRenderingTypeConfig_v1() { return new DhApiConfig_v1<>(Debugging.rendererType); } } diff --git a/src/main/java/com/seibel/lod/core/api/external/apiObjects/objects/DhApiConfig_v1.java b/src/main/java/com/seibel/lod/core/api/externalImplementation/apiObjects/wrappers/DhApiConfig_v1.java similarity index 50% rename from src/main/java/com/seibel/lod/core/api/external/apiObjects/objects/DhApiConfig_v1.java rename to src/main/java/com/seibel/lod/core/api/externalImplementation/apiObjects/wrappers/DhApiConfig_v1.java index 70948642e..4ae6daac8 100644 --- a/src/main/java/com/seibel/lod/core/api/external/apiObjects/objects/DhApiConfig_v1.java +++ b/src/main/java/com/seibel/lod/core/api/externalImplementation/apiObjects/wrappers/DhApiConfig_v1.java @@ -1,5 +1,6 @@ -package com.seibel.lod.core.api.external.apiObjects.objects; +package com.seibel.lod.core.api.externalImplementation.apiObjects.wrappers; +import com.seibel.lod.core.api.external.apiObjects.wrapperInterfaces.IDhApiConfig_v1; import com.seibel.lod.core.config.types.ConfigEntry; /** @@ -7,9 +8,9 @@ import com.seibel.lod.core.config.types.ConfigEntry; * * @param * @author James Seibel - * @version 2022-6-2 + * @version 2022-6-9 */ -public class DhApiConfig_v1 +public class DhApiConfig_v1 implements IDhApiConfig_v1 { private final ConfigEntry configEntry; @@ -24,31 +25,10 @@ public class DhApiConfig_v1 } - /** - * Returns the active value for this config.
- * Returns the True value if either the config cannot be overridden by - * the API or if it hasn't been set by the API. - */ public T getValue() { return this.configEntry.get(); } - /** - * Returns the value held by this config.
- * This is the value stored in the config file. - */ public T getTrueValue() { return this.configEntry.getTrueValue(); } - /** - * Returns the value of the config if it was set by the API. - * Returns null if the config wasn't set by the API. - */ public T getApiValue() { return this.configEntry.getApiValue(); } - /** - * Sets the config's value.
- * If the newValue is set to null then the config - * will revert to using the True Value.
- * If the config cannot be set via the API this method will return false. - * - * @return true if the value was set, false otherwise. - */ public boolean setValue(T newValue) { if (this.configEntry.allowApiOverride) @@ -62,14 +42,10 @@ public class DhApiConfig_v1 } } - /** Returns true if this config can be set via the API, false otherwise. */ public boolean getCanBeOverrodeByApi() { return this.configEntry.allowApiOverride; } - /** Returns the default value for this config. */ public T getDefaultValue() { return this.configEntry.getDefaultValue(); } - /** Returns the max value for this config, null if there is no max. */ public T getMaxValue() { return this.configEntry.getMax(); } - /** Returns the min value for this config, null if there is no min. */ public T getMinValue() { return this.configEntry.getMin(); } }