2.0 KiB
title, type, weight
| title | type | weight |
|---|---|---|
| Entities | docs | 7 |
Entities are all dynamic objects in the game world - players, creatures, items, and more. Hytale uses an Entity Component System (ECS) architecture.
{{< cards >}} {{< card link="entity-hierarchy" title="Entity Hierarchy" subtitle="Entity → LivingEntity → Player" >}} {{< card link="entity-components" title="Entity Components" subtitle="Transform, BoundingBox, and more" >}} {{< card link="spawning-entities" title="Spawning Entities" subtitle="Create and spawn custom entities" >}} {{< card link="player-api" title="Player API" subtitle="Player-specific methods and data" >}} {{< card link="npc" title="NPC System" subtitle="AI, navigation, and behaviors" >}} {{< card link="spawning" title="Spawning System" subtitle="Markers, beacons, and suppression" >}} {{< card link="flocking-behavior" title="Flocking Behavior" subtitle="NPC group coordination" >}} {{< card link="mounts" title="Mounts" subtitle="Riding entities and vehicles" >}} {{< card link="inventory" title="Inventory" subtitle="Items, containers, and transactions" icon="archive" >}} {{< /cards >}}
Entity Hierarchy
Entity
├── LivingEntity
│ ├── Player
│ └── Creature
└── BlockEntity
Quick Example
getEventRegistry().register(PlayerConnectEvent.class, event -> {
Player player = event.getPlayer();
if (player != null) {
// Get position via TransformComponent
TransformComponent transform = player.getTransformComponent();
Vector3d pos = transform.getPosition();
// Get world
World world = player.getWorld();
// Send message (requires Message object)
player.sendMessage(Message.raw("Welcome at " + pos.toString()));
}
});
{{< callout type="info" >}}
event.getPlayer() may return null if the player hasn't fully loaded yet. Always check for null. For position access, getTransformComponent() is deprecated - prefer ECS component access in new code.
{{< /callout >}}