Merge branch '3.5' into master-rollback

This commit is contained in:
Dylan K. Taylor
2019-02-04 19:47:21 +00:00
4 changed files with 18 additions and 10 deletions

View File

@ -44,6 +44,7 @@ use pocketmine\plugin\Plugin;
use function array_merge;
use function assert;
use function dechex;
use function get_class;
use const PHP_INT_MAX;
class Block extends Position implements BlockIds, Metadatable{
@ -324,6 +325,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();
@ -335,7 +337,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;