Entity: make networkProperties private

this reduces the temptation to use it in high-level code, as well as making syncNetworkData() more useful (now it can export to many data collections, which means we can start to think about having a property cache per network session, which is more flexible)
This commit is contained in:
Dylan K. Taylor
2020-05-21 20:29:06 +01:00
parent 1aa92bd6a8
commit 6257f717b1
11 changed files with 71 additions and 61 deletions

View File

@ -29,6 +29,7 @@ use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ShortTag;
use pocketmine\network\mcpe\protocol\types\entity\EntityLegacyIds;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
use pocketmine\player\Player;
use function sqrt;
@ -220,9 +221,9 @@ class ExperienceOrb extends Entity{
return false;
}
protected function syncNetworkData() : void{
parent::syncNetworkData();
protected function syncNetworkData(EntityMetadataCollection $properties) : void{
parent::syncNetworkData($properties);
$this->networkProperties->setInt(EntityMetadataProperties::EXPERIENCE_VALUE, $this->xpValue);
$properties->setInt(EntityMetadataProperties::EXPERIENCE_VALUE, $this->xpValue);
}
}