Skip to content

Holder

Package: com.hypixel.hytale.component

public class Holder<ECS_TYPE>

A portable container for entity data. Holders are used when entities are added to or removed from a Store, and during serialization/deserialization. They hold an Archetype and an array of Component instances, protected by a StampedLock for thread safety.

Holders are pooled and reused by the registry via newHolder().

  • ECS_TYPE — the store type parameter
public Archetype<ECS_TYPE> getArchetype()
@Nullable
public <T extends Component<ECS_TYPE>> T getComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType)
public <T extends Component<ECS_TYPE>> void addComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component)
public <T extends Component<ECS_TYPE>> void replaceComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component)
public <T extends Component<ECS_TYPE>> void putComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component)
public <T extends Component<ECS_TYPE>> void removeComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType)
public <T extends Component<ECS_TYPE>> void ensureComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType)
@Nonnull
public Holder<ECS_TYPE> clone()

Deep-clones all components.

public Holder<ECS_TYPE> cloneSerializable(@Nonnull ComponentRegistry.Data<ECS_TYPE> data)

Clones only serializable components, excluding NonSerialized entities.

public boolean hasSerializableComponents(@Nonnull ComponentRegistry.Data<ECS_TYPE> data)
  • Ref — the in-store reference returned after adding a Holder
  • StoreaddEntity() and removeEntity() operate on Holders
  • Archetype — defines the component shape of the Holder
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.