mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
Revert "World: make the second parameter for getCollidingEntities() mandatory and non-nullable"
This reverts commit e1b7bf31bbbf8a0c679bdf238cf7594881d0842b. fixes #4447
This commit is contained in:
parent
cf762d345d
commit
9d5a86fe53
@ -1836,7 +1836,7 @@ class World implements ChunkManager{
|
|||||||
foreach($tx->getBlocks() as [$x, $y, $z, $block]){
|
foreach($tx->getBlocks() as [$x, $y, $z, $block]){
|
||||||
$block->position($this, $x, $y, $z);
|
$block->position($this, $x, $y, $z);
|
||||||
foreach($block->getCollisionBoxes() as $collisionBox){
|
foreach($block->getCollisionBoxes() as $collisionBox){
|
||||||
if(count($this->getNearbyEntities($collisionBox)) > 0){
|
if(count($this->getCollidingEntities($collisionBox)) > 0){
|
||||||
return false; //Entity in block
|
return false; //Entity in block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1910,12 +1910,12 @@ class World implements ChunkManager{
|
|||||||
*
|
*
|
||||||
* @return Entity[]
|
* @return Entity[]
|
||||||
*/
|
*/
|
||||||
public function getCollidingEntities(AxisAlignedBB $bb, Entity $entity) : array{
|
public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{
|
||||||
$nearby = [];
|
$nearby = [];
|
||||||
|
|
||||||
if($entity->canCollide){
|
if($entity === null or $entity->canCollide){
|
||||||
foreach($this->getNearbyEntities($bb, $entity) as $ent){
|
foreach($this->getNearbyEntities($bb, $entity) as $ent){
|
||||||
if($ent->canBeCollidedWith() and $entity->canCollideWith($ent)){
|
if($ent->canBeCollidedWith() and ($entity === null or $entity->canCollideWith($ent))){
|
||||||
$nearby[] = $ent;
|
$nearby[] = $ent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user