be2834d0ea5cc414189ddfa7dd63963d689b0bda
Hytale Server Modding Documentation
Welcome to the Hytale Server modding documentation. This guide provides comprehensive information for creating mods and extensions for the Hytale Server.
LLM Reference
LLM-Optimized API Reference - Complete API reference with exact class names, method signatures, and JSON structures. Use this for quick lookups.
Documentation Index
Getting Started
- Getting Started - Introduction and first mod tutorial
Core Systems
- Plugin Development - Creating and structuring plugins
- Event System - Handling game events
- Command System - Creating custom commands
- Entity System (ECS) - Working with entities and components
- World Management - Managing worlds and chunks
Communication & Data
- Networking - Network protocol and packet handling
- Asset System - Managing game assets
- Configuration - Plugin and server configuration
- Codec/Serialization - Data serialization framework
Game Systems
- NPC/AI System - Creating and controlling NPCs
- Built-in Modules - Using server modules
UI & Presentation
- UI System - Pages, windows, HUD, and UI commands
Reference
- Utilities - Common utility classes and APIs
- Early Plugin System - Advanced bytecode transformation
Quick Start
Creating Your First Mod
- Create a
manifest.json:
{
"Group": "com.example",
"Name": "MyMod",
"Version": "1.0.0",
"Main": "com.example.MyMod"
}
- Create your main class:
public class MyMod extends JavaPlugin {
public MyMod(JavaPluginInit init) {
super(init);
}
@Override
protected void setup() {
getLogger().info("MyMod loaded!");
}
}
- Build and place in
mods/directory
Key Concepts
Plugin Lifecycle
NONE -> SETUP -> START -> ENABLED -> SHUTDOWN -> DISABLED
- SETUP: Register commands, events, entities
- START: Initialize plugin logic
- SHUTDOWN: Clean up resources
Available Registries
| Registry | Purpose |
|---|---|
CommandRegistry |
Custom commands |
EventRegistry |
Event listeners |
EntityRegistry |
Custom entities |
AssetRegistry |
Custom assets |
TaskRegistry |
Scheduled tasks |
Event Priority
| Priority | Value | Use Case |
|---|---|---|
| FIRST | -21844 | Monitoring/logging |
| EARLY | -10922 | Pre-processing |
| NORMAL | 0 | Standard handling |
| LATE | 10922 | Post-processing |
| LAST | 21844 | Final processing |
Package Structure
com.hypixel.hytale/
├── server/core/ # Core server functionality
├── event/ # Event system
├── component/ # Entity Component System
├── codec/ # Serialization
├── protocol/ # Networking
├── common/ # Utilities
├── math/ # Math utilities
└── builtin/ # Built-in modules
API Highlights
Events
getEventRegistry().register(PlayerConnectEvent.class, event -> {
Player player = event.getPlayer();
player.sendMessage("Welcome!");
});
Commands
public class MyCommand extends AbstractCommand {
public MyCommand() {
super("mycommand", "Description");
withRequiredArg("player", "Target player");
}
@Override
public void execute(CommandContext ctx, Arguments args) {
String player = args.getString("player");
ctx.sendMessage("Hello, " + player);
}
}
Entities
public class CustomEntity extends Entity {
public CustomEntity(World world) {
super(world);
}
}
// Register
getEntityRegistry().register("custom", CustomEntity.class, CustomEntity::new);
Configuration
public static final Codec<MyConfig> CODEC = BuilderCodec.of(MyConfig::new)
.with("enabled", Codec.BOOLEAN, c -> c.enabled, true)
.with("maxCount", Codec.INTEGER, c -> c.maxCount, 100)
.build();
Best Practices
- Register in setup() - All registrations should happen during setup
- Use events - Prefer events over polling
- Respect lifecycle - Don't access other plugins during setup
- Handle errors - Log and handle exceptions gracefully
- Clean up - Release resources in shutdown()
- Use codecs - Serialize data with the codec system
- Namespace assets - Use your mod ID as namespace
- Document - Document your mod's features and configuration
Support
For questions and support:
- Check the Hytale modding forums
- Join the Discord community
- Report issues on GitHub
Contributing
Contributions to this documentation are welcome. Please submit pull requests with improvements or corrections.
This documentation is for Hytale Server modding. For official Hytale information, visit hytale.com.
Description
Languages
Java
100%