docs: update documentation; patch ChangeActiveSlotInteraction

This commit is contained in:
luk
2026-02-03 16:44:06 +00:00
parent f8d7b9a781
commit 49a80ebf77
16 changed files with 531 additions and 472 deletions

View File

@@ -1,6 +1,7 @@
# Hytale Server API Reference (LLM-Optimized)
This document is a comprehensive API reference for the Hytale Server modding system, optimized for LLM consumption. All class names, method signatures, and JSON structures are validated against the actual codebase.
This document is a comprehensive API reference for the Hytale Server modding system, optimized for LLM consumption. All
class names, method signatures, and JSON structures are validated against the actual codebase.
---
@@ -9,7 +10,7 @@ This document is a comprehensive API reference for the Hytale Server modding sys
### Core Classes
| Class | Package |
|-------|---------|
|------------------|--------------------------------------------------------|
| `JavaPlugin` | `com.hypixel.hytale.server.core.plugin.JavaPlugin` |
| `PluginBase` | `com.hypixel.hytale.server.core.plugin.PluginBase` |
| `PluginManifest` | `com.hypixel.hytale.common.plugin.PluginManifest` |
@@ -23,6 +24,7 @@ PluginState: NONE -> SETUP -> START -> ENABLED -> SHUTDOWN -> DISABLED
```
**Lifecycle Methods (exact names):**
- `setup()` - Called during initialization, register components here
- `start()` - Called after setup, plugin becomes active
- `shutdown()` - Called during server stop/plugin disable
@@ -51,7 +53,7 @@ PluginState: NONE -> SETUP -> START -> ENABLED -> SHUTDOWN -> DISABLED
### Registry Methods on PluginBase
| Method | Return Type |
|--------|-------------|
|------------------------------|---------------------------------------|
| `getClientFeatureRegistry()` | `ClientFeatureRegistry` |
| `getCommandRegistry()` | `CommandRegistry` |
| `getEventRegistry()` | `EventRegistry` |
@@ -80,7 +82,7 @@ MyConfig cfg = config.get();
### Core Interfaces (Package: `com.hypixel.hytale.event`)
| Interface | Description |
|-----------|-------------|
|------------------------|-------------------------------------------------|
| `IBaseEvent<KeyType>` | Base event interface |
| `IEvent<KeyType>` | Synchronous event, extends IBaseEvent |
| `IAsyncEvent<KeyType>` | Async event, extends IBaseEvent |
@@ -100,6 +102,7 @@ LAST = (short)21844 // Runs last
### EventRegistry Methods (IEventRegistry interface)
**Sync Registration:**
```java
// Without key (Void key)
EventRegistration register(Class<? super EventType> eventClass, Consumer<EventType> consumer)
@@ -111,17 +114,20 @@ EventRegistration register(EventPriority priority, Class<? super EventType> even
```
**Global Registration (receives all keys):**
```java
EventRegistration registerGlobal(Class<? super EventType> eventClass, Consumer<EventType> consumer)
EventRegistration registerGlobal(EventPriority priority, Class<? super EventType> eventClass, Consumer<EventType> consumer)
```
**Unhandled Registration (when no other handler processed):**
```java
EventRegistration registerUnhandled(Class<? super EventType> eventClass, Consumer<EventType> consumer)
```
**Async Registration:**
```java
EventRegistration registerAsync(Class<? super EventType> eventClass, Function<CompletableFuture<EventType>, CompletableFuture<EventType>> function)
EventRegistration registerAsyncGlobal(...)
@@ -131,11 +137,13 @@ EventRegistration registerAsyncUnhandled(...)
### Key Event Classes
**Server Events (`com.hypixel.hytale.server.core.event.events`):**
- `BootEvent` - IEvent<Void>
- `ShutdownEvent` - IEvent<Void>
- `PrepareUniverseEvent` - IEvent<Void>
**Player Events (`...event.events.player`):**
- `PlayerConnectEvent` - IEvent<Void>
- `PlayerSetupConnectEvent` - IEvent<Void>, ICancellable
- `PlayerDisconnectEvent` - PlayerRefEvent<Void>
@@ -146,12 +154,14 @@ EventRegistration registerAsyncUnhandled(...)
- `DrainPlayerFromWorldEvent` - IEvent<String>
**World Events (`...universe.world.events`):**
- `AddWorldEvent` - WorldEvent, ICancellable
- `RemoveWorldEvent` - WorldEvent, ICancellable
- `StartWorldEvent` - WorldEvent
- `AllWorldsLoadedEvent` - IEvent<Void>
**ECS Events (`...event.events.ecs`):**
- `BreakBlockEvent` - CancellableEcsEvent
- `PlaceBlockEvent` - CancellableEcsEvent
- `UseBlockEvent` - EcsEvent (with nested `Pre` implementing ICancellableEcsEvent)
@@ -165,7 +175,7 @@ EventRegistration registerAsyncUnhandled(...)
### Core Classes (Package: `com.hypixel.hytale.server.core.command.system`)
| Class | Description |
|-------|-------------|
|-----------------------------|--------------------------------------------|
| `AbstractCommand` | Base command class |
| `CommandRegistry` | Plugin command registration |
| `CommandContext` | Execution context |
@@ -232,7 +242,7 @@ ArgTypes.forEnum(String name, Class<E> enumClass) // Create enum type
### Core Classes (Package: `com.hypixel.hytale.component`)
| Class | Description |
|-------|-------------|
|------------------------------|------------------------------------------|
| `Component<ECS_TYPE>` | Base component interface |
| `ComponentRegistry` | Component type registration |
| `ComponentType<ECS_TYPE, T>` | Registered component type |
@@ -264,33 +274,39 @@ void registerSystem(ISystem<EntityStore> system)
### Key Built-in Components
**Transform/Position:**
- `TransformComponent` - Position (Vector3d) and rotation (Vector3f)
- `HeadRotation` - Head rotation angles
- `EntityScaleComponent` - Scale modifier
**Physics:**
- `Velocity` - Velocity vector
- `BoundingBox` - Collision box
- `CollisionResultComponent` - Collision results
- `MovementStatesComponent` - Movement flags (onGround, swimming, etc.)
**Identity:**
- `UUIDComponent` - Unique identifier
- `NetworkId` - Network sync ID
- `DisplayNameComponent` - Display name
**Visual:**
- `ModelComponent` - 3D model reference
- `ActiveAnimationComponent` - Current animations
- `DynamicLight` - Dynamic lighting
**State Flags:**
- `Invulnerable` - Immune to damage
- `Intangible` - Non-collidable
- `Interactable` - Can be interacted with
- `Frozen` - Frozen state
**Player-specific:**
- `Player` - Core player component
- `PlayerRef` - Network connection reference
- `ChunkTracker` - Loaded chunks tracking
@@ -324,7 +340,7 @@ Ref<EntityStore> ref = store.addEntity(holder, AddReason.SPAWN);
### Page System Classes
| Class | Package |
|-------|---------|
|------------------------------|----------------------------------------------------------------------------|
| `CustomUIPage` | `com.hypixel.hytale.server.core.entity.entities.player.pages.CustomUIPage` |
| `BasicCustomUIPage` | Same package - no event data parsing |
| `InteractiveCustomUIPage<T>` | Same package - typed event handling |
@@ -438,7 +454,7 @@ player.getPageManager().openCustomPage(ref, store, new MyPage(playerRef));
### Window System
| Class | Package |
|-------|---------|
|-------------------------------------------|------------------------------------------------------------------------|
| `Window` | `com.hypixel.hytale.server.core.entity.entities.player.windows.Window` |
| `WindowManager` | Same package |
| `ContainerWindow`, `CraftingWindow`, etc. | Same package |
@@ -457,7 +473,7 @@ DiagramCrafting(3), StructuralCrafting(4), Processing(5), Memories(6)
### Core Classes (Package: `com.hypixel.hytale.codec`)
| Class | Description |
|-------|-------------|
|-------------------|----------------------|
| `Codec<T>` | Base codec interface |
| `BuilderCodec<T>` | Builder-based codec |
| `KeyedCodec<T>` | Key-value codec |
@@ -504,7 +520,7 @@ Codec<MyEnum> ENUM = Codec.enumCodec(MyEnum.class);
### Core Classes
| Class | Package |
|-------|---------|
|---------------------|-------------------------------------------------------|
| `JsonAsset<K>` | `com.hypixel.hytale.assetstore.JsonAsset` |
| `AssetStore<K,T,M>` | `com.hypixel.hytale.assetstore.AssetStore` |
| `AssetRegistry` | `com.hypixel.hytale.server.core.plugin.AssetRegistry` |
@@ -512,30 +528,36 @@ Codec<MyEnum> ENUM = Codec.enumCodec(MyEnum.class);
### Key Asset Types (Package: `com.hypixel.hytale.server.core.asset.type`)
**Blocks:**
- `BlockType` - blocktype.config.BlockType
- `BlockSet` - blockset.config.BlockSet
- `BlockSoundSet` - blocksound.config.BlockSoundSet
**Items:**
- `Item` - item.config.Item
- `ItemCategory` - item.config.ItemCategory
- `CraftingRecipe` - item.config.CraftingRecipe
**Visual:**
- `ModelAsset` - model.config.ModelAsset
- `ParticleSystem` - particle.config.ParticleSystem
- `EntityEffect` - entityeffect.config.EntityEffect
**Audio:**
- `SoundEvent` - soundevent.config.SoundEvent
- `SoundSet` - soundset.config.SoundSet
**Environment:**
- `Environment` - environment.config.Environment
- `Weather` - weather.config.Weather
- `Fluid` - fluid.Fluid
**Gameplay:**
- `Projectile` - projectile.config.Projectile
- `GameplayConfig` - gameplay.GameplayConfig
@@ -557,7 +579,7 @@ Codec<MyEnum> ENUM = Codec.enumCodec(MyEnum.class);
### Core Classes
| Class | Package |
|-------|---------|
|---------------|---------------------------------------------------------------------|
| `Universe` | `com.hypixel.hytale.server.core.universe.Universe` |
| `World` | `com.hypixel.hytale.server.core.universe.world.World` |
| `EntityStore` | `com.hypixel.hytale.server.core.universe.world.storage.EntityStore` |
@@ -591,7 +613,7 @@ boolean paused = world.isPaused();
### Core Classes (Package: `com.hypixel.hytale.server.npc`)
| Class | Description |
|-------|-------------|
|---------------|--------------------------------------------|
| `NPCEntity` | entities.NPCEntity - NPC entity class |
| `Role` | role.Role - Behavior definition |
| `Instruction` | instructions.Instruction - Behavior action |
@@ -611,7 +633,7 @@ void playAnimation(...)
### Flock System (Package: `com.hypixel.hytale.server.flock`)
| Component | Description |
|-----------|-------------|
|-------------------|---------------------------|
| `Flock` | Flock leader/group |
| `FlockMembership` | Entity's flock membership |
@@ -622,7 +644,7 @@ void playAnimation(...)
### Packet System (Package: `com.hypixel.hytale.protocol`)
| Class | Description |
|-------|-------------|
|------------------|--------------------------|
| `Packet` | Base packet interface |
| `PacketRegistry` | Packet type registration |
@@ -640,7 +662,7 @@ void playAnimation(...)
### UI Packets
| Packet | ID | Direction |
|--------|-----|-----------|
|-------------------|-----|-----------|
| `SetPage` | 216 | S->C |
| `CustomHud` | 217 | S->C |
| `CustomPage` | 218 | S->C |
@@ -649,7 +671,7 @@ void playAnimation(...)
### Window Packets
| Packet | ID | Direction |
|--------|-----|-----------|
|--------------------|-----|-----------|
| `OpenWindow` | 200 | S->C |
| `UpdateWindow` | 201 | S->C |
| `CloseWindow` | 202 | S->C |
@@ -724,23 +746,29 @@ Place JAR in `earlyplugins/` directory.
### EntityStore Components (130+)
**Transform:** TransformComponent, HeadRotation, PositionDataComponent, EntityScaleComponent, RotateObjectComponent, SnapshotBuffer
**Transform:** TransformComponent, HeadRotation, PositionDataComponent, EntityScaleComponent, RotateObjectComponent,
SnapshotBuffer
**Physics:** Velocity, PhysicsValues, BoundingBox, CollisionResultComponent, KnockbackComponent, MovementStatesComponent, HitboxCollision, Repulsion
**Physics:** Velocity, PhysicsValues, BoundingBox, CollisionResultComponent, KnockbackComponent,
MovementStatesComponent, HitboxCollision, Repulsion
**Player:** Player, MovementManager, CameraManager, ChunkTracker, PlayerInput, PlayerSettings, PlayerSkinComponent, PlayerRef
**Player:** Player, MovementManager, CameraManager, ChunkTracker, PlayerInput, PlayerSettings, PlayerSkinComponent,
PlayerRef
**NPC:** NPCEntity, ValueStore, StateEvaluator, StepComponent, Timers, FailedSpawnComponent
**Combat:** DamageDataComponent, DeathComponent, DeferredCorpseRemoval, CombatActionEvaluator, TargetMemory, DamageMemory
**Combat:** DamageDataComponent, DeathComponent, DeferredCorpseRemoval, CombatActionEvaluator, TargetMemory,
DamageMemory
**Visual:** ModelComponent, PersistentModel, PropComponent, DisplayNameComponent, ActiveAnimationComponent, DynamicLight, Nameplate
**Visual:** ModelComponent, PersistentModel, PropComponent, DisplayNameComponent, ActiveAnimationComponent,
DynamicLight, Nameplate
**Audio:** AudioComponent, MovementAudioComponent
**Identity:** UUIDComponent, NetworkId, EntityViewer, Visible, PersistentRefCount
**State Flags:** Frozen, Intangible, Invulnerable, Interactable, RespondToHit, HiddenFromAdventurePlayers, NewSpawnComponent, FromPrefab, FromWorldGen, DespawnComponent
**State Flags:** Frozen, Intangible, Invulnerable, Interactable, RespondToHit, HiddenFromAdventurePlayers,
NewSpawnComponent, FromPrefab, FromWorldGen, DespawnComponent
**Teleport:** Teleport, PendingTeleport, TeleportHistory, WarpComponent
@@ -762,7 +790,8 @@ Place JAR in `earlyplugins/` directory.
### ChunkStore Components (25+)
**Structure:** BlockChunk, BlockComponentChunk, EntityChunk, ChunkColumn, ChunkSection, BlockSection, FluidSection, EnvironmentChunk
**Structure:** BlockChunk, BlockComponentChunk, EntityChunk, ChunkColumn, ChunkSection, BlockSection, FluidSection,
EnvironmentChunk
**Block State:** BlockState, RespawnBlock, LaunchPad, BlockMapMarker

View File

@@ -2,14 +2,15 @@
## Overview
The Hytale Server provides a comprehensive modding API that allows developers to extend and customize the game. This documentation covers the essential systems and APIs available for mod development.
The Hytale Server provides a comprehensive modding API that allows developers to extend and customize the game. This
documentation covers the essential systems and APIs available for mod development.
## Architecture Overview
The server is built on several core systems:
| System | Purpose |
|--------|---------|
|-------------------------------|----------------------------------------------------------------|
| Plugin System | Mod loading, lifecycle management, and dependency resolution |
| Entity Component System (ECS) | High-performance entity management with components and systems |
| Event System | Prioritized event dispatching with sync/async support |
@@ -122,7 +123,7 @@ Plugins go through the following states:
Your plugin has access to several registries for registration:
| Registry | Access Method | Purpose |
|----------|---------------|---------|
|-----------------------|------------------------------|-------------------------------|
| CommandRegistry | `getCommandRegistry()` | Register custom commands |
| EventRegistry | `getEventRegistry()` | Register event listeners |
| EntityRegistry | `getEntityRegistry()` | Register custom entity types |

View File

@@ -37,7 +37,7 @@ The `manifest.json` file must be placed at the root of your JAR:
### Manifest Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
|------------------------|----------|----------|--------------------------------------------------|
| `Group` | String | Yes | Maven-style group ID (e.g., `com.example`) |
| `Name` | String | Yes | Plugin name (unique identifier within group) |
| `Version` | String | Yes | Semantic version (e.g., `1.0.0`) |
@@ -55,6 +55,7 @@ The `manifest.json` file must be placed at the root of your JAR:
### Plugin Identifier
Plugins are identified by `Group:Name` format (e.g., `com.example:MyPlugin`). This identifier is used for:
- Dependency resolution
- Permission namespacing (`com.example.myplugin.*`)
- Configuration keys
@@ -122,7 +123,7 @@ NONE -> SETUP -> START -> ENABLED -> SHUTDOWN -> DISABLED
```
| State | Description |
|-------|-------------|
|------------|--------------------------------------------------|
| `NONE` | Initial state before any lifecycle methods |
| `SETUP` | `setup()` is executing; register components here |
| `START` | `start()` is executing; plugin becoming active |
@@ -267,6 +268,7 @@ Commands registered by your plugin will have permissions under:
```
For example, if your plugin is `com.example:MyPlugin` and you register a command `spawn`:
- Base permission: `com.example.myplugin`
- Command permission: `com.example.myplugin.command.spawn`

View File

@@ -1,6 +1,7 @@
# Event System
The Hytale event system provides a powerful mechanism for plugins to react to game events. It supports both synchronous and asynchronous events with priority-based dispatching.
The Hytale event system provides a powerful mechanism for plugins to react to game events. It supports both synchronous
and asynchronous events with priority-based dispatching.
## Event Architecture
@@ -17,7 +18,7 @@ ICancellable // Mixin interface for cancellable events
### Key Classes
| Class | Description |
|-------|-------------|
|------------------------|--------------------------------------------|
| `IEvent<K>` | Synchronous event interface |
| `IAsyncEvent<K>` | Asynchronous event interface |
| `ICancellable` | Interface for events that can be cancelled |
@@ -30,14 +31,15 @@ ICancellable // Mixin interface for cancellable events
Events are dispatched to listeners in priority order:
| Priority | Value | Description |
|----------|-------|-------------|
|----------|--------|-------------------------------|
| `FIRST` | -21844 | Runs first, before all others |
| `EARLY` | -10922 | Runs early, after FIRST |
| `NORMAL` | 0 | Default priority |
| `LATE` | 10922 | Runs late, after NORMAL |
| `LAST` | 21844 | Runs last, after all others |
Lower values run first. Use `FIRST` sparingly - typically for monitoring/logging. Use `LAST` for final processing after other plugins have had a chance to modify the event.
Lower values run first. Use `FIRST` sparingly - typically for monitoring/logging. Use `LAST` for final processing after
other plugins have had a chance to modify the event.
## Registering Event Listeners
@@ -149,7 +151,7 @@ getEventRegistry().register(EventPriority.LAST, PlayerInteractEvent.class, event
### Server Lifecycle Events
| Event | Description |
|-------|-------------|
|------------------------|-------------------------|
| `BootEvent` | Server boot complete |
| `ShutdownEvent` | Server shutting down |
| `PrepareUniverseEvent` | Universe initialization |
@@ -157,7 +159,7 @@ getEventRegistry().register(EventPriority.LAST, PlayerInteractEvent.class, event
### Player Events
| Event | Description |
|-------|-------------|
|-----------------------------|----------------------------------|
| `PlayerConnectEvent` | Player connected to server |
| `PlayerDisconnectEvent` | Player disconnected |
| `AddPlayerToWorldEvent` | Player added to a world |
@@ -168,14 +170,14 @@ getEventRegistry().register(EventPriority.LAST, PlayerInteractEvent.class, event
### Entity Events
| Event | Description |
|-------|-------------|
|-----------------------------|-----------------------------|
| `EntityRemoveEvent` | Entity removed from world |
| `LivingEntityUseBlockEvent` | Living entity using a block |
### World Events
| Event | Description |
|-------|-------------|
|------------------------|-----------------------------|
| `AddWorldEvent` | World added to universe |
| `RemoveWorldEvent` | World removed |
| `StartWorldEvent` | World started |
@@ -184,7 +186,7 @@ getEventRegistry().register(EventPriority.LAST, PlayerInteractEvent.class, event
### ECS Events
| Event | Description |
|-------|-------------|
|---------------------|-------------------|
| `UseBlockEvent` | Block usage event |
| `DiscoverZoneEvent` | Zone discovery |

View File

@@ -4,7 +4,8 @@ The Hytale command system allows plugins to register custom commands that can be
## Overview
Commands are defined by extending `AbstractCommand` and registered through the plugin's `CommandRegistry`. The system supports:
Commands are defined by extending `AbstractCommand` and registered through the plugin's `CommandRegistry`. The system
supports:
- Required and optional arguments
- Subcommands
@@ -270,6 +271,7 @@ Commands automatically receive permissions based on the plugin's base permission
```
For example, if your plugin is `com.example:MyPlugin` and command is `spawn`:
- Permission: `com.example.myplugin.command.spawn`
### Custom Permissions
@@ -304,7 +306,7 @@ public void execute(CommandContext context, Arguments args) {
Commands can be executed by different sender types:
| Sender Type | Description |
|-------------|-------------|
|----------------|-------------------------------|
| `Player` | In-game player |
| `Console` | Server console |
| `CommandBlock` | Command block (if applicable) |

View File

@@ -1,6 +1,7 @@
# Entity Component System (ECS)
The Hytale server uses an Entity Component System architecture for managing game entities. This provides high performance and flexibility for handling large numbers of entities with varied behaviors.
The Hytale server uses an Entity Component System architecture for managing game entities. This provides high
performance and flexibility for handling large numbers of entities with varied behaviors.
## ECS Concepts
@@ -17,7 +18,7 @@ The ECS pattern separates data (Components) from behavior (Systems):
### Key Classes
| Class | Description |
|-------|-------------|
|---------------------|--------------------------------------|
| `Component<S>` | Base component interface |
| `ComponentRegistry` | Central registry for component types |
| `Store` | ECS data storage |
@@ -81,7 +82,7 @@ public class HealthComponent implements Component<EntityStore> {
The server provides several built-in components in `EntityStore.REGISTRY`:
| Component | Description |
|-----------|-------------|
|--------------------------|-----------------------------------|
| `TransformComponent` | Position, rotation, and scale |
| `UUIDComponent` | Unique entity identifier |
| `ModelComponent` | Visual model reference |

View File

@@ -1,6 +1,7 @@
# World Management
The Hytale server supports multiple worlds within a single universe. This guide covers world management, chunk handling, and related systems.
The Hytale server supports multiple worlds within a single universe. This guide covers world management, chunk handling,
and related systems.
## Universe

View File

@@ -1,6 +1,7 @@
# Networking and Protocol
The Hytale server uses a packet-based networking system for client-server communication. This guide covers the protocol system, packet types, and how to work with networking in your mods.
The Hytale server uses a packet-based networking system for client-server communication. This guide covers the protocol
system, packet types, and how to work with networking in your mods.
## Overview
@@ -16,7 +17,7 @@ The networking layer is built on QUIC protocol and handles:
## Key Components
| Component | Description |
|-----------|-------------|
|------------------|--------------------------------------------------|
| `Packet` | Base interface for all packets |
| `PacketRegistry` | Central packet type registration |
| `PacketHandler` | Manages client connections and packet processing |
@@ -27,7 +28,7 @@ The networking layer is built on QUIC protocol and handles:
Packets are organized into categories in `com.hypixel.hytale.protocol.packets`:
| Category | Description |
|----------|-------------|
|-----------------|--------------------------------------------------|
| `connection/` | Connection lifecycle (connect, disconnect, ping) |
| `auth/` | Authentication and session management |
| `player/` | Player-specific packets (movement, actions) |
@@ -164,7 +165,7 @@ for (Player player : Universe.get().getPlayers()) {
### Connection Packets
| Packet | Direction | Description |
|--------|-----------|-------------|
|----------------------------|-----------|-----------------------------------|
| `ConnectionRequestPacket` | C->S | Client requests connection |
| `ConnectionResponsePacket` | S->C | Server accepts/rejects connection |
| `DisconnectPacket` | Both | Connection termination |
@@ -173,7 +174,7 @@ for (Player player : Universe.get().getPlayers()) {
### Player Packets
| Packet | Direction | Description |
|--------|-----------|-------------|
|------------------------|-----------|----------------------------------|
| `PlayerPositionPacket` | Both | Position update |
| `PlayerInputPacket` | C->S | Player input (movement, actions) |
| `PlayerActionPacket` | C->S | Player actions |
@@ -181,7 +182,7 @@ for (Player player : Universe.get().getPlayers()) {
### Entity Packets
| Packet | Direction | Description |
|--------|-----------|-------------|
|----------------------|-----------|---------------------|
| `EntitySpawnPacket` | S->C | Entity creation |
| `EntityUpdatePacket` | S->C | Entity state update |
| `EntityRemovePacket` | S->C | Entity removal |
@@ -190,7 +191,7 @@ for (Player player : Universe.get().getPlayers()) {
### World Packets
| Packet | Direction | Description |
|--------|-----------|-------------|
|---------------------|-----------|---------------------|
| `ChunkDataPacket` | S->C | Chunk data transfer |
| `BlockChangePacket` | S->C | Block state change |
| `WorldTimePacket` | S->C | World time sync |
@@ -198,7 +199,7 @@ for (Player player : Universe.get().getPlayers()) {
### Inventory Packets
| Packet | Direction | Description |
|--------|-----------|-------------|
|-------------------------|-----------|--------------------------|
| `InventoryUpdatePacket` | S->C | Inventory contents |
| `SlotChangePacket` | Both | Single slot update |
| `ItemPickupPacket` | S->C | Item pickup notification |
@@ -285,7 +286,7 @@ player.closeUI();
### UI Packets
| Packet | Direction | Description |
|--------|-----------|-------------|
|-----------------------|-----------|-------------------------------|
| `UIOpenPacket` | S->C | Open a UI screen |
| `UIClosePacket` | S->C | Close UI |
| `UIUpdatePacket` | S->C | Update UI data |

View File

@@ -1,6 +1,7 @@
# Asset System
The Hytale asset system manages game assets including blocks, items, models, sounds, particles, and more. This guide covers how to work with assets and create custom content.
The Hytale asset system manages game assets including blocks, items, models, sounds, particles, and more. This guide
covers how to work with assets and create custom content.
## Overview
@@ -39,7 +40,7 @@ Assets are loaded from:
The server supports many built-in asset types located in `server/core/asset/type/`:
| Asset Type | Description |
|------------|-------------|
|--------------------|---------------------------------------|
| `BlockType` | Block definitions (stone, dirt, etc.) |
| `ItemType` | Item definitions |
| `ModelAsset` | 3D model definitions |

View File

@@ -1,6 +1,7 @@
# Configuration System
The Hytale server provides a robust configuration system for both server settings and plugin configurations. This guide covers how to use and extend the configuration system.
The Hytale server provides a robust configuration system for both server settings and plugin configurations. This guide
covers how to use and extend the configuration system.
## Server Configuration

View File

@@ -1,6 +1,7 @@
# Codec and Serialization System
The Hytale server uses a powerful codec system for data serialization and deserialization. This system is used throughout the codebase for configuration, network packets, asset definitions, and data persistence.
The Hytale server uses a powerful codec system for data serialization and deserialization. This system is used
throughout the codebase for configuration, network packets, asset definitions, and data persistence.
## Overview
@@ -25,7 +26,8 @@ public interface Codec<T> {
### DataInput/DataOutput
Codecs work with abstract `DataInput` and `DataOutput` interfaces that can represent different formats (JSON, BSON, etc.).
Codecs work with abstract `DataInput` and `DataOutput` interfaces that can represent different formats (JSON, BSON,
etc.).
## Primitive Codecs

View File

@@ -1,6 +1,7 @@
# Utilities and Common APIs
The Hytale server provides a comprehensive set of utility classes and common APIs. This guide covers the most useful utilities for mod development.
The Hytale server provides a comprehensive set of utility classes and common APIs. This guide covers the most useful
utilities for mod development.
## Math Utilities

View File

@@ -1,6 +1,7 @@
# Early Plugin System (Class Transformation)
The Early Plugin System allows advanced mods to transform Java bytecode before classes are loaded. This is a powerful feature for core modifications that cannot be achieved through the standard plugin API.
The Early Plugin System allows advanced mods to transform Java bytecode before classes are loaded. This is a powerful
feature for core modifications that cannot be achieved through the standard plugin API.
## Overview
@@ -23,6 +24,7 @@ Early plugins are appropriate when:
- Standard plugin APIs don't provide sufficient access
**Prefer standard plugins** when possible. Early plugins:
- Are harder to maintain across server updates
- May conflict with other early plugins
- Can introduce hard-to-debug issues
@@ -224,7 +226,7 @@ public int priority() {
```
| Priority | Use Case |
|----------|----------|
|------------|-----------------------------------|
| 1000+ | Critical patches (security fixes) |
| 100-999 | Core modifications |
| 0 | Standard transformations |

View File

@@ -1,6 +1,7 @@
# UI System
The Hytale server implements a server-authoritative UI system with two main subsystems: Pages (full-screen UI) and Windows (inventory-style containers).
The Hytale server implements a server-authoritative UI system with two main subsystems: Pages (full-screen UI) and
Windows (inventory-style containers).
## Architecture Overview
@@ -20,7 +21,7 @@ UI System
### Core Classes
| Class | Package | Description |
|-------|---------|-------------|
|------------------------------|---------------------------------------------------------------|-----------------------------------------|
| `CustomUIPage` | `com.hypixel.hytale.server.core.entity.entities.player.pages` | Abstract base for all custom pages |
| `BasicCustomUIPage` | Same | Simple pages without event data parsing |
| `InteractiveCustomUIPage<T>` | Same | Pages with typed event handling |
@@ -236,6 +237,7 @@ Value<Integer> border = Value.ref("Pages/Dialog.ui", "BorderWidth");
### Encoding Format
References are encoded in JSON as:
```json
{
"$Document": "Common/Button.ui",
@@ -509,7 +511,7 @@ public enum HudComponent {
### Page Packets
| Packet | ID | Direction | Description |
|--------|-----|-----------|-------------|
|-------------------|-----|-----------|-------------------|
| `SetPage` | 216 | S->C | Set built-in page |
| `CustomHud` | 217 | S->C | Update HUD |
| `CustomPage` | 218 | S->C | Send custom page |
@@ -518,7 +520,7 @@ public enum HudComponent {
### Window Packets
| Packet | ID | Direction | Description |
|--------|-----|-----------|-------------|
|--------------------|-----|-----------|----------------|
| `OpenWindow` | 200 | S->C | Open window |
| `UpdateWindow` | 201 | S->C | Update window |
| `CloseWindow` | 202 | S->C | Close window |
@@ -528,7 +530,7 @@ public enum HudComponent {
## Known UI Documents
| Path | Purpose |
|------|---------|
|----------------------------|---------------------|
| `Pages/DialogPage.ui` | Dialog/conversation |
| `Pages/BarterPage.ui` | Trading interface |
| `Pages/ShopPage.ui` | Shop interface |

View File

@@ -1,10 +1,12 @@
# 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.
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](00-llm-reference.md)** - Complete API reference with exact class names, method signatures, and JSON structures. Use this for quick lookups.
**[LLM-Optimized API Reference](00-llm-reference.md)** - Complete API reference with exact class names, method
signatures, and JSON structures. Use this for quick lookups.
## Documentation Index
@@ -46,6 +48,7 @@ Welcome to the Hytale Server modding documentation. This guide provides comprehe
### Creating Your First Mod
1. Create a `manifest.json`:
```json
{
"Group": "com.example",
@@ -56,6 +59,7 @@ Welcome to the Hytale Server modding documentation. This guide provides comprehe
```
2. Create your main class:
```java
public class MyMod extends JavaPlugin {
public MyMod(JavaPluginInit init) {
@@ -86,7 +90,7 @@ NONE -> SETUP -> START -> ENABLED -> SHUTDOWN -> DISABLED
### Available Registries
| Registry | Purpose |
|----------|---------|
|-------------------|-----------------|
| `CommandRegistry` | Custom commands |
| `EventRegistry` | Event listeners |
| `EntityRegistry` | Custom entities |
@@ -96,7 +100,7 @@ NONE -> SETUP -> START -> ENABLED -> SHUTDOWN -> DISABLED
### Event Priority
| Priority | Value | Use Case |
|----------|-------|----------|
|----------|--------|--------------------|
| FIRST | -21844 | Monitoring/logging |
| EARLY | -10922 | Pre-processing |
| NORMAL | 0 | Standard handling |
@@ -120,6 +124,7 @@ com.hypixel.hytale/
## API Highlights
### Events
```java
getEventRegistry().register(PlayerConnectEvent.class, event -> {
Player player = event.getPlayer();
@@ -128,6 +133,7 @@ getEventRegistry().register(PlayerConnectEvent.class, event -> {
```
### Commands
```java
public class MyCommand extends AbstractCommand {
public MyCommand() {
@@ -144,6 +150,7 @@ public class MyCommand extends AbstractCommand {
```
### Entities
```java
public class CustomEntity extends Entity {
public CustomEntity(World world) {
@@ -156,6 +163,7 @@ getEntityRegistry().register("custom", CustomEntity.class, CustomEntity::new);
```
### Configuration
```java
public static final Codec<MyConfig> CODEC = BuilderCodec.of(MyConfig::new)
.with("enabled", Codec.BOOLEAN, c -> c.enabled, true)
@@ -177,6 +185,7 @@ public static final Codec<MyConfig> CODEC = BuilderCodec.of(MyConfig::new)
## Support
For questions and support:
- Check the [Hytale modding forums](#)
- Join the [Discord community](#)
- Report issues on [GitHub](#)
@@ -187,4 +196,5 @@ Contributions to this documentation are welcome. Please submit pull requests wit
---
*This documentation is for Hytale Server modding. For official Hytale information, visit [hytale.com](https://hytale.com).*
*This documentation is for Hytale Server modding. For official Hytale information,
visit [hytale.com](https://hytale.com).*

View File

@@ -14,6 +14,7 @@ import com.hypixel.hytale.server.core.entity.EntityUtils;
import com.hypixel.hytale.server.core.entity.InteractionContext;
import com.hypixel.hytale.server.core.entity.InteractionManager;
import com.hypixel.hytale.server.core.entity.LivingEntity;
import com.hypixel.hytale.server.core.event.events.ecs.ChangeHotbarSlotEvent;
import com.hypixel.hytale.server.core.meta.DynamicMetaStore;
import com.hypixel.hytale.server.core.meta.MetaKey;
import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
@@ -21,7 +22,7 @@ import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Int
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.data.Collector;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.event.events.ecs.ChangeHotbarSlotEvent;
import javax.annotation.Nonnull;
public class ChangeActiveSlotInteraction extends Interaction {
@@ -83,14 +84,14 @@ public class ChangeActiveSlotInteraction extends Interaction {
DynamicMetaStore var15 = context.getMetaStore();
byte slot;
if (this.targetSlot == Integer.MIN_VALUE) {
slot = ((Number)var15.getMetaObject(TARGET_SLOT)).byteValue();
slot = ((Number) var15.getMetaObject(TARGET_SLOT)).byteValue();
} else {
if (livingEntity.getInventory().getActiveHotbarSlot() == this.targetSlot) {
context.getState().state = InteractionState.Finished;
return;
}
slot = (byte)this.targetSlot;
slot = (byte) this.targetSlot;
var15.putMetaObject(TARGET_SLOT, Integer.valueOf(slot));
}
@@ -104,7 +105,7 @@ public class ChangeActiveSlotInteraction extends Interaction {
slot = event.getNewSlot();
livingEntity.getInventory().setActiveHotbarSlot(slot);
Runnable action = (Runnable)var15.removeMetaObject(PLACE_MOVED_ITEM);
Runnable action = (Runnable) var15.removeMetaObject(PLACE_MOVED_ITEM);
if (action != null) {
action.run();
}
@@ -154,7 +155,7 @@ public class ChangeActiveSlotInteraction extends Interaction {
@Override
protected void configurePacket(com.hypixel.hytale.protocol.Interaction packet) {
super.configurePacket(packet);
com.hypixel.hytale.protocol.ChangeActiveSlotInteraction p = (com.hypixel.hytale.protocol.ChangeActiveSlotInteraction)packet;
com.hypixel.hytale.protocol.ChangeActiveSlotInteraction p = (com.hypixel.hytale.protocol.ChangeActiveSlotInteraction) packet;
p.targetSlot = this.targetSlot;
}