Class RaycastUtils
java.lang.Object
io.hymods.lib.utils.RaycastUtils
Utility class for raycasting and line-of-sight operations
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.hypixel.hytale.math.vector.Vector3dfindFirstSolidBlock(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 raystatic 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 entitiesstatic 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 supportstatic booleanhasLineOfSight(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 positionsstatic booleanhasLineOfSightBetweenEntities(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 entitiesstatic RaycastResultraycast(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 directionstatic RaycastResultraycast(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 checkstatic RaycastResultraycast(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 exclusionstatic RaycastResultraycastFromPlayer(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
-
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 inorigin- The starting positiondirection- The normalized direction vectormaxDistance- 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 inorigin- The starting positiondirection- The normalized direction vectormaxDistance- Maximum distance to checkcheckBlocks- Whether to check for block collisionscheckEntities- 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 inorigin- The starting positiondirection- The normalized direction vectormaxDistance- Maximum distance to checkcheckBlocks- Whether to check for block collisionscheckEntities- Whether to check for entity collisionsexcludeEntity- 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 referencestore- The entity storeworld- The worldmaxDistance- 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 infrom- Starting positionto- 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 referenceentity2- Second entity referencestore- The entity storeworld- 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 inorigin- Starting positiondirection- Direction to checkmaxDistance- 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 storeorigin- Starting positiondirection- Direction of the conemaxDistance- Maximum distanceangle- 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 storeorigin- Starting positiondirection- Direction of the conemaxDistance- Maximum distanceangle- Cone angle in degreesexcludeEntity- Entity to exclude from checks (e.g., the source entity)- Returns:
- List of entity references within the cone
-