Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Location(var x: Double, var y: Double, var z: Double, var yaw : Float = 0F, var pitch: Float = 0F) : Cloneable {
- val blockX: Int get() {
- return x.toInt()
- }
- val blockY: Int get() {
- return y.toInt()
- }
- val blockZ: Int get() {
- return z.toInt()
- }
- val chunkX: Int get() {
- return blockX shr 4
- }
- val chunkZ: Int get() {
- return blockZ shr 4
- }
- fun add(direction: Direction) {
- x += direction.x
- y += direction.y
- z += direction.z
- }
- fun getRelative(direction: Direction, times: Int = 1) : Location {
- val location = clone();
- for (i in 0..times - 1) {
- location.add(direction)
- }
- return location
- }
- override fun clone() : Location {
- return super.clone() as Location
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement