How gtnewhorizons/modularui2 works
ModularUI is a Minecraft GUI library. A mod or application opens a GUI through a factory; the resulting screen manages panels containing a tree of widgets, whose layout, rendering, and interactions provide the user-facing result. Optional branches cover client-server value synchronization, themes, overlays, inventory slots, recipe-viewer compatibility, and in-world holographic screens. The source excerpts show key orchestration and synchronization links; README statements support the broader widget workflow. Some subsystem internals were not sampled, so uncertain connections are omitted.
Main entry points: ModularScreen.java Modular screen · IWidget.java Widget tree · GuiManager.java GUI manager · ModularSyncManager.java Value synchronization
Components 21
GUI lifecycle
- GUI factories
src/main/java/com/cleanroommc/modularui/factory/GuiFactories.java - GUI manager
src/main/java/com/cleanroommc/modularui/factory/GuiManager.java - Modular screen
src/main/java/com/cleanroommc/modularui/screen/ModularScreen.java - Client handler
src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java
UI composition
- Panel manager
src/main/java/com/cleanroommc/modularui/screen/PanelManager.java - Panels
src/main/java/com/cleanroommc/modularui/screen/ModularPanel.java - Widget tree
src/main/java/com/cleanroommc/modularui/api/widget/IWidget.java - Layout widgets
src/main/java/com/cleanroommc/modularui/api/layout/ILayoutWidget.java - GUI context
src/main/java/com/cleanroommc/modularui/screen/viewport/ModularGuiContext.java - Dynamic drawing
src/main/java/com/cleanroommc/modularui/drawable/GuiDraw.java - Inventory slots
src/main/java/com/cleanroommc/modularui/widgets/slot/ItemSlot.java
UI services
- Value synchronization
src/main/java/com/cleanroommc/modularui/value/sync/ModularSyncManager.java - Panel sync
src/main/java/com/cleanroommc/modularui/value/sync/PanelSyncManager.java - Packet transport
src/main/java/com/cleanroommc/modularui/network/NetworkHandler.java - JSON themes
src/main/java/com/cleanroommc/modularui/theme/ThemeManager.java - GUI configuration
src/main/java/com/cleanroommc/modularui/config/ConfigPanel.java - Overlays
src/main/java/com/cleanroommc/modularui/overlay/OverlayManager.java
Integrations
- Holographic UI
src/main/java/com/cleanroommc/modularui/holoui/HoloUI.java - NEI compatibility
src/main/java/com/cleanroommc/modularui/integration/nei/ModularUINEIGuiHandler.java - Recipe viewer
src/main/java/com/cleanroommc/modularui/integration/recipeviewer/RecipeViewerRecipeTransferHandler.java
Other components
- Mod application
Connections 23
- Mod application → GUI factories: defines GUI
- GUI factories → GUI manager: registers factory
- GUI manager → Modular screen: creates screen
src/main/java/com/cleanroommc/modularui/factory/GuiManager.java - Client handler → Modular screen: draws screen
src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java - Modular screen → Panel manager: manages panels
src/main/java/com/cleanroommc/modularui/screen/PanelManager.java - Panel manager → Panels: opens panels
src/main/java/com/cleanroommc/modularui/screen/PanelManager.java - Panels → Widget tree: contains widget tree
README.md - Widget tree → Layout widgets: uses layout
README.md - Modular screen → GUI context: updates context
src/main/java/com/cleanroommc/modularui/screen/ModularScreen.java - GUI context → Widget tree: tracks interaction
src/main/java/com/cleanroommc/modularui/screen/viewport/ModularGuiContext.java - Widget tree → Dynamic drawing: renders dynamically
README.md - Widget tree → Inventory slots: includes slot widgets
- GUI manager → Value synchronization: creates sync manager
src/main/java/com/cleanroommc/modularui/factory/GuiManager.java - Value synchronization → Panel sync: opens panel sync
src/main/java/com/cleanroommc/modularui/value/sync/ModularSyncManager.java - Panel sync → Packet transport: sends sync packets
src/main/java/com/cleanroommc/modularui/value/sync/PanelSyncManager.java - Packet transport → Value synchronization: transports sync packets
src/main/java/com/cleanroommc/modularui/network/NetworkHandler.java - Modular screen → JSON themes: selects theme
- JSON themes → Dynamic drawing: loads theme textures
- Modular screen → GUI configuration: offers configuration
- Client handler → Overlays: handles overlay input
- Mod application → Holographic UI: may open in-world UI
- Modular screen → NEI compatibility: integrates with NEI
- Modular screen → Recipe viewer: supports recipe transfer