-
Notifications
You must be signed in to change notification settings - Fork 49
Home
brachy84 edited this page Mar 29, 2023
·
5 revisions
This wiki is intended for people who want to use ModularUI in their mod or for resourcepack/modpack developers who want to customize ModularUI.
ModularUI is a UI library for Minecraft. The first appearance of something like ModularUI was in GTCE. Since then a lot of improvements have been made and is now completely standalone (apart from Mixinbooter). The main goal of this lib is being able to easily create complex and beautiful UI's without having to go through the GUI mess from Minecraft (it's really bad).
- panel system similar to windows
- automatic rendering of widgets in the right layer
- handeling of interactions
- syncing of values
- also good for client only GUI's
- Themes that are customizable via resourcepacks
To understand how it works we have to diffirentiate between server and client. The server side is optional depending on if you need to sync values.
-
GuiSyncHandlerstores sync handlers for widgets. Is responsible for syncing values of widgets between server and client. -
ModularContaineris the wrapper for the minecraftContainerclass. This is important for item slots.
-
ModularScreenis the heart of every modular UI. It needs to be instanciated every time a GUI is opened. It also stores a list ofModularPanels. -
ModularPanelis basically a window in a gui. AModularScreenmust always have at least one panel to be considered open. A panel can sometimes be dragged around. It stores a list of widgets, which in turn can also contain lists of widgets. This creates a tree like structure of widgets with the ModularPanel always being at the top. -
GuiContextis a helper class which is instanciated for everyModularScreen. It keeps track of pressed buttons, dragged, focused or hovered elements and viewports. -
IWidgetis the base interface for all widgets. FurthermoreGuiSyncHandlerandModularContaineralso exist on client side.