A mod's settings button now opens ModSettings: a header with the mod's icon, name, version, tags and description, a Reset button and an on/off switch, then its properties as rows, with nested namespaces as titled sections and a live preview card beside them for HUD mods. PanelScreen holds the sidebar-and-panel frame that the mod menu, mod settings and config editor share. PropertyList lays out any config as rows. The inputs share one field look: Toggle is a switch, Select steps with arrows, and the number, keybinding and color inputs are boxes. The color picker opens to the left and closes on outside clicks. Every property type now implements reset(), which was a no-op, and ModLayout keeps its settings in order instead of Map.of's. ConfigEditor moves onto the same frame and rows and drops its HUD preview, which added a new element every frame. Co-Authored-By: Claude Opus 5.5 <[email protected]>
32 lines
776 B
Java
32 lines
776 B
Java
package org.saturnclient.config.property;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
|
|
|
public class BoolProperty extends Property {
|
|
public boolean value;
|
|
public final boolean defaultValue;
|
|
|
|
public BoolProperty(boolean defaultValue) {
|
|
this.value = defaultValue;
|
|
this.defaultValue = defaultValue;
|
|
}
|
|
|
|
@Override
|
|
public void reset() {
|
|
this.value = defaultValue;
|
|
this.isReset = true;
|
|
}
|
|
|
|
@Override
|
|
public JsonNode toJson() {
|
|
return JsonNodeFactory.instance.booleanNode(this.value);
|
|
}
|
|
|
|
@Override
|
|
public void loadFromJson(JsonNode element) {
|
|
if (element.isBoolean())
|
|
this.value = element.booleanValue();
|
|
}
|
|
}
|