---
name: hytale-ui
description: Custom user interface and HUD creation for Hytale. Covers NoesisGUI framework, custom HUD overlays, menus, inventory screens, and interactive UI elements. Use when creating custom interfaces, status displays, admin panels, or any visual UI components.
---
# Hytale UI & HUD
Create custom user interfaces and HUD elements for your Hytale mods.
## UI Framework
Hytale uses **NoesisGUI** - a powerful XAML-based UI framework.
## UI Types
| Type | Use For | Examples |
|------|---------|----------|
| **HUD** | Always-on-screen | Health, mana, minimap |
| **Overlay** | Temporary display | Notifications, titles |
| **Screen** | Full interface | Inventory, menus |
| **Dialog** | Popups | Confirmations, NPC chat |
| **Widget** | Reusable components | Buttons, bars, icons |
---
## Folder Structure
```
MyPack/
└── Common/
└── UI/
├── hud/
│ ├── my_hud.xaml
│ └── my_hud.xaml.cs
├── screens/
│ ├── custom_menu.xaml
│ └── custom_inventory.xaml
└── textures/
├── button_bg.png
└── icons/
```
---
## Basic HUD Element
### XAML Definition
```xml
```
### JSON Registration
```json
{
"hudId": "mymod:mana_bar",
"xaml": "ui/hud/mana_bar.xaml",
"position": "top-left",
"offset": { "x": 10, "y": 50 }
}
```
---
## HUD Positions
| Position | Description |
|----------|-------------|
| `top-left` | Upper left corner |
| `top-center` | Upper center |
| `top-right` | Upper right corner |
| `center` | Screen center |
| `bottom-left` | Lower left |
| `bottom-center` | Lower center |
| `bottom-right` | Lower right |
---
## Common UI Components
### Progress Bar
```xml
```
### Icon Button
```xml
```
### Tooltip
```xml
```
---
## Custom Screens
### Menu Screen
```xml
```
### Inventory Grid
```xml
```
---
## Plugin Integration
### Show/Hide HUD
```java
// Show custom HUD
player.showHUD("mymod:mana_bar");
// Hide HUD
player.hideHUD("mymod:mana_bar");
// Check if visible
boolean visible = player.isHUDVisible("mymod:mana_bar");
```
### Update HUD Data
```java
// Update bound data
player.setHUDData("mymod:mana_bar", "mana", currentMana);
player.setHUDData("mymod:mana_bar", "maxMana", maxMana);
// Or with object
ManaData data = new ManaData(currentMana, maxMana);
player.setHUDData("mymod:mana_bar", data);
```
### Open Screens
```java
// Open custom screen
player.openScreen("mymod:custom_menu");
// Open with data
player.openScreen("mymod:shop", shopInventory);
// Close current screen
player.closeScreen();
```
### Notifications
```java
// Show toast notification
player.showNotification("Achievement Unlocked!", 5.0f);
// Show title
player.showTitle("Boss Defeated!", "You earned 500 XP", 3.0f);
// Show action bar message
player.showActionBar("Press E to interact");
```
---
## Data Binding
### ViewModel Pattern
```java
public class ManaViewModel {
private int mana;
private int maxMana;
public int getMana() { return mana; }
public void setMana(int value) {
this.mana = value;
notifyPropertyChanged("mana");
notifyPropertyChanged("manaPercent");
}
public double getManaPercent() {
return (double) mana / maxMana * 100;
}
}
```
### In XAML
```xml
```
---
## Styling
### Custom Button Style
```xml
```
### Color Palette
```xml
#4A90D9
#2ECC71
#E74C3C
#2C3E50
#ECF0F1
```
---
## Best Practices
### Do
| Practice | Why |
|----------|-----|
| Use data binding | Automatic updates |
| Consistent styling | Professional look |
| Test all resolutions | Accessibility |
| Provide feedback | User understands |
### Don't
| Mistake | Why Bad |
|---------|---------|
| Too many HUDs | Screen clutter |
| Tiny text | Hard to read |
| No close button | Frustrating |
| Block gameplay | Annoying |
---
## Quick Reference
| Task | How |
|------|-----|
| Create HUD | Define XAML + register JSON |
| Show HUD | `player.showHUD("id")` |
| Update data | `player.setHUDData(...)` |
| Open screen | `player.openScreen("id")` |
| Show notification | `player.showNotification(...)` |
---
## Resources
- **NoesisGUI Docs**: [noesisengine.com](https://www.noesisengine.com/docs)
- **Plugin Development**: See `hytale-plugin-dev` skill
- **NPC Dialogue**: See `hytale-npc-ai` skill