mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +00:00
Merge commit '71f2a34616961d6328f06fd911b6d4450a61643e'
This commit is contained in:
commit
a78248a19c
@ -1436,14 +1436,11 @@ abstract class Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function spawnTo(Player $player) : void{
|
public function spawnTo(Player $player) : void{
|
||||||
if($player->getWorld() !== $this->getWorld()){
|
|
||||||
throw new \InvalidArgumentException("Player is not in the same world");
|
|
||||||
}
|
|
||||||
$id = spl_object_id($player);
|
$id = spl_object_id($player);
|
||||||
//TODO: this will cause some visible lag during chunk resends; if the player uses a spawn egg in a chunk, the
|
//TODO: this will cause some visible lag during chunk resends; if the player uses a spawn egg in a chunk, the
|
||||||
//created entity won't be visible until after the resend arrives. However, this is better than possibly crashing
|
//created entity won't be visible until after the resend arrives. However, this is better than possibly crashing
|
||||||
//the player by sending them entities too early.
|
//the player by sending them entities too early.
|
||||||
if(!isset($this->hasSpawned[$id]) and $player->hasReceivedChunk($this->location->getFloorX() >> Chunk::COORD_BIT_SIZE, $this->location->getFloorZ() >> Chunk::COORD_BIT_SIZE)){
|
if(!isset($this->hasSpawned[$id]) and $player->getWorld() === $this->getWorld() and $player->hasReceivedChunk($this->location->getFloorX() >> Chunk::COORD_BIT_SIZE, $this->location->getFloorZ() >> Chunk::COORD_BIT_SIZE)){
|
||||||
$this->hasSpawned[$id] = $player;
|
$this->hasSpawned[$id] = $player;
|
||||||
|
|
||||||
$this->sendSpawnPacket($player);
|
$this->sendSpawnPacket($player);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user