(core didnt push) Fixed number values and got closer to completing the classic gui

This commit is contained in:
coolGi2007
2022-04-28 10:33:05 +00:00
parent 417c3fcf8b
commit 768bd88982
3 changed files with 22 additions and 6 deletions
@@ -12,6 +12,8 @@ public abstract class AbstractConfigType<T, S> { // 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) {
@@ -89,9 +89,23 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry> {
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;
@@ -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":