-
Notifications
You must be signed in to change notification settings - Fork 56
GUI Toolkit
Widgets and drawing helpers vanilla doesn't have.
Written for Moonlight's own config screen, but they're plain AbstractWidgets and
work in any screen.
| Widget | |
|---|---|
DropdownWidget |
Proper dropdown list |
ColorSwatchWidget / ColorFieldWidget
|
Color preview and hex field, backed by ColorPickerScreen
|
NumberFieldWidget |
Numeric field with clamping and scroll to change |
RangedSlider / RangeControlWidget
|
Slider, and a two handle min/max control |
Vec3ControlWidget |
Three coupled number fields |
BooleanToggleWidget |
✓/✗ switch with an icon |
SyntaxEditBox / PanningEditBox
|
Multiline editor with syntax highlighting, and a single line box that pans instead of clipping |
BreadcrumbWidget |
Navigation trail |
IconButton / MediaButton
|
Icon buttons, and the link buttons (CurseForge, Modrinth, Discord...) |
ItemCarouselWidget |
Slowly panning strip of items |
ChatBubbleWidget |
Speech bubble, also usable as an in world overlay with PointingChatBubbleOverlay
|
CompositeWidget |
Group several widgets as one |
Syntax highlighting is pluggable: JsonHighlighter, NbtHighlighter, RegexHighlighter, or your
own SyntaxHighlighter.
Two ready made screens you can just open: ColorPickerScreen and JsonEditScreen.
GuiHelper has the drawing bits that keep getting rewritten: header bars, separators, list
backgrounds, scrollbars, horizontal gradients, mod icons, scrolling text that fits a row, number
formatting, and the click sound.
Popup and PopupHost add a modal layer on top of a screen without opening a new one, and
OverlayLayer draws over the whole game.
Tip
Don't scale GUI content with the pose stack. Blit at the size you want instead, or the pixels stop lining up with the rest of the interface.
IScreenProvider on a block entity or entity gives you sendOpenGuiPacket(player, face), which
handles the server to client round trip for a screen that isn't a menu.
Basics Platform Helpers Registration Networking Events Configs Config Screen
Resources Runtime Resource Packs Texture Manipulation Resource Helpers Block Set API
Client Custom Models Item Rendering Rendered Textures Post Shaders GUI Toolkit Colors
World Block and Item Interfaces Additional Item Placements Improved Entities Fake Levels World Data Dispenser Behaviors
Utilities Codec Utilities Misc Helpers Commands
Datapacks Villagers Soft Fluids Map Markers Spawn Boxes Global Datapack Folder