diff --git a/src/block/ItemFrame.php b/src/block/ItemFrame.php index 270938d75..33b547eab 100644 --- a/src/block/ItemFrame.php +++ b/src/block/ItemFrame.php @@ -31,6 +31,8 @@ use pocketmine\math\Facing; use pocketmine\math\Vector3; use pocketmine\player\Player; use pocketmine\world\BlockTransaction; +use function is_infinite; +use function is_nan; use function lcg_value; class ItemFrame extends Flowable{ @@ -111,6 +113,9 @@ class ItemFrame extends Flowable{ /** @return $this */ public function setItemDropChance(float $itemDropChance) : self{ + if($itemDropChance < 0.0 || $itemDropChance > 1.0 || is_nan($itemDropChance) || is_infinite($itemDropChance)){ + throw new \InvalidArgumentException("Drop chance must be in range 0-1"); + } $this->itemDropChance = $itemDropChance; return $this; }