Class EntityUtils

java.lang.Object
com.hypixel.hytale.server.core.entity.EntityUtils

public class EntityUtils extends Object
A utility class that contains a variety of useful entity-related functionalities and utilities.
  • 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

      @Nullable @Deprecated public static Entity getEntity(@Nonnull Holder<EntityStore> holder)
      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 public static boolean hasEntity(@Nonnull Archetype<EntityStore> archetype)
      Deprecated.
      Checks if the given archetype contains an entity component.
      Parameters:
      archetype - the archetype to check.
      Returns:
      true if the archetype contains an entity component, false otherwise.
    • hasLivingEntity

      @Deprecated public static boolean hasLivingEntity(@Nonnull Archetype<EntityStore> archetype)
      Deprecated.
      Checks if the given archetype contains a living entity component.
      Parameters:
      archetype - the archetype to check.
      Returns:
      true if the archetype contains a living entity component, false otherwise.
    • getPhysicsValues

      @Nonnull @Deprecated public static PhysicsValues getPhysicsValues(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Deprecated.
      Access PhysicsValues directly if possible.
      Called to get the physics values for this entity.
      Parameters:
      ref - The entity reference of the target entity.
      componentAccessor - The ComponentAccessor<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 provided BreathingComponent and CachedStatsComponent if necessary.
      Parameters:
      ref - The entity reference of the entity to process.
      breathingComponent - The BreathingComponent component of the entity.
      cachedStatsComponent - The CachedStatsComponent component of the entity, if it exists.
      invulnerable - Whether the entity is currently considered invulnerable.
      skipComparisons - Whether to skip comparing previous material and fluid.
      componentAccessor - The ComponentAccessor<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 reference
      componentAccessor - The component accessor for retrieving entity components
      Returns:
      a human-readable entity identifier