Class EntityUtils

java.lang.Object
io.hymods.lib.utils.EntityUtils

public class EntityUtils extends Object
Utility class for entity-related operations
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>
    getClosestEntity(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d position, double maxRadius, Predicate<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>> filter)
    Gets the closest entity to a position
    static double
    getDistanceBetween(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref1, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref2, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Gets the distance between two entities
    static <T extends com.hypixel.hytale.component.Component<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>>
    List<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>>
    getEntitiesWithComponent(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.component.ComponentType<com.hypixel.hytale.server.core.universe.world.storage.EntityStore, T> componentType)
    Gets all entities of a specific component type
    static com.hypixel.hytale.server.core.modules.entity.component.BoundingBox
    getEntityBoundingBox(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Gets the bounding box of an entity
    static com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>
    getEntityByUUID(com.hypixel.hytale.server.core.universe.world.World world, UUID uuid)
    Gets an entity by its UUID
    static String
    getEntityDisplayName(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Gets the display name of an entity
    static com.hypixel.hytale.math.vector.Vector3d
    getEntityPosition(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Gets the position of an entity
    static com.hypixel.hytale.math.vector.Vector3f
    getEntityRotation(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Gets the rotation of an entity
    static com.hypixel.hytale.math.vector.Vector3d
    getEntityVelocity(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Gets the velocity of an entity Note: Velocity data may not be available for all entities
    static boolean
    isInWater(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Checks if an entity is in water Note: This is a simplified implementation - actual water check may require accessing the world and checking the block at entity position
    static boolean
    isLivingEntity(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Checks if an entity is a living entity (has health/can take damage)
    static boolean
    isNPC(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Checks if an entity is an NPC
    static boolean
    isOnGround(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Checks if an entity is on the ground Note: This is a simplified implementation - actual ground check may require accessing the entity's transform and checking blocks below
    static boolean
    isPlayer(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Checks if an entity is a player
    static boolean
    removeEntity(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
    Removes an entity from the world
    searchEntities(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d center, double radius)
    Searches for entities within a radius
    searchEntities(com.hypixel.hytale.server.core.universe.world.World world, SearchParameters params)
    Searches for entities with specific parameters

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getEntityByUUID

      public static com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> getEntityByUUID(com.hypixel.hytale.server.core.universe.world.World world, UUID uuid)
      Gets an entity by its UUID
      Parameters:
      world - The world to search in
      uuid - The entity's UUID
      Returns:
      The entity reference, or null if not found
    • searchEntities

      public static EntitySearchResult searchEntities(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d center, double radius)
      Searches for entities within a radius
      Parameters:
      world - The world to search in
      center - The center position
      radius - The search radius
      Returns:
      The search results
    • searchEntities

      public static EntitySearchResult searchEntities(com.hypixel.hytale.server.core.universe.world.World world, SearchParameters params)
      Searches for entities with specific parameters
      Parameters:
      world - The world to search in
      params - The search parameters
      Returns:
      The search results
    • getEntitiesWithComponent

      public static <T extends com.hypixel.hytale.component.Component<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>> List<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>> getEntitiesWithComponent(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.component.ComponentType<com.hypixel.hytale.server.core.universe.world.storage.EntityStore, T> componentType)
      Gets all entities of a specific component type
      Parameters:
      world - The world to search in
      componentType - The component type to filter by
      Returns:
      List of entity references
    • getEntityPosition

      public static com.hypixel.hytale.math.vector.Vector3d getEntityPosition(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Gets the position of an entity
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      The entity's position, or null if not found
    • getEntityRotation

      public static com.hypixel.hytale.math.vector.Vector3f getEntityRotation(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Gets the rotation of an entity
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      The entity's rotation, or null if not found
    • getEntityVelocity

      public static com.hypixel.hytale.math.vector.Vector3d getEntityVelocity(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Gets the velocity of an entity Note: Velocity data may not be available for all entities
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      The entity's velocity, or null if not found
    • getEntityDisplayName

      public static String getEntityDisplayName(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Gets the display name of an entity
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      The entity's display name, or "Unknown" if not found
    • getEntityBoundingBox

      public static com.hypixel.hytale.server.core.modules.entity.component.BoundingBox getEntityBoundingBox(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Gets the bounding box of an entity
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      The entity's bounding box, or null if not found
    • isOnGround

      public static boolean isOnGround(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Checks if an entity is on the ground Note: This is a simplified implementation - actual ground check may require accessing the entity's transform and checking blocks below
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      true if the entity appears to be on ground based on position
    • isInWater

      public static boolean isInWater(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Checks if an entity is in water Note: This is a simplified implementation - actual water check may require accessing the world and checking the block at entity position
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      true if the entity appears to be in water
    • getDistanceBetween

      public static double getDistanceBetween(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref1, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref2, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Gets the distance between two entities
      Parameters:
      ref1 - First entity reference
      ref2 - Second entity reference
      store - The entity store
      Returns:
      The distance between entities, or -1 if either is invalid
    • isPlayer

      public static boolean isPlayer(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Checks if an entity is a player
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      true if the entity is a player
    • isNPC

      public static boolean isNPC(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Checks if an entity is an NPC
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      true if the entity is an NPC
    • isLivingEntity

      public static boolean isLivingEntity(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Checks if an entity is a living entity (has health/can take damage)
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      true if the entity is living
    • getClosestEntity

      public static com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> getClosestEntity(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d position, double maxRadius, Predicate<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>> filter)
      Gets the closest entity to a position
      Parameters:
      world - The world to search in
      position - The position to search from
      maxRadius - Maximum search radius
      filter - Optional filter predicate
      Returns:
      The closest entity reference, or null if none found
    • removeEntity

      public static boolean removeEntity(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> ref, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store)
      Removes an entity from the world
      Parameters:
      ref - The entity reference
      store - The entity store
      Returns:
      true if the entity was removed