Skip to content

Advanced Implementations and Custom GUI Generation

JohnSmith474 edited this page Jun 12, 2026 · 33 revisions

Custom graphical interfaces require overriding default rendering protocols and executing explicit registry binding.

Custom Manager Allocation

Extend johnsmith.configoverhauled.impl.core.ConfigManagerImpl to intercept graphical interface generation. Override the createScreen(S parent) method to construct and return the custom screen entity.

public class CustomConfigManager extends ConfigManagerImpl {
    public CustomConfigManager(String modId) {
        super(modId);
    }

    @Override
    public <S> S createScreen(S parent) {
        // Construct and return the specialized GUI
        return (S) new MyCustomScreen(parent, this);
    }
}

The Java ServiceLoader dynamically allocates standard managers through ConfigRegistry.getOrCreateManager(). Custom managers must bypass this resolution sequence. Construct the specialized manager instance directly and enforce explicit registry binding before defining any properties or structural categories.

CustomConfigManager manager = new CustomConfigManager("examplemod");
ConfigRegistry.registerManager(manager);

GUI Implementation Pitfalls

Active configuration states are mutated via the Property.set(T newValue) accessor. Executing this method instantaneously initiates disk serialization routines. For properties assigned the LEVEL operational scope, this accessor concurrently dispatches outbound network payloads to synchronize the authoritative server state.

  • Network Saturation: Text input widgets must implement rigid debouncing parameters or restrict state mutation exclusively to definitive confirmation events (e.g., loss of widget focus, terminal 'Enter' keypress). Invoking Property.set() on continuous character modification sequences triggers excessive disk I/O and immediately saturates network synchronization channels.

  • Boundary Validation: Input components must independently validate structural constraints prior to executing state mutation. Properties statically allocated with numerical boundaries (min, max) expect sanitized inputs. Pushing unvalidated or malformed states into the property accessor disrupts codec translation pipelines and induces local desynchronization from network authority. Filter invalid structural mappings strictly within the custom UI component logic.

Clone this wiki locally