summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvoluseis <contact@evoluseis.me>2018-12-17 19:16:46 -0500
committermd_5 <git@md-5.net>2018-12-19 10:29:05 +1100
commit9ad459ca9dd3756f801f9f8932af9a828109f5f7 (patch)
treee30fb7ab01ff32fb3e895b119e78b336155b7cf2
parentad28b19f7281819ca4b5da8dd4e44f80ca8dfff4 (diff)
downloadbukkit-9ad459ca9dd3756f801f9f8932af9a828109f5f7.tar
bukkit-9ad459ca9dd3756f801f9f8932af9a828109f5f7.tar.gz
bukkit-9ad459ca9dd3756f801f9f8932af9a828109f5f7.tar.lz
bukkit-9ad459ca9dd3756f801f9f8932af9a828109f5f7.tar.xz
bukkit-9ad459ca9dd3756f801f9f8932af9a828109f5f7.zip
SPIGOT-2151: Add support for getting simple bounding box of a block
-rw-r--r--src/main/java/org/bukkit/block/Block.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 24100a6a..6041a66c 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -10,6 +10,7 @@ import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.Metadatable;
+import org.bukkit.util.BoundingBox;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
@@ -384,4 +385,20 @@ public interface Block extends Metadatable {
* @return the ray trace hit result, or <code>null</code> if there is no hit
*/
RayTraceResult rayTrace(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode);
+
+ /**
+ * Gets the approximate bounding box for this block.
+ * <p>
+ * This isn't exact as some blocks {@link org.bukkit.block.data.type.Stairs}
+ * contain many bounding boxes to establish their complete form.
+ *
+ * Also, the box may not be exactly the same as the collision shape (such as
+ * cactus, which is 16/16 of a block with 15/16 collisional bounds).
+ *
+ * This method will return an empty bounding box if the geometric shape of
+ * the block is empty (such as air blocks).
+ *
+ * @return the approximate bounding box of the block
+ */
+ BoundingBox getBoundingBox();
}