mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
World: specialize nearby entity updating for block updates
this slashes the cost of checking this with no entities by 50%, which should be the common case for farms and such. once factoring in other things, this translates into a real-world performance gain of about 15% for block updates.
This commit is contained in:
parent
8b52a5cd9e
commit
128eb500eb
@ -986,8 +986,11 @@ class World implements ChunkManager{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
foreach($this->getNearbyEntities(AxisAlignedBB::one()->offset($x, $y, $z)) as $entity){
|
||||
$entity->onNearbyBlockChange();
|
||||
$cellAABB = AxisAlignedBB::one()->offset($x, $y, $z);
|
||||
foreach($this->getChunkEntities($x >> Chunk::COORD_BIT_SIZE, $z >> Chunk::COORD_BIT_SIZE) as $entity){
|
||||
if($entity->getBoundingBox()->intersectsWith($cellAABB)){
|
||||
$entity->onNearbyBlockChange();
|
||||
}
|
||||
}
|
||||
$block->onNearbyBlockChange();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user