43 private bool $blockBreaking =
true;
45 public function __construct(
47 protected float $radius,
48 private float $fireChance = 0.0,
51 throw new \InvalidArgumentException(
"Explosion radius must be positive");
53 Utils::checkFloatNotInfOrNaN(
"fireChance", $fireChance);
54 if($fireChance < 0.0 || $fireChance > 1.0){
55 throw new \InvalidArgumentException(
"Fire chance must be between 0 and 1.");
60 public function getRadius() :
float{
64 public function setRadius(
float $radius) :
void{
66 throw new \InvalidArgumentException(
"Explosion radius must be positive");
68 $this->radius = $radius;
75 return $this->fireChance > 0;
85 $this->fireChance = 0;
86 }elseif($this->fireChance <= 0){
87 $this->fireChance = Explosion::DEFAULT_FIRE_CHANCE;
95 return $this->fireChance;
105 Utils::checkFloatNotInfOrNaN(
"fireChance", $fireChance);
106 if($fireChance < 0.0 || $fireChance > 1.0){
107 throw new \InvalidArgumentException(
"Fire chance must be between 0 and 1.");
109 $this->fireChance = $fireChance;
112 public function isBlockBreaking() : bool{
113 return $this->blockBreaking;
116 public function setBlockBreaking(
bool $affectsBlocks) : void{
117 $this->blockBreaking = $affectsBlocks;