Skip to content

Archetype

Package: com.hypixel.hytale.component

public class Archetype<ECS_TYPE> implements Query<ECS_TYPE>

Represents a unique combination of ComponentType instances that defines an entity’s shape. Entities with identical archetypes are stored together in the same ArchetypeChunk, enabling cache-friendly iteration. Archetype also implements Query, matching any entity whose archetype contains all of this archetype’s component types.

Archetypes are immutable. Adding or removing a component produces a new Archetype instance.

  • ECS_TYPE — the store type parameter
public static <ECS_TYPE> Archetype<ECS_TYPE> empty()
@Nonnull
public static <ECS_TYPE> Archetype<ECS_TYPE> of(@Nonnull ComponentType<ECS_TYPE, ?> componentType)
@SafeVarargs
public static <ECS_TYPE> Archetype<ECS_TYPE> of(@Nonnull ComponentType<ECS_TYPE, ?>... componentTypes)
@Nonnull
public static <ECS_TYPE, T extends Component<ECS_TYPE>> Archetype<ECS_TYPE> add(@Nonnull Archetype<ECS_TYPE> archetype, @Nonnull ComponentType<ECS_TYPE, T> componentType)
public static <ECS_TYPE, T extends Component<ECS_TYPE>> Archetype<ECS_TYPE> remove(@Nonnull Archetype<ECS_TYPE> archetype, @Nonnull ComponentType<ECS_TYPE, T> componentType)
public int count()

Returns the number of component types in this archetype.

public boolean isEmpty()
public boolean contains(@Nonnull ComponentType<ECS_TYPE, ?> componentType)
public boolean contains(@Nonnull Archetype<ECS_TYPE> archetype)

Returns true if this archetype contains all component types in the given archetype.

@Nonnull
public ExactArchetypeQuery<ECS_TYPE> asExactQuery()

Returns an exact-match query for this specific archetype.

  • ArchetypeChunk — stores entities sharing the same archetype
  • ComponentType — the component handles that compose an archetype
  • Holder — carries an Archetype alongside component data
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.