diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index 082513bc91..691f5a002c 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -572,6 +572,24 @@ public final class Keys { */ public static final Key> BOSS_BAR = Keys.key(ResourceKey.sponge("boss_bar"), BossBar.class); + /** + * The width of the interactable form of an {@link Entity}. + * + *

Together with {@link #BOUNDING_BOX_HEIGHT} this defines + * the size of the {@link Entity}'s bounding box.

+ * Readonly(Entity.class) expect Interaction + */ + public static final Key> BOUNDING_BOX_BASE_SIZE = Keys.key(ResourceKey.sponge("bounding_box_base_size"), Double.class); + + /** + * The height of the interactable form of an {@link Entity}. + * + *

Together with {@link #BOUNDING_BOX_BASE_SIZE} this defines + * the size of the {@link Entity}'s bounding box.

+ * Readonly(Entity.class) expect Interaction + */ + public static final Key> BOUNDING_BOX_HEIGHT = Keys.key(ResourceKey.sponge("bounding_box_height"), Double.class); + /** * The {@link BlockType}s able to be broken by an {@link ItemStack}. */ diff --git a/src/main/java/org/spongepowered/api/entity/Entity.java b/src/main/java/org/spongepowered/api/entity/Entity.java index 2f39680f34..668f17c401 100644 --- a/src/main/java/org/spongepowered/api/entity/Entity.java +++ b/src/main/java/org/spongepowered/api/entity/Entity.java @@ -655,4 +655,22 @@ default Optional> swiftness() { @Override HoverEvent asHoverEvent(final UnaryOperator op); + + /** + * {@link Keys#BOUNDING_BOX_BASE_SIZE} + * + * @return The bounding box base size of the entity + */ + default Value.Mutable boundingBoxBaseSize() { + return this.requireValue(Keys.BOUNDING_BOX_BASE_SIZE).asMutable(); + } + + /** + * {@link Keys#BOUNDING_BOX_HEIGHT} + * + * @return The bounding box height of the entity + */ + default Value.Mutable boundingBoxHeight() { + return this.requireValue(Keys.BOUNDING_BOX_HEIGHT).asMutable(); + } }