mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 05:34:54 +00:00
Move attribute net sync to NetworkSession
This commit is contained in:
parent
64afb6f2e2
commit
f43d20b47a
@ -958,6 +958,14 @@ class NetworkSession{
|
||||
|
||||
if($this->player !== null){
|
||||
$this->player->doChunkRequests();
|
||||
|
||||
$dirtyAttributes = $this->player->getAttributeMap()->needSend();
|
||||
$this->syncAttributes($this->player, $dirtyAttributes);
|
||||
foreach($dirtyAttributes as $attribute){
|
||||
//TODO: we might need to send these to other players in the future
|
||||
//if that happens, this will need to become more complex than a flag on the attribute itself
|
||||
$attribute->markSynchronized();
|
||||
}
|
||||
}
|
||||
|
||||
$this->flushSendBuffer();
|
||||
|
@ -1322,13 +1322,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
|
||||
$this->lastUpdate = $currentTick;
|
||||
|
||||
//TODO: move this to network session ticking (this is specifically related to net sync)
|
||||
$dirtyAttributes = $this->attributeMap->needSend();
|
||||
$this->networkSession->syncAttributes($this, $dirtyAttributes);
|
||||
foreach($dirtyAttributes as $attribute){
|
||||
$attribute->markSynchronized();
|
||||
}
|
||||
|
||||
if(!$this->isAlive() and $this->spawned){
|
||||
$this->onDeathUpdate($tickDiff);
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user