diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 344519f56..9fc9e0d85 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -39,6 +39,7 @@ use pocketmine\metadata\MetadataValue; use pocketmine\Player; use pocketmine\plugin\Plugin; use function array_merge; +use function get_class; use const PHP_INT_MAX; class Block extends Position implements BlockIds, Metadatable{ @@ -268,6 +269,7 @@ class Block extends Position implements BlockIds, Metadatable{ * @param Item $item * * @return float + * @throws \InvalidArgumentException if the item efficiency is not a positive number */ public function getBreakTime(Item $item) : float{ $base = $this->getHardness(); @@ -279,7 +281,7 @@ class Block extends Position implements BlockIds, Metadatable{ $efficiency = $item->getMiningEfficiency($this); if($efficiency <= 0){ - throw new \RuntimeException("Item efficiency is invalid"); + throw new \InvalidArgumentException(get_class($item) . " has invalid mining efficiency: expected >= 0, got $efficiency"); } $base /= $efficiency;