Paper/patches/server/0565-Add-Block-isValidTool.patch
Jake Potrebic 6813244fb0
Fix/improve destroy speed API (#9645)
further improvements could be a method that takes in an entity
to account for effects
2023-08-25 10:57:11 -07:00

21 lines
859 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 6 Jul 2020 12:44:31 -0700
Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 5e0f16acbd892f815cc504e03cd186070598b530..7dcc1fa9c058adf2d55b1ccc6f7abf468752e116 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -718,5 +718,9 @@ public class CraftBlock implements Block {
public String translationKey() {
return this.getNMS().getBlock().getDescriptionId();
}
+
+ public boolean isValidTool(ItemStack itemStack) {
+ return getDrops(itemStack).size() != 0;
+ }
// Paper end
}