Skip to content

Commit

Permalink
BoundingBox.kt extension 'contains(Location)' added
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen committed Nov 4, 2023
1 parent 406895a commit db63e6a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "gg.flyte"
version = "1.0.19"
version = "1.0.20"

repositories {
mavenCentral()
Expand Down
13 changes: 13 additions & 0 deletions src/main/kotlin/gg/flyte/twilight/extension/BoundingBox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,17 @@ fun BoundingBox.getLocations(world: World): List<Location> {
}

return locations
}

/**
* Checks if the specified Location is within the boundaries of this BoundingBox.
*
* This extension function provides a simple way to determine if a Location is contained
* within the BoundingBox using its x, y, and z coordinates.
*
* @param location The Location to check for containment within this BoundingBox.
* @return Boolean true if the Location is within the BoundingBox; false otherwise.
*/
fun BoundingBox.contains(location: Location): Boolean {
return contains(location.x, location.y, location.z)
}

0 comments on commit db63e6a

Please sign in to comment.