From c9e4ed1a42f69d80ccab0f7c5ebe613f3c8817b3 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 13 Apr 2023 07:08:23 +1000 Subject: [PATCH] #843: Add damage methods to FallingBlock By: Parker Hawke --- .../java/org/bukkit/entity/FallingBlock.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java b/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java index 64f9d3fd87..9a57341691 100644 --- a/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java +++ b/paper-api/src/main/java/org/bukkit/entity/FallingBlock.java @@ -54,4 +54,42 @@ public interface FallingBlock extends Entity { * @param hurtEntities whether entities will be damaged by this block. */ void setHurtEntities(boolean hurtEntities); + + /** + * Get the amount of damage inflicted upon entities multiplied by the distance + * that the block had fallen when this falling block lands on them. + * + * @return the damage per block + */ + float getDamagePerBlock(); + + /** + * Set the amount of damage inflicted upon entities multiplied by the distance + * that the block had fallen when this falling block lands on them. + *

+ * If {@code damage} is non-zero, this method will automatically call + * {@link #setHurtEntities(boolean) setHurtEntities(true)}. + * + * @param damage the damage per block to set. Must be >= 0.0 + */ + void setDamagePerBlock(float damage); + + /** + * Get the maximum amount of damage that can be inflicted upon entities when + * this falling block lands on them. + * + * @return the max damage + */ + int getMaxDamage(); + + /** + * Set the maximum amount of damage that can be inflicted upon entities when + * this falling block lands on them. + *

+ * If {@code damage} is non-zero, this method will automatically call + * {@link #setHurtEntities(boolean) setHurtEntities(true)}. + * + * @param damage the max damage to set. Must be >= 0 + */ + void setMaxDamage(int damage); }