-
Notifications
You must be signed in to change notification settings - Fork 21
Home
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.
-
GuiSyncHandler
stores sync handlers for widgets. Is responsible for syncing values of widgets between server and client. -
ModularContainer
is the wrapper for the minecraftContainer
class. This is important for item slots.
-
ModularScreen
is the heart of every modular UI. It needs to be instanciated every time a GUI is opened. It also stores a list ofModularPanel
s. -
ModularPanel
is basically a window in a gui. AModularScreen
must 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. -
GuiContext
is a helper class which is instanciated for everyModularScreen
. It keeps track of pressed buttons, dragged, focused or hovered elements and viewports. -
IWidget
is the base interface for all widgets. FurthermoreGuiSyncHandler
andModularContainer
also exist on client side.
I highly recommend to use Intellij as an IDE with the Single Hotswap plugin. It allows to hot reload the current class, while the game is running. Perfect for GUI development.
For beginners you can start reading this. You can find test examples here and here. You can also check out InventoryBogoSorter where i use ModularUI for the config UI.