mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Remove premature optimisation from World::getCollidingEntities()
this is already covered in more fine-grained detail by canCollideWith(). [bc break]
This commit is contained in:
parent
b7e2b3e94a
commit
6ee551c5e1
@ -140,8 +140,6 @@ abstract class Entity{
|
|||||||
public $lastUpdate;
|
public $lastUpdate;
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $fireTicks = 0;
|
protected $fireTicks = 0;
|
||||||
/** @var bool */
|
|
||||||
public $canCollide = true;
|
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $isStatic = false;
|
protected $isStatic = false;
|
||||||
|
@ -49,8 +49,6 @@ class FallingBlock extends Entity{
|
|||||||
/** @var Block */
|
/** @var Block */
|
||||||
protected $block;
|
protected $block;
|
||||||
|
|
||||||
public $canCollide = false;
|
|
||||||
|
|
||||||
public function __construct(Location $location, Block $block, ?CompoundTag $nbt = null){
|
public function __construct(Location $location, Block $block, ?CompoundTag $nbt = null){
|
||||||
$this->block = $block;
|
$this->block = $block;
|
||||||
parent::__construct($location, $nbt);
|
parent::__construct($location, $nbt);
|
||||||
|
@ -59,8 +59,6 @@ class ItemEntity extends Entity{
|
|||||||
/** @var Item */
|
/** @var Item */
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
public $canCollide = false;
|
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $despawnDelay = self::DEFAULT_DESPAWN_DELAY;
|
protected $despawnDelay = self::DEFAULT_DESPAWN_DELAY;
|
||||||
|
|
||||||
|
@ -46,8 +46,6 @@ class PrimedTNT extends Entity implements Explosive{
|
|||||||
|
|
||||||
protected bool $worksUnderwater = false;
|
protected bool $worksUnderwater = false;
|
||||||
|
|
||||||
public $canCollide = false;
|
|
||||||
|
|
||||||
protected function getInitialSizeInfo() : EntitySizeInfo{ return new EntitySizeInfo(0.98, 0.98); }
|
protected function getInitialSizeInfo() : EntitySizeInfo{ return new EntitySizeInfo(0.98, 0.98); }
|
||||||
|
|
||||||
protected function getInitialDragMultiplier() : float{ return 0.02; }
|
protected function getInitialDragMultiplier() : float{ return 0.02; }
|
||||||
|
@ -1904,11 +1904,9 @@ class World implements ChunkManager{
|
|||||||
public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{
|
public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{
|
||||||
$nearby = [];
|
$nearby = [];
|
||||||
|
|
||||||
if($entity === null || $entity->canCollide){
|
foreach($this->getNearbyEntities($bb, $entity) as $ent){
|
||||||
foreach($this->getNearbyEntities($bb, $entity) as $ent){
|
if($ent->canBeCollidedWith() && ($entity === null || $entity->canCollideWith($ent))){
|
||||||
if($ent->canBeCollidedWith() && ($entity === null || $entity->canCollideWith($ent))){
|
$nearby[] = $ent;
|
||||||
$nearby[] = $ent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user