Add ray tracing and bounding box API

By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
Bukkit/Spigot
2018-10-26 19:59:36 +11:00
parent 0283ef18f5
commit 55523cfcfc
12 changed files with 1770 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
package org.bukkit.block;
import org.bukkit.util.Vector;
/**
* Represents the face of a block
*/
@@ -67,6 +69,19 @@ public enum BlockFace {
return modZ;
}
/**
* Gets the normal vector corresponding to this block face.
*
* @return the normal vector
*/
public Vector getDirection() {
Vector direction = new Vector(modX, modY, modZ);
if (modX != 0 || modY != 0 || modZ != 0) {
direction.normalize();
}
return direction;
}
public BlockFace getOppositeFace() {
switch (this) {
case NORTH: