mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-10 15:59:39 +00:00
Merge branch '3.5'
This commit is contained in:
commit
5c24ac604a
@ -2247,9 +2247,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param Chunk|null $chunk
|
||||
* @param bool $unload
|
||||
* @param bool $deleteEntitiesAndTiles Whether to delete entities and tiles on the old chunk, or transfer them to the new one
|
||||
*/
|
||||
public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null, bool $unload = true){
|
||||
public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null, bool $deleteEntitiesAndTiles = true){
|
||||
if($chunk === null){
|
||||
return;
|
||||
}
|
||||
@ -2260,7 +2260,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
$chunkHash = Level::chunkHash($chunkX, $chunkZ);
|
||||
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
||||
if($oldChunk !== null and $oldChunk !== $chunk){
|
||||
if($unload){
|
||||
if($deleteEntitiesAndTiles){
|
||||
$players = $this->getChunkPlayers($chunkX, $chunkZ);
|
||||
foreach($players as $player){
|
||||
$chunk->addEntity($player);
|
||||
$oldChunk->removeEntity($player);
|
||||
$player->chunk = $chunk;
|
||||
}
|
||||
//TODO: this causes chunkloaders to receive false "unloaded" notifications
|
||||
$this->unloadChunk($chunkX, $chunkZ, false, false);
|
||||
}else{
|
||||
foreach($oldChunk->getEntities() as $entity){
|
||||
|
Loading…
x
Reference in New Issue
Block a user