diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 790684481..3aaa1ee37 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2254,13 +2254,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, $this->level->sendBlocks([$this], $blocks); - foreach($blocks as $b){ - $tile = $this->level->getTile($b); - if($tile instanceof Spawnable){ - $tile->spawnTo($this); - } - } - return false; } @@ -2490,7 +2483,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, throw new BadPacketException($e->getMessage(), 0, $e); } if(!$t->updateCompoundTag($compound, $this)){ - $t->spawnTo($this); + $this->level->sendBlocks([$this], [$pos]); } } @@ -2508,7 +2501,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener, $ev->call(); if($ev->isCancelled()){ - $tile->spawnTo($this); + $this->level->sendBlocks([$this], [$tile]); return true; } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 40981b0f1..3c4a6f48b 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -975,8 +975,12 @@ class Level implements ChunkManager, Metadatable{ $fullBlock = $this->getFullBlock($b->x, $b->y, $b->z); $pk->blockRuntimeId = BlockFactory::toStaticRuntimeId($fullBlock >> 4, $fullBlock & 0xf); } - $packets[] = $pk; + + $tile = $this->getTileAt($b->x, $b->y, $b->z); + if($tile instanceof Spawnable){ + $packets[] = $tile->createSpawnPacket(); + } } $this->server->broadcastPackets($target, $packets); diff --git a/src/pocketmine/tile/Spawnable.php b/src/pocketmine/tile/Spawnable.php index 10f272901..d16eee621 100644 --- a/src/pocketmine/tile/Spawnable.php +++ b/src/pocketmine/tile/Spawnable.php @@ -50,16 +50,6 @@ abstract class Spawnable extends Tile{ return $pk; } - public function spawnTo(Player $player) : bool{ - if($this->closed){ - return false; - } - - $player->sendDataPacket($this->createSpawnPacket()); - - return true; - } - /** * Flags the tile as modified, so that updates will be broadcasted at the next available opportunity. * This MUST be called any time a change is made that players must be able to see.