mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +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;
|
||||
/** @var int */
|
||||
protected $fireTicks = 0;
|
||||
/** @var bool */
|
||||
public $canCollide = true;
|
||||
|
||||
/** @var bool */
|
||||
protected $isStatic = false;
|
||||
|
@ -49,8 +49,6 @@ class FallingBlock extends Entity{
|
||||
/** @var Block */
|
||||
protected $block;
|
||||
|
||||
public $canCollide = false;
|
||||
|
||||
public function __construct(Location $location, Block $block, ?CompoundTag $nbt = null){
|
||||
$this->block = $block;
|
||||
parent::__construct($location, $nbt);
|
||||
|
@ -59,8 +59,6 @@ class ItemEntity extends Entity{
|
||||
/** @var Item */
|
||||
protected $item;
|
||||
|
||||
public $canCollide = false;
|
||||
|
||||
/** @var int */
|
||||
protected $despawnDelay = self::DEFAULT_DESPAWN_DELAY;
|
||||
|
||||
|
@ -46,8 +46,6 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
|
||||
protected bool $worksUnderwater = false;
|
||||
|
||||
public $canCollide = false;
|
||||
|
||||
protected function getInitialSizeInfo() : EntitySizeInfo{ return new EntitySizeInfo(0.98, 0.98); }
|
||||
|
||||
protected function getInitialDragMultiplier() : float{ return 0.02; }
|
||||
|
@ -1904,11 +1904,9 @@ class World implements ChunkManager{
|
||||
public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{
|
||||
$nearby = [];
|
||||
|
||||
if($entity === null || $entity->canCollide){
|
||||
foreach($this->getNearbyEntities($bb, $entity) as $ent){
|
||||
if($ent->canBeCollidedWith() && ($entity === null || $entity->canCollideWith($ent))){
|
||||
$nearby[] = $ent;
|
||||
}
|
||||
foreach($this->getNearbyEntities($bb, $entity) as $ent){
|
||||
if($ent->canBeCollidedWith() && ($entity === null || $entity->canCollideWith($ent))){
|
||||
$nearby[] = $ent;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user