mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 08:49:42 +00:00
World: fix more implicit chunk loading bugs (getCollidingEntities(), getNearbyEntities(), getNearestEntity())
This commit is contained in:
parent
1111d0d4c7
commit
a4042e5d18
@ -1826,6 +1826,9 @@ class World implements ChunkManager{
|
|||||||
|
|
||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||||
|
if(!$this->isChunkLoaded($x, $z)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach($this->getChunkEntities($x, $z) as $ent){
|
foreach($this->getChunkEntities($x, $z) as $ent){
|
||||||
/** @var Entity|null $entity */
|
/** @var Entity|null $entity */
|
||||||
if($ent->canBeCollidedWith() and ($entity === null or ($ent !== $entity and $entity->canCollideWith($ent))) and $ent->boundingBox->intersectsWith($bb)){
|
if($ent->canBeCollidedWith() and ($entity === null or ($ent !== $entity and $entity->canCollideWith($ent))) and $ent->boundingBox->intersectsWith($bb)){
|
||||||
@ -1857,6 +1860,9 @@ class World implements ChunkManager{
|
|||||||
|
|
||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||||
|
if(!$this->isChunkLoaded($x, $z)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach($this->getChunkEntities($x, $z) as $ent){
|
foreach($this->getChunkEntities($x, $z) as $ent){
|
||||||
if($ent !== $entity and $ent->boundingBox->intersectsWith($bb)){
|
if($ent !== $entity and $ent->boundingBox->intersectsWith($bb)){
|
||||||
$nearby[] = $ent;
|
$nearby[] = $ent;
|
||||||
@ -1893,6 +1899,9 @@ class World implements ChunkManager{
|
|||||||
|
|
||||||
for($x = $minX; $x <= $maxX; ++$x){
|
for($x = $minX; $x <= $maxX; ++$x){
|
||||||
for($z = $minZ; $z <= $maxZ; ++$z){
|
for($z = $minZ; $z <= $maxZ; ++$z){
|
||||||
|
if(!$this->isChunkLoaded($x, $z)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach($this->getChunkEntities($x, $z) as $entity){
|
foreach($this->getChunkEntities($x, $z) as $entity){
|
||||||
if(!($entity instanceof $entityType) or $entity->isFlaggedForDespawn() or (!$includeDead and !$entity->isAlive())){
|
if(!($entity instanceof $entityType) or $entity->isFlaggedForDespawn() or (!$includeDead and !$entity->isAlive())){
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user