-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a3dc0b
commit 993531d
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/us/mytheria/bloblib/entities/Positionable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package us.mytheria.bloblib.entities; | ||
|
||
import org.bukkit.util.Vector; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface Positionable { | ||
double getX(); | ||
|
||
double getY(); | ||
|
||
double getZ(); | ||
|
||
@NotNull | ||
default Vector toVector() { | ||
return new Vector(getX(), getY(), getZ()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package us.mytheria.bloblib.entities; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.World; | ||
import org.bukkit.util.Vector; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface Spatial extends Positionable { | ||
float getYaw(); | ||
|
||
float getPitch(); | ||
|
||
@NotNull | ||
default Location toLocation() { | ||
return toLocation(null); | ||
} | ||
|
||
@NotNull | ||
default Location toLocation(@Nullable World world) { | ||
Vector vector = toVector(); | ||
return new Location(world, vector.getX(), vector.getY(), vector.getZ(), getYaw(), getPitch()); | ||
} | ||
} |