Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getEntity(Ref, ComponentAccessor)
- getEntity(int, ArchetypeChunk)
- getEntity(Holder)
- hasEntity(Archetype)
- hasLivingEntity(Archetype)
- getPhysicsValues(Ref, ComponentAccessor)
- processEntityBreathing(Ref, BreathingComponent, CachedStatsComponent, boolean, boolean, ComponentAccessor)
- getEntityName(Ref, ComponentAccessor)
Class EntityUtils
java.lang.Object
com.hypixel.hytale.server.core.entity.EntityUtils
A utility class that contains a variety of useful entity-related functionalities and utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EntitygetEntity(int index, ArchetypeChunk<EntityStore> archetypeChunk) Deprecated.static EntitygetEntity(Holder<EntityStore> holder) Deprecated.static EntitygetEntity(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Deprecated.static StringgetEntityName(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Returns a loggable identifier for an entity.static PhysicsValuesgetPhysicsValues(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Deprecated.static booleanhasEntity(Archetype<EntityStore> archetype) Deprecated.static booleanhasLivingEntity(Archetype<EntityStore> archetype) Deprecated.static voidprocessEntityBreathing(Ref<EntityStore> ref, BreathingComponent breathingComponent, CachedStatsComponent cachedStatsComponent, boolean invulnerable, boolean skipComparisons, ComponentAccessor<EntityStore> componentAccessor) Called to process the breathing status of an entity, updating the providedBreathingComponentandCachedStatsComponentif necessary.
-
Constructor Details
-
EntityUtils
public EntityUtils()
-
-
Method Details
-
getEntity
@Deprecated @Nullable public static Entity getEntity(@Nullable Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Deprecated.Gets the entity from the given reference using the provided component accessor.- Parameters:
ref- the reference to the entity store.componentAccessor- the component accessor to use.- Returns:
- the entity, or null if not found.
-
getEntity
@Nullable @Deprecated public static Entity getEntity(int index, @Nonnull ArchetypeChunk<EntityStore> archetypeChunk) Deprecated.Gets the entity at the given index in the archetype chunk.- Parameters:
index- the index of the entity in the archetype chunk.archetypeChunk- the archetype chunk.- Returns:
- the entity, or null if not found.
-
getEntity
Deprecated.Gets the entity from the given holder.- Parameters:
holder- the holder containing the entity's components.- Returns:
- the entity, or null if not found.
-
hasEntity
Deprecated.Checks if the given archetype contains an entity component.- Parameters:
archetype- the archetype to check.- Returns:
trueif the archetype contains an entity component,falseotherwise.
-
hasLivingEntity
Deprecated.Checks if the given archetype contains a living entity component.- Parameters:
archetype- the archetype to check.- Returns:
trueif the archetype contains a living entity component,falseotherwise.
-
getPhysicsValues
@Nonnull @Deprecated public static PhysicsValues getPhysicsValues(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Deprecated.AccessPhysicsValuesdirectly if possible.Called to get the physics values for this entity.- Parameters:
ref- The entity reference of the target entity.componentAccessor- TheComponentAccessor<EntityStore>for component access.- Returns:
- the physics values for this entity.
-
processEntityBreathing
public static void processEntityBreathing(@Nonnull Ref<EntityStore> ref, @Nonnull BreathingComponent breathingComponent, @Nullable CachedStatsComponent cachedStatsComponent, boolean invulnerable, boolean skipComparisons, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Called to process the breathing status of an entity, updating the providedBreathingComponentandCachedStatsComponentif necessary.- Parameters:
ref- The entity reference of the entity to process.breathingComponent- TheBreathingComponentcomponent of the entity.cachedStatsComponent- TheCachedStatsComponentcomponent of the entity, if it exists.invulnerable- Whether the entity is currently considered invulnerable.skipComparisons- Whether to skip comparing previous material and fluid.componentAccessor- TheComponentAccessor<EntityStore>for component access.
-
getEntityName
@Nonnull public static String getEntityName(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Returns a loggable identifier for an entity. Prefers the display name, then UUID, then falls back to the ECS slot index.- Parameters:
ref- The entity referencecomponentAccessor- The component accessor for retrieving entity components- Returns:
- a human-readable entity identifier
-
PhysicsValuesdirectly if possible.