NetworkSession: do not mark shared attributes as synchronized, they don't necessarily belong to us

if we decided to start sending entity attribute changes to viewers too, this would have caused some unexpected behaviour.
This commit is contained in:
Dylan K. Taylor 2020-04-29 16:38:10 +01:00
parent f35b7bf80b
commit f6f714c158
2 changed files with 3 additions and 3 deletions

View File

@ -686,9 +686,6 @@ class NetworkSession{
$this->sendDataPacket(UpdateAttributesPacket::create($entity->getId(), array_map(function(Attribute $attr) : NetworkAttribute{
return new NetworkAttribute($attr->getId(), $attr->getMinValue(), $attr->getMaxValue(), $attr->getValue(), $attr->getDefaultValue());
}, $entries)));
foreach($entries as $entry){
$entry->markSynchronized();
}
}
}

View File

@ -1292,6 +1292,9 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
//TODO: move this to network session ticking (this is specifically related to net sync)
$this->networkSession->syncAttributes($this);
foreach($this->attributeMap->getAll() as $attribute){
$attribute->markSynchronized();
}
if(!$this->isAlive() and $this->spawned){
$this->onDeathUpdate($tickDiff);