From 768bd88982d4e0f83f458bb2aadacafd7427f37c Mon Sep 17 00:00:00 2001 From: coolGi2007 Date: Thu, 28 Apr 2022 10:33:05 +0000 Subject: [PATCH] (core didnt push) Fixed number values and got closer to completing the classic gui --- .../core/config/types/AbstractConfigType.java | 2 ++ .../lod/core/config/types/ConfigEntry.java | 18 ++++++++++++++++-- src/main/resources/assets/lod/lang/en_us.json | 8 ++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java b/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java index 1069a662a..77e2b5529 100644 --- a/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java +++ b/src/main/java/com/seibel/lod/core/config/types/AbstractConfigType.java @@ -12,6 +12,8 @@ public abstract class AbstractConfigType { // The S is the class that is e public String name; // This should only be set once in the init protected T value; + public Object guiValue; // This can be set by whatever gui you are using + protected ConfigEntryAppearance appearance; public AbstractConfigType(ConfigEntryAppearance appearance, T value) { 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 f6dc48b05..7b8912f27 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 @@ -89,9 +89,23 @@ public class ConfigEntry extends AbstractConfigType { if (ConfigBase.disableMinMax) return 0; if (Number.class.isAssignableFrom(this.value.getClass())) { // Only check min max if it is a number - if (this.max != null && (Double) this.value > (Double) this.max) + if (this.max != null && Double.valueOf(this.value.toString()) > Double.valueOf(this.max.toString())) return 1; - if (this.min != null && (Double) this.value < (Double) this.min) + if (this.min != null && Double.valueOf(this.value.toString()) < Double.valueOf(this.min.toString())) + return -1; + + return 0; + } + return 0; + } + /** */ Checks if a value is valid */ + public byte isValid(T value) { + if (ConfigBase.disableMinMax) + return 0; + if (Number.class.isAssignableFrom(value.getClass())) { // Only check min max if it is a number + if (this.max != null && Double.valueOf(value.toString()) > Double.valueOf(max.toString())) + return 1; + if (this.min != null && Double.valueOf(value.toString()) < Double.valueOf(min.toString())) return -1; return 0; diff --git a/src/main/resources/assets/lod/lang/en_us.json b/src/main/resources/assets/lod/lang/en_us.json index 358aa8c48..23f313aab 100644 --- a/src/main/resources/assets/lod/lang/en_us.json +++ b/src/main/resources/assets/lod/lang/en_us.json @@ -5,12 +5,12 @@ "lod.config.title": "Distant Horizons config", - "lod.config.optionsButton": - "Show options button", - "lod.config.optionsButton.@tooltip": - "Show the config button to the left of the fov button", "lod.config.client": "Client", + "lod.config.client.optionsButton": + "Show options button", + "lod.config.client.optionsButton.@tooltip": + "Show the config button to the left of the fov button", "lod.config.client.graphics": "Graphics", "lod.config.client.graphics.quality":