consider enchants for destroy speed

This commit is contained in:
Jake Potrebic 2021-01-03 23:18:34 -08:00 committed by MiniDigger | Martin
parent aaef1d5cca
commit 616b1f3cd0
2 changed files with 29 additions and 7 deletions

View file

@ -3,12 +3,13 @@ From: Ineusia <ineusia@yahoo.com>
Date: Mon, 26 Oct 2020 11:37:48 -0500
Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 7616c5601adee3cbe0e5f722646a2458b535ab77..6933fd6ad353a2d008c4a64c52a64bf36bd8035c 100644
index 7616c5601adee3cbe0e5f722646a2458b535ab77..7f1b6e0a397f97fce22e209cd3eefe1d8ffd1174 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -581,5 +581,16 @@ public interface Block extends Metadatable {
@@ -581,5 +581,29 @@ public interface Block extends Metadatable {
*/
@NotNull
String getTranslationKey();
@ -22,6 +23,19 @@ index 7616c5601adee3cbe0e5f722646a2458b535ab77..6933fd6ad353a2d008c4a64c52a64bf3
+ * @return the speed that this Block will be mined by the given {@link ItemStack}
+ */
+ @NotNull
+ float getDestroySpeed(@NotNull ItemStack itemStack);
+ public default float getDestroySpeed(@NotNull ItemStack itemStack) {
+ return getDestroySpeed(itemStack, false);
+ }
+
+ /**
+ * Gets the speed at which this blook will be destroyed by a given {@link org.bukkit.inventory.ItemStack}
+ * <p>
+ * Default value is 1.0
+ * @param itemStack {@link org.bukkit.inventory.ItemStack} used to mine this Block
+ * @param considerEnchants true to look at enchants on the itemstack
+ * @return the speed that this Block will be mined by the given {@link org.bukkit.inventory.ItemStack}
+ */
+ @NotNull
+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
// Paper end
}