EssentialComponentFactory provides pre-built, styled UI components that you can use in your mod’s interfaces.
Overview
Essential provides several reusable components:- Emulated Player (3D character preview)
- Confirmation Modals
- Icon Buttons (internal)
EssentialGUI.
Getting Started
Access the Component Factory
Emulated Player
Display a 3D player model that can be rotated and customized.Basic Usage
EmulatedPlayerBuilder
Configure the emulated player using the builder:Properties
| Property | Type | Description |
|---|---|---|
profile | GameProfile? | The Minecraft player profile to display |
wrappedProfileState | State<WrappedGameProfile?>? | Reactive state for the profile |
showCape | Boolean | Whether to show the player’s cape |
showCapeState | State<Boolean> | Reactive state for cape visibility |
draggable | Boolean | Whether the player can be rotated with mouse |
draggableState | State<Boolean> | Reactive state for draggability |
renderNameTag | Boolean | Whether to render the name tag |
renderNameTagState | State<Boolean> | Reactive state for name tag visibility |
Dynamic Updates
Use states to update the player dynamically:Example: Character Customizer
Confirmation Modal
Display a modal dialog for user confirmation.Basic Usage
ConfirmationModalBuilder
Configure the confirmation modal:Properties
| Property | Type | Description |
|---|---|---|
text | String | Main modal text |
secondaryText | String? | Secondary descriptive text |
inputPlaceholder | String? | Placeholder for input field (if provided, shows input) |
confirmButtonText | String | Label for confirm button (default: “Confirm”) |
denyButtonText | String | Label for deny button (default: “Decline”) |
onConfirm | (String) -> Unit | Callback when confirmed (receives user input) |
onDeny | () -> Unit | Callback when denied |
Examples
Simple Confirmation
With User Input
Friend Request Modal
Displaying Components
In EssentialGUI
Add components to your custom GUI:As Modal Dialog
For modals, create a wrapper screen:Java Examples
Emulated Player
Confirmation Modal
Complete Example
Here’s a complete example combining multiple components:Best Practices
Use States for Dynamic Updates
Use States for Dynamic Updates
When you need to update component properties dynamically, use Elementa states:
Size Emulated Players Appropriately
Size Emulated Players Appropriately
Emulated players look best at reasonable sizes:
Validate User Input in Modals
Validate User Input in Modals
Always validate user input in confirmation modals:
Use WrappedGameProfile
Use WrappedGameProfile
Prefer
wrappedProfileState over profileState because GameProfile has broken equals/hashCode:Related APIs
EssentialGUI
Create custom GUI screens
Elementa
Learn the Elementa framework
Notifications
Display notifications