Class EntityCollisionProvider

java.lang.Object
com.hypixel.hytale.server.core.modules.collision.EntityCollisionProvider

public class EntityCollisionProvider extends Object
Provides functionality to compute collisions between entities in the game world.
  • Constructor Details

    • EntityCollisionProvider

      public EntityCollisionProvider()
      Default Constructor for a EntityCollisionProvider instance.
  • Method Details

    • getCount

      public int getCount()
      Returns:
      the number of contacts detected.
    • getContact

      @Nonnull public EntityContactData getContact(int index)
      Called to fetch contact data at a given index.
      Parameters:
      index - The index of the contact data to retrieve.
      Returns:
      the contact data at the specified index.
    • clear

      public void clear()
      Called to clear the contact list.
    • computeNearest

      public double computeNearest(@Nonnull Box entityBoundingBox, @Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d dir, @Nullable Ref<EntityStore> ignoreSelf, @Nullable Ref<EntityStore> ignore, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Find nearest collision of AABB swept along a vector with another entity and store it in contact list.
      Parameters:
      entityBoundingBox - AABB bounding box of the entity performing the collision check.
      pos - Initial position of AABB.
      dir - Movement ray of AABB.
      ignoreSelf - The entity reference of the entity to ignore during collision checks, or null to not ignore any entity.
      ignore - Ref to ignore. Can be null. Intended to be used for excluding creator of entity starting the search.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
      Returns:
      relative distance of collision or negative value (-Double.MAX_VALUE) when no collision with entity found.
    • computeNearest

      public double computeNearest(@Nonnull org.joml.Vector3d pos, @Nonnull org.joml.Vector3d dir, @Nonnull Box boundingBox, double radius, @Nonnull BiPredicate<Ref<EntityStore>, ComponentAccessor<EntityStore>> entityFilter, @Nullable Ref<EntityStore> ignoreSelf, @Nullable Ref<EntityStore> ignoreOther, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Find nearest collision of AABB swept along a vector with another entity and store it in contact list.
      Parameters:
      pos - Initial position of AABB.
      dir - Movement ray of AABB.
      boundingBox - AABB bounding box.
      radius - Search distance for entities.
      entityFilter - Predicate to accept or reject entities.
      ignoreSelf - Ref to ignore. Can be null. Intended to be used for excluding entity starting the search.
      ignoreOther - Ref to ignore. Can be null. Intended to be used for excluding creator of entity starting the search.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
      Returns:
      relative distance of collision or negative value (-Double.MAX_VALUE) when no collision with entity found
    • defaultEntityFilter

      public static boolean defaultEntityFilter(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      The default entity filter which filters out projectiles and dead entities.
      Parameters:
      ref - The entity reference to test.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
      Returns:
      true if the entity should be considered for collision, false otherwise.