mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Explosion: cap yield at 100%
this could overflow if the explosion size is less than 1. While this currently doesn't have any negative effects, if we decided to support >100% yield, this would cause some issues.
This commit is contained in:
parent
645c44ae9c
commit
7eaf1246a0
@ -42,6 +42,7 @@ use pocketmine\world\utils\SubChunkExplorer;
|
||||
use pocketmine\world\utils\SubChunkExplorerStatus;
|
||||
use function ceil;
|
||||
use function floor;
|
||||
use function min;
|
||||
use function mt_rand;
|
||||
use function sqrt;
|
||||
|
||||
@ -154,7 +155,7 @@ class Explosion{
|
||||
*/
|
||||
public function explodeB() : bool{
|
||||
$source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor();
|
||||
$yield = (1 / $this->size) * 100;
|
||||
$yield = min(100, (1 / $this->size) * 100);
|
||||
|
||||
if($this->what instanceof Entity){
|
||||
$ev = new EntityExplodeEvent($this->what, $this->source, $this->affectedBlocks, $yield);
|
||||
|
Loading…
x
Reference in New Issue
Block a user