rename Entity->propertyManager -> Entity->networkProperties

This commit is contained in:
Dylan K. Taylor 2019-07-29 18:24:29 +01:00
parent 452cfe2f59
commit 96d8790028
11 changed files with 43 additions and 43 deletions

View File

@ -36,6 +36,6 @@ abstract class Animal extends Living implements Ageable{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setGenericFlag(EntityMetadataFlags::BABY, $this->baby);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::BABY, $this->baby);
}
}

View File

@ -93,7 +93,7 @@ abstract class Entity extends Location{
protected $id;
/** @var EntityMetadataCollection */
protected $propertyManager;
protected $networkProperties;
/** @var Chunk|null */
public $chunk;
@ -261,7 +261,7 @@ abstract class Entity extends Location{
$this->resetLastMovements();
$this->propertyManager = new EntityMetadataCollection();
$this->networkProperties = new EntityMetadataCollection();
$this->attributeMap = new AttributeMap();
$this->addAttributes();
@ -709,8 +709,8 @@ abstract class Entity extends Location{
return $this->attributeMap;
}
public function getDataPropertyManager() : EntityMetadataCollection{
return $this->propertyManager;
public function getNetworkProperties() : EntityMetadataCollection{
return $this->networkProperties;
}
protected function entityBaseTick(int $tickDiff = 1) : bool{
@ -721,7 +721,7 @@ abstract class Entity extends Location{
$changedProperties = $this->getSyncedNetworkData(true);
if(!empty($changedProperties)){
$this->sendData($this->hasSpawned, $changedProperties);
$this->propertyManager->clearDirtyProperties();
$this->networkProperties->clearDirtyProperties();
}
$hasUpdate = false;
@ -1755,29 +1755,29 @@ abstract class Entity extends Location{
final protected function getSyncedNetworkData(bool $dirtyOnly) : array{
$this->syncNetworkData();
return $dirtyOnly ? $this->propertyManager->getDirty() : $this->propertyManager->getAll();
return $dirtyOnly ? $this->networkProperties->getDirty() : $this->networkProperties->getAll();
}
protected function syncNetworkData() : void{
$this->propertyManager->setByte(EntityMetadataProperties::ALWAYS_SHOW_NAMETAG, $this->alwaysShowNameTag ? 1 : 0);
$this->propertyManager->setFloat(EntityMetadataProperties::BOUNDING_BOX_HEIGHT, $this->height);
$this->propertyManager->setFloat(EntityMetadataProperties::BOUNDING_BOX_WIDTH, $this->width);
$this->propertyManager->setFloat(EntityMetadataProperties::SCALE, $this->scale);
$this->propertyManager->setLong(EntityMetadataProperties::LEAD_HOLDER_EID, -1);
$this->propertyManager->setLong(EntityMetadataProperties::OWNER_EID, $this->ownerId ?? -1);
$this->propertyManager->setLong(EntityMetadataProperties::TARGET_EID, $this->targetId ?? -1);
$this->propertyManager->setString(EntityMetadataProperties::NAMETAG, $this->nameTag);
$this->propertyManager->setString(EntityMetadataProperties::SCORE_TAG, $this->scoreTag);
$this->networkProperties->setByte(EntityMetadataProperties::ALWAYS_SHOW_NAMETAG, $this->alwaysShowNameTag ? 1 : 0);
$this->networkProperties->setFloat(EntityMetadataProperties::BOUNDING_BOX_HEIGHT, $this->height);
$this->networkProperties->setFloat(EntityMetadataProperties::BOUNDING_BOX_WIDTH, $this->width);
$this->networkProperties->setFloat(EntityMetadataProperties::SCALE, $this->scale);
$this->networkProperties->setLong(EntityMetadataProperties::LEAD_HOLDER_EID, -1);
$this->networkProperties->setLong(EntityMetadataProperties::OWNER_EID, $this->ownerId ?? -1);
$this->networkProperties->setLong(EntityMetadataProperties::TARGET_EID, $this->targetId ?? -1);
$this->networkProperties->setString(EntityMetadataProperties::NAMETAG, $this->nameTag);
$this->networkProperties->setString(EntityMetadataProperties::SCORE_TAG, $this->scoreTag);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::AFFECTED_BY_GRAVITY, true);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::CAN_CLIMB, $this->canClimb);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::CAN_SHOW_NAMETAG, $this->nameTagVisible);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::HAS_COLLISION, true);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::IMMOBILE, $this->immobile);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::INVISIBLE, $this->invisible);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::ONFIRE, $this->isOnFire());
$this->propertyManager->setGenericFlag(EntityMetadataFlags::SNEAKING, $this->sneaking);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::WALLCLIMBING, $this->canClimbWalls);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::AFFECTED_BY_GRAVITY, true);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::CAN_CLIMB, $this->canClimb);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::CAN_SHOW_NAMETAG, $this->nameTagVisible);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::HAS_COLLISION, true);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::IMMOBILE, $this->immobile);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::INVISIBLE, $this->invisible);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::ONFIRE, $this->isOnFire());
$this->networkProperties->setGenericFlag(EntityMetadataFlags::SNEAKING, $this->sneaking);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::WALLCLIMBING, $this->canClimbWalls);
}
public function broadcastEntityEvent(int $eventId, ?int $eventData = null, ?array $players = null) : void{

View File

@ -770,12 +770,12 @@ abstract class Living extends Entity{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setByte(EntityMetadataProperties::POTION_AMBIENT, $this->effectManager->hasOnlyAmbientEffects() ? 1 : 0);
$this->propertyManager->setInt(EntityMetadataProperties::POTION_COLOR, Binary::signInt($this->effectManager->getBubbleColor()->toARGB()));
$this->propertyManager->setShort(EntityMetadataProperties::AIR, $this->breathTicks);
$this->propertyManager->setShort(EntityMetadataProperties::MAX_AIR, $this->maxBreathTicks);
$this->networkProperties->setByte(EntityMetadataProperties::POTION_AMBIENT, $this->effectManager->hasOnlyAmbientEffects() ? 1 : 0);
$this->networkProperties->setInt(EntityMetadataProperties::POTION_COLOR, Binary::signInt($this->effectManager->getBubbleColor()->toARGB()));
$this->networkProperties->setShort(EntityMetadataProperties::AIR, $this->breathTicks);
$this->networkProperties->setShort(EntityMetadataProperties::MAX_AIR, $this->maxBreathTicks);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::BREATHING, $this->breathing);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::BREATHING, $this->breathing);
}
protected function onDispose() : void{

View File

@ -88,8 +88,8 @@ class Villager extends Living implements Ageable{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setGenericFlag(EntityMetadataFlags::BABY, $this->baby);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::BABY, $this->baby);
$this->propertyManager->setInt(EntityMetadataProperties::VARIANT, $this->profession);
$this->networkProperties->setInt(EntityMetadataProperties::VARIANT, $this->profession);
}
}

View File

@ -45,6 +45,6 @@ abstract class WaterAnimal extends Living implements Ageable{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setGenericFlag(EntityMetadataFlags::BABY, $this->baby);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::BABY, $this->baby);
}
}

View File

@ -232,6 +232,6 @@ class ExperienceOrb extends Entity{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setInt(EntityMetadataProperties::EXPERIENCE_VALUE, $this->xpValue);
$this->networkProperties->setInt(EntityMetadataProperties::EXPERIENCE_VALUE, $this->xpValue);
}
}

View File

@ -140,6 +140,6 @@ class FallingBlock extends Entity{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setInt(EntityMetadataProperties::VARIANT, $this->block->getRuntimeId());
$this->networkProperties->setInt(EntityMetadataProperties::VARIANT, $this->block->getRuntimeId());
}
}

View File

@ -111,7 +111,7 @@ class PrimedTNT extends Entity implements Explosive{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setGenericFlag(EntityMetadataFlags::IGNITED, true);
$this->propertyManager->setInt(EntityMetadataProperties::FUSE_LENGTH, $this->fuse);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::IGNITED, true);
$this->networkProperties->setInt(EntityMetadataProperties::FUSE_LENGTH, $this->fuse);
}
}

View File

@ -206,6 +206,6 @@ class Arrow extends Projectile{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setGenericFlag(EntityMetadataFlags::CRITICAL, $this->critical);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::CRITICAL, $this->critical);
}
}

View File

@ -181,7 +181,7 @@ class SplashPotion extends Throwable{
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setShort(EntityMetadataProperties::POTION_AUX_VALUE, $this->potionId);
$this->propertyManager->setGenericFlag(EntityMetadataFlags::LINGER, $this->linger);
$this->networkProperties->setShort(EntityMetadataProperties::POTION_AUX_VALUE, $this->potionId);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::LINGER, $this->linger);
}
}

View File

@ -2364,10 +2364,10 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
protected function syncNetworkData() : void{
parent::syncNetworkData();
$this->propertyManager->setGenericFlag(EntityMetadataFlags::ACTION, $this->startAction > -1);
$this->networkProperties->setGenericFlag(EntityMetadataFlags::ACTION, $this->startAction > -1);
$this->propertyManager->setPlayerFlag(PlayerMetadataFlags::SLEEP, $this->sleeping !== null);
$this->propertyManager->setBlockPos(EntityMetadataProperties::PLAYER_BED_POSITION, $this->sleeping ?? new Vector3(0, 0, 0));
$this->networkProperties->setPlayerFlag(PlayerMetadataFlags::SLEEP, $this->sleeping !== null);
$this->networkProperties->setBlockPos(EntityMetadataProperties::PLAYER_BED_POSITION, $this->sleeping ?? new Vector3(0, 0, 0));
}
public function broadcastEntityEvent(int $eventId, ?int $eventData = null, ?array $players = null) : void{