Implemented #2556: don't send tile NBT updates until the end of tick

this eliminates spam when tile spawn NBT changes a lot during a tick, for example the lines of a sign being updated.

closes #2556
This commit is contained in:
Dylan K. Taylor
2018-12-26 22:18:47 +00:00
parent 2c6381632c
commit a6cd9ae029
3 changed files with 30 additions and 21 deletions

View File

@ -798,6 +798,12 @@ class Level implements ChunkManager, Metadatable{
if(!$tile->onUpdate()){
unset($this->updateTiles[$blockHash]);
}
if(!$tile->isClosed() and $tile instanceof Spawnable and $tile->isDirty()){
$this->clearChunkCache($tile->getFloorX() >> 4, $tile->getFloorZ() >> 4);
//TODO: merge this with block-updating (it'll send useless data if a full-chunk resend happens)
$this->broadcastPacketToViewers($tile, $tile->createSpawnPacket());
$tile->setDirty(false);
}
}
Timings::$tickTileEntityTimer->stopTiming();
$this->timings->tileEntityTick->stopTiming();
@ -2587,10 +2593,6 @@ class Level implements ChunkManager, Metadatable{
$this->tiles[Level::blockHash($tile->x, $tile->y, $tile->z)] = $tile;
$tile->scheduleUpdate();
if($tile instanceof Spawnable){
$this->clearChunkCache($chunkX, $chunkZ);
$tile->spawnToAll();
}
}
/**