-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced Implementations and Custom GUI Generation
Property mutations execute lifecycle broadcasts. Implement Property.Listener and bind it via addListener() to intercept state transitions.
-
onPropertyChanged(): Executes when localized disk state modifies or authoritative network synchronization completes. -
onPropertyInvalidated(): Executes when the parent property detaches from the structural hierarchy or severs an authoritative network connection.
Detachment utilizes removeListener() to drop the active sequence.
The framework provides pre-constructed listeners designed for configurable datapack values. To utilize these implementations, extend the target class located within johnsmith.configoverhauled.impl.core.listener (e.g., IntegerPropertyListener, BooleanPropertyListener), implement the required Codec for deserialization, and execute the super constructor.
Runtime structural injection bypasses static field definition. Utilize ConfigManager::getOrCreateDynamicProperty combined with PropertyFactory to instantiate properties from deserialized network or disk definitions.
Property<?> dynamicProp = ExampleConfig.MANAGER.getOrCreateDynamicProperty(
description, // Absolute coordinate map
Boolean.class, // Underlying data class
true, // Baseline state
null, // Lower validation boundary
null // Upper validation boundary
);This operation targets datapack injection or authoritative server synchronization where structural configurations are unknown during the primary boot sequence.
Standard execution automates disk synchronization upon property modification. Manual I/O execution isolates synchronization to specific scopes or shifts operations off the main thread.
-
loadScope(ConfigScope targetScope): Forces a synchronous disk read operation strictly for properties bound to the specified scope. -
saveScope(ConfigScope targetScope): Forces a synchronous disk write operation strictly for properties bound to the specified scope. -
saveAll(): Dispatches an asynchronous disk write operation across all configuration scopes. Returns aCompletableFuture<Void>representing the completion state of the I/O execution.
Custom graphical interfaces require overriding default rendering protocols and executing explicit registry binding.
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.
Extend `johnsmith.configoverhauled.impl.core.ConfigManagerImpl` to intercept graphical interface generation. Override the `createScreen(S parent)` method to construct and return the specialized screen entity.
```java
import johnsmith.configoverhauled.impl.core.ConfigManagerImpl;
import org.slf4j.Logger;
public class CustomConfigManager extends ConfigManagerImpl {
public CustomConfigManager(String modId, Logger logger) {
super(modId, logger);
}
@Override
public <S> S createScreen(S parent) {
// Construct and return the specialized GUI
return (S) new MyCustomScreen(parent, this);
}
}Bypass ConfigRegistry.getOrCreateManager(). Instantiate the custom manager directly. The ConfigManagerImpl constructor executes registry binding automatically. Enforce this allocation prior to defining structural categories or properties.
public static final CustomConfigManager MANAGER = new CustomConfigManager("examplemod", LOGGER);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 or GLOBAL 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.