Skip to content

Commit

Permalink
Location extension class
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendotgg committed Dec 8, 2023
1 parent 4291ce1 commit b62913f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/kotlin/gg/flyte/twilight/extension/Location.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
package gg.flyte.twilight.extension

import org.bukkit.Location
import org.bukkit.World
import org.bukkit.entity.Entity
import org.bukkit.entity.EntityType
import org.bukkit.inventory.ItemStack

/**
* An extension of the Bukkit Location class, providing conversion of the given coordinates
* to double and orientation to float.
*
* @param world The world in which the location exists.
* @param x The x-coordinate of the location.
* @param y The y-coordinate of the location.
* @param z The z-coordinate of the location.
* @param yaw The yaw (rotation on the horizontal plane) at this location, defaulting to 0 if not specified.
* @param pitch The pitch (vertical rotation) at this location, defaulting to 0 if not specified.
*
* @constructor Creates a new Location object with specified world, coordinates, and optionally, orientation.
*/
data class Location(
val world: World,
val x: Number,
val y: Number,
val z: Number,
val yaw: Number = 0,
val pitch: Number = 0
) : Location(world, x.toDouble(), y.toDouble(), z.toDouble(), yaw.toFloat(), pitch.toFloat())

/**
* Drops the specified [itemStack] at the current location in the world.
*
Expand Down

0 comments on commit b62913f

Please sign in to comment.