Class RaycastUtils

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

public class RaycastUtils extends Object
Utility class for raycasting and line-of-sight operations
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.hypixel.hytale.math.vector.Vector3d
    findFirstSolidBlock(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance)
    Finds the first solid block along a ray
    static List<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>>
    getEntitiesInCone(com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, double angle)
    Performs a cone-shaped check for entities
    static List<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>>
    getEntitiesInCone(com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, double angle, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> excludeEntity)
    Performs a cone-shaped check for entities with exclusion support
    static boolean
    hasLineOfSight(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d from, com.hypixel.hytale.math.vector.Vector3d to)
    Checks if there's line of sight between two positions
    static boolean
    hasLineOfSightBetweenEntities(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entity1, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entity2, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.server.core.universe.world.World world)
    Checks if there's line of sight between two entities
    raycast(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance)
    Performs a raycast from an origin point in a direction
    raycast(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, boolean checkBlocks, boolean checkEntities)
    Performs a raycast with options for what to check
    raycast(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, boolean checkBlocks, boolean checkEntities, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> excludeEntity)
    Performs a raycast with options for what to check and entity exclusion
    raycastFromPlayer(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> playerRef, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.server.core.universe.world.World world, double maxDistance)
    Performs a raycast from a player's eye position

    Methods inherited from class Object

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

    • raycast

      public static RaycastResult raycast(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance)
      Performs a raycast from an origin point in a direction
      Parameters:
      world - The world to raycast in
      origin - The starting position
      direction - The normalized direction vector
      maxDistance - Maximum distance to check
      Returns:
      The raycast result
    • raycast

      public static RaycastResult raycast(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, boolean checkBlocks, boolean checkEntities)
      Performs a raycast with options for what to check
      Parameters:
      world - The world to raycast in
      origin - The starting position
      direction - The normalized direction vector
      maxDistance - Maximum distance to check
      checkBlocks - Whether to check for block collisions
      checkEntities - Whether to check for entity collisions
      Returns:
      The raycast result
    • raycast

      public static RaycastResult raycast(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, boolean checkBlocks, boolean checkEntities, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> excludeEntity)
      Performs a raycast with options for what to check and entity exclusion
      Parameters:
      world - The world to raycast in
      origin - The starting position
      direction - The normalized direction vector
      maxDistance - Maximum distance to check
      checkBlocks - Whether to check for block collisions
      checkEntities - Whether to check for entity collisions
      excludeEntity - Entity to exclude from intersection checks (e.g., the source entity)
      Returns:
      The raycast result
    • raycastFromPlayer

      public static RaycastResult raycastFromPlayer(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> playerRef, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.server.core.universe.world.World world, double maxDistance)
      Performs a raycast from a player's eye position
      Parameters:
      playerRef - The player reference
      store - The entity store
      world - The world
      maxDistance - Maximum distance to check
      Returns:
      The raycast result
    • hasLineOfSight

      public static boolean hasLineOfSight(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d from, com.hypixel.hytale.math.vector.Vector3d to)
      Checks if there's line of sight between two positions
      Parameters:
      world - The world to check in
      from - Starting position
      to - Target position
      Returns:
      true if there's clear line of sight
    • hasLineOfSightBetweenEntities

      public static boolean hasLineOfSightBetweenEntities(com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entity1, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> entity2, com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.server.core.universe.world.World world)
      Checks if there's line of sight between two entities
      Parameters:
      entity1 - First entity reference
      entity2 - Second entity reference
      store - The entity store
      world - The world
      Returns:
      true if there's clear line of sight
    • findFirstSolidBlock

      public static com.hypixel.hytale.math.vector.Vector3d findFirstSolidBlock(com.hypixel.hytale.server.core.universe.world.World world, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance)
      Finds the first solid block along a ray
      Parameters:
      world - The world to check in
      origin - Starting position
      direction - Direction to check
      maxDistance - Maximum distance
      Returns:
      The position of the first solid block, or null if none found
    • getEntitiesInCone

      public static List<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>> getEntitiesInCone(com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, double angle)
      Performs a cone-shaped check for entities
      Parameters:
      store - The entity store
      origin - Starting position
      direction - Direction of the cone
      maxDistance - Maximum distance
      angle - Cone angle in degrees
      Returns:
      List of entity references within the cone
    • getEntitiesInCone

      public static List<com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore>> getEntitiesInCone(com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.math.vector.Vector3d origin, com.hypixel.hytale.math.vector.Vector3d direction, double maxDistance, double angle, com.hypixel.hytale.component.Ref<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> excludeEntity)
      Performs a cone-shaped check for entities with exclusion support
      Parameters:
      store - The entity store
      origin - Starting position
      direction - Direction of the cone
      maxDistance - Maximum distance
      angle - Cone angle in degrees
      excludeEntity - Entity to exclude from checks (e.g., the source entity)
      Returns:
      List of entity references within the cone