mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
first look at separating Entity and Location
This commit is contained in:
@ -174,12 +174,14 @@ class Explosion{
|
||||
|
||||
$explosionBB = new AxisAlignedBB($minX, $minY, $minZ, $maxX, $maxY, $maxZ);
|
||||
|
||||
/** @var Entity[] $list */
|
||||
$list = $this->world->getNearbyEntities($explosionBB, $this->what instanceof Entity ? $this->what : null);
|
||||
foreach($list as $entity){
|
||||
$distance = $entity->distance($this->source) / $explosionSize;
|
||||
$entityPos = $entity->getPosition();
|
||||
$distance = $entityPos->distance($this->source) / $explosionSize;
|
||||
|
||||
if($distance <= 1){
|
||||
$motion = $entity->subtract($this->source)->normalize();
|
||||
$motion = $entityPos->subtract($this->source)->normalize();
|
||||
|
||||
$impact = (1 - $distance) * ($exposure = 1);
|
||||
|
||||
|
Reference in New Issue
Block a user