Entity
Entity
Section titled “Entity”Package:
com.hypixel.hytale.server.core.entity
public abstract class Entity implements Component<EntityStore>The abstract base class for all entities in the Hytale server. Entity is itself an ECS component — it implements Component<EntityStore>, which means every entity instance is stored as a component on an EntityStore ref. This design allows entity identity, world membership, and lifecycle to be managed uniformly through the ECS.
Subclasses include LivingEntity (entities with health, inventory, and movement) and ultimately Player.
Constants
Section titled “Constants”public static final int UNASSIGNED_ID = -1Sentinel value indicating an entity that has not been assigned a network ID. Entities receive a network ID when loaded into a world and revert to UNASSIGNED_ID when removed.
Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
networkId | int | Network-visible identifier assigned when loaded into a world |
legacyUuid | UUID | Legacy UUID retained for backwards compatibility. Deprecated. |
world | World | The world this entity currently belongs to, or null if unloaded |
reference | Ref<EntityStore> | The ECS ref handle for this entity within its store |
wasRemoved | boolean | Whether this entity has been removed from its world |
Serialization
Section titled “Serialization”public static final BuilderCodec<Entity> CODECA BuilderCodec for serializing and deserializing entity data. Subclasses (e.g., LivingEntity.CODEC, Player.CODEC) extend this codec with their additional fields.
Methods
Section titled “Methods”Lifecycle
Section titled “Lifecycle”public boolean remove()Removes this entity from its world. Returns true if the entity was successfully removed, false if it was already removed or not loaded into a world. After removal, wasRemoved() returns true and the entity’s Ref is invalidated.
public void loadIntoWorld(@Nonnull World world)Loads this entity into the given world. Assigns the entity a network ID and establishes its world reference. Called by the world loading system — plugin code should not call this directly.
public void unloadFromWorld()Unloads this entity from its current world. Clears the world reference and resets the network ID to UNASSIGNED_ID. Called during world unloading or entity transfer.
public boolean wasRemoved()Returns true if this entity has been removed from its world via remove().
Identity
Section titled “Identity”@Deprecated(forRemoval = true)public int getNetworkId()Returns the entity’s network ID. Deprecated — network identity is being replaced by ref-based addressing.
@Nullable@Deprecated(forRemoval = true)public UUID getUuid()Returns the entity’s legacy UUID. Deprecated — use ref-based identity instead.
World Access
Section titled “World Access”@Nullablepublic World getWorld()Returns the world this entity is loaded into, or null if the entity is not currently in a world.
ECS Reference
Section titled “ECS Reference”public void setReference(@Nonnull Ref<EntityStore> reference)Sets the ECS ref handle for this entity. Called by the store when the entity is added. Plugin code should not call this directly.
@Nullablepublic Ref<EntityStore> getReference()Returns the ECS ref handle for this entity, or null if the entity has not been added to a store.
public Holder<EntityStore> toHolder()Creates a Holder snapshot of this entity’s component data. Used for entity transfer between stores or for serialization.
Movement
Section titled “Movement”@Deprecatedpublic void moveTo(@Nonnull Ref<EntityStore> ref, double locX, double locY, double locZ, @Nonnull ComponentAccessor<EntityStore> componentAccessor)Moves this entity to the specified coordinates. Deprecated — movement is now handled through dedicated movement components and systems.
Collision
Section titled “Collision”public boolean isCollidable()Returns whether this entity participates in collision detection. Subclasses override this to control collision behavior.
public boolean isHiddenFromLivingEntity(@Nonnull Ref<EntityStore> ref, @Nonnull Ref<EntityStore> targetRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)Returns whether this entity is hidden from the given living entity. Used by visibility systems to filter entities from a target’s perception (e.g., spectator mode, invisibility effects).
Inner Classes
Section titled “Inner Classes”DefaultAnimations
Section titled “DefaultAnimations”Static inner class containing animation ID helper constants for default entity animations. Provides standardized animation identifiers used across the animation system.
Related Types
Section titled “Related Types”- LivingEntity — extends
Entitywith health, inventory, and stat modifiers - Player — concrete player entity extending
LivingEntity - Store — the
EntityStorethat holds entity components - Ref — entity reference handle used with
getReference()/setReference() - ComponentType — type key for accessing
Entityas a component Component— the ECS component interface thatEntityimplementsWorld— the world container that entities are loaded intoBuilderCodec— serialization codec for entity dataHolder— snapshot container created bytoHolder()