mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Merge branch 'next-major' into modern-world-support
This commit is contained in:
@@ -48,35 +48,27 @@ use function sqrt;
|
||||
|
||||
class Explosion{
|
||||
private int $rays = 16;
|
||||
/** @var World */
|
||||
public $world;
|
||||
/** @var Position */
|
||||
public $source;
|
||||
/** @var float */
|
||||
public $size;
|
||||
public World $world;
|
||||
|
||||
/** @var Block[] */
|
||||
public $affectedBlocks = [];
|
||||
/** @var float */
|
||||
public $stepLen = 0.3;
|
||||
|
||||
private Entity|Block|null $what;
|
||||
public array $affectedBlocks = [];
|
||||
public float $stepLen = 0.3;
|
||||
|
||||
private SubChunkExplorer $subChunkExplorer;
|
||||
|
||||
public function __construct(Position $center, float $size, Entity|Block|null $what = null){
|
||||
if(!$center->isValid()){
|
||||
public function __construct(
|
||||
public Position $source,
|
||||
public float $size,
|
||||
private Entity|Block|null $what = null
|
||||
){
|
||||
if(!$this->source->isValid()){
|
||||
throw new \InvalidArgumentException("Position does not have a valid world");
|
||||
}
|
||||
$this->source = $center;
|
||||
$this->world = $center->getWorld();
|
||||
$this->world = $this->source->getWorld();
|
||||
|
||||
if($size <= 0){
|
||||
throw new \InvalidArgumentException("Explosion radius must be greater than 0, got $size");
|
||||
}
|
||||
$this->size = $size;
|
||||
|
||||
$this->what = $what;
|
||||
$this->subChunkExplorer = new SubChunkExplorer($this->world);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user