diff --git a/patches/api/Add-Destroy-Speed-API.patch b/patches/api/Add-Destroy-Speed-API.patch index 45a4c573b7..5bf36ae3a6 100644 --- a/patches/api/Add-Destroy-Speed-API.patch +++ b/patches/api/Add-Destroy-Speed-API.patch @@ -10,32 +10,68 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - @NotNull @Deprecated(forRemoval = true) String getTranslationKey(); + // Paper end + ++ // Paper start - destroy speed API + /** + * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ * -+ *
Default value is 1.0
++ *++ * Default value is 1.0 + * + * @param itemStack {@link ItemStack} used to mine this Block + * @return the speed that this Block will be mined by the given {@link ItemStack} + */ -+ @NotNull -+ public default float getDestroySpeed(@NotNull ItemStack itemStack) { -+ return getDestroySpeed(itemStack, false); ++ default float getDestroySpeed(final @NotNull ItemStack itemStack) { ++ return this.getBlockData().getDestroySpeed(itemStack); + } + + /** -+ * Gets the speed at which this blook will be destroyed by a given {@link org.bukkit.inventory.ItemStack} ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} + *
+ * Default value is 1.0 -+ * @param itemStack {@link org.bukkit.inventory.ItemStack} used to mine this Block ++ * ++ * @param itemStack {@link 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} ++ * @return the speed that this Block will be mined by the given {@link ItemStack} + */ -+ @NotNull -+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants); - // Paper end ++ default float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) { ++ return this.getBlockData().getDestroySpeed(itemStack, considerEnchants); ++ } ++ // Paper end - destroy speed API + } +diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/block/data/BlockData.java ++++ b/src/main/java/org/bukkit/block/data/BlockData.java +@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable { + @NotNull + @ApiStatus.Experimental + BlockState createBlockState(); ++ ++ // Paper start - destroy speed API ++ /** ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} ++ *
++ * Default value is 1.0 ++ * ++ * @param itemStack {@link ItemStack} used to mine this Block ++ * @return the speed that this Block will be mined by the given {@link ItemStack} ++ */ ++ default float getDestroySpeed(final @NotNull ItemStack itemStack) { ++ return this.getDestroySpeed(itemStack, false); ++ } ++ ++ /** ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} ++ *
++ * Default value is 1.0
++ *
++ * @param itemStack {@link 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 ItemStack}
++ */
++ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
++ // Paper end - destroy speed API
}
diff --git a/patches/api/Block-Ticking-API.patch b/patches/api/Block-Ticking-API.patch
index 233553df59..ec40b4ec81 100644
--- a/patches/api/Block-Ticking-API.patch
+++ b/patches/api/Block-Ticking-API.patch
@@ -35,9 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/block/data/BlockData.java
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable {
- @NotNull
- @ApiStatus.Experimental
- BlockState createBlockState();
+ */
+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
+ // Paper end - destroy speed API
+
+ // Paper start - Tick API
+ /**
@@ -47,5 +47,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return is ticked randomly
+ */
+ boolean isRandomlyTicked();
-+ // Paper end
++ // Paper end - Tick API
}
diff --git a/patches/server/Add-Block-isValidTool.patch b/patches/server/Add-Block-isValidTool.patch
index 4e4985df4f..7a21e34c08 100644
--- a/patches/server/Add-Block-isValidTool.patch
+++ b/patches/server/Add-Block-isValidTool.patch
@@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -0,0 +0,0 @@ public class CraftBlock implements Block {
- }
- return speed;
+ public String translationKey() {
+ return this.getNMS().getBlock().getDescriptionId();
}
+
+ public boolean isValidTool(ItemStack itemStack) {
diff --git a/patches/server/Add-Destroy-Speed-API.patch b/patches/server/Add-Destroy-Speed-API.patch
index 5fbd0c3048..c2a4f4d919 100644
--- a/patches/server/Add-Destroy-Speed-API.patch
+++ b/patches/server/Add-Destroy-Speed-API.patch
@@ -5,27 +5,20 @@ Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic