mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +00:00
Improved saving of modified properties
This commit is contained in:
parent
66f28f6dc4
commit
92a2be024a
@ -2299,8 +2299,6 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$chunk->setChanged(false);
|
|
||||||
|
|
||||||
if($this->isChunkInUse($x, $z)){
|
if($this->isChunkInUse($x, $z)){
|
||||||
foreach($this->getChunkLoaders($x, $z) as $loader){
|
foreach($this->getChunkLoaders($x, $z) as $loader){
|
||||||
$loader->onChunkLoaded($chunk);
|
$loader->onChunkLoaded($chunk);
|
||||||
|
@ -108,55 +108,60 @@ abstract class BaseFullChunk implements FullChunk{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function initChunk(){
|
public function initChunk(){
|
||||||
if($this->getProvider() instanceof LevelProvider and !$this->isInit and $this->NBTentities !== null){
|
if($this->getProvider() instanceof LevelProvider and !$this->isInit){
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->startTiming();
|
$changed = false;
|
||||||
foreach($this->NBTentities as $nbt){
|
if($this->NBTentities !== null){
|
||||||
if($nbt instanceof Compound){
|
$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->startTiming();
|
||||||
if(!isset($nbt->id)){
|
foreach($this->NBTentities as $nbt){
|
||||||
$this->setChanged();
|
if($nbt instanceof Compound){
|
||||||
continue;
|
if(!isset($nbt->id)){
|
||||||
}
|
$this->setChanged();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(($nbt["Pos"][0] >> 4) !== $this->x or ($nbt["Pos"][2] >> 4) !== $this->z){
|
if(($nbt["Pos"][0] >> 4) !== $this->x or ($nbt["Pos"][2] >> 4) !== $this->z){
|
||||||
$this->setChanged();
|
$changed = true;
|
||||||
continue; //Fixes entities allocated in wrong chunks.
|
continue; //Fixes entities allocated in wrong chunks.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($entity = Entity::createEntity($nbt["id"], $this, $nbt)) instanceof Entity){
|
if(($entity = Entity::createEntity($nbt["id"], $this, $nbt)) instanceof Entity){
|
||||||
$entity->spawnToAll();
|
$entity->spawnToAll();
|
||||||
}else{
|
}else{
|
||||||
$this->setChanged();
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->stopTiming();
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->stopTiming();
|
|
||||||
|
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->startTiming();
|
$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->startTiming();
|
||||||
foreach($this->NBTtiles as $nbt){
|
foreach($this->NBTtiles as $nbt){
|
||||||
if($nbt instanceof Compound){
|
if($nbt instanceof Compound){
|
||||||
if(!isset($nbt->id)){
|
if(!isset($nbt->id)){
|
||||||
$this->setChanged();
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($nbt["x"] >> 4) !== $this->x or ($nbt["z"] >> 4) !== $this->z){
|
if(($nbt["x"] >> 4) !== $this->x or ($nbt["z"] >> 4) !== $this->z){
|
||||||
$this->setChanged();
|
$changed = true;
|
||||||
continue; //Fixes tiles allocated in wrong chunks.
|
continue; //Fixes tiles allocated in wrong chunks.
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Tile::createTile($nbt["id"], $this, $nbt) === null){
|
if(Tile::createTile($nbt["id"], $this, $nbt) === null){
|
||||||
$this->setChanged();
|
$changed = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->stopTiming();
|
||||||
|
|
||||||
|
$this->NBTentities = null;
|
||||||
|
$this->NBTtiles = null;
|
||||||
|
|
||||||
|
$this->setChanged($changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->stopTiming();
|
|
||||||
|
|
||||||
$this->NBTentities = null;
|
|
||||||
$this->NBTtiles = null;
|
|
||||||
|
|
||||||
$this->isInit = true;
|
$this->isInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user