mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 07:39:57 +00:00
World: ignore entities calling onEntityMoved() who aren't members of the world
this can happen if movement or teleportation occurs during the creation of an entity.
This commit is contained in:
parent
b2bab6c2fb
commit
1f330c0f50
@ -2180,6 +2180,10 @@ class World implements ChunkManager{
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function onEntityMoved(Entity $entity, Position $oldPosition) : void{
|
public function onEntityMoved(Entity $entity, Position $oldPosition) : void{
|
||||||
|
if(!array_key_exists($entity->getId(), $this->entities)){
|
||||||
|
//this can happen if the entity was teleported before addEntity() was called
|
||||||
|
return;
|
||||||
|
}
|
||||||
$newPosition = $entity->getPosition();
|
$newPosition = $entity->getPosition();
|
||||||
|
|
||||||
$oldChunkX = $oldPosition->getFloorX() >> 4;
|
$oldChunkX = $oldPosition->getFloorX() >> 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user