Refactored entity IDs in packets for consistency and to clarify on types

This commit is contained in:
Dylan K. Taylor
2017-06-05 15:41:27 +01:00
parent 51d510aa4f
commit 54453d0b0a
21 changed files with 58 additions and 58 deletions

View File

@ -396,7 +396,7 @@ class Effect{
}
if($entity instanceof Player){
$pk = new MobEffectPacket();
$pk->eid = $entity->getId();
$pk->entityRuntimeId = $entity->getId();
$pk->effectId = $this->getId();
$pk->amplifier = $this->getAmplifier();
$pk->particles = $this->isVisible();
@ -468,7 +468,7 @@ class Effect{
}
if($entity instanceof Player){
$pk = new MobEffectPacket();
$pk->eid = $entity->getId();
$pk->entityRuntimeId = $entity->getId();
$pk->eventId = MobEffectPacket::EVENT_REMOVE;
$pk->effectId = $this->getId();

View File

@ -834,7 +834,7 @@ abstract class Entity extends Location implements Metadatable{
public function sendPotionEffects(Player $player){
foreach($this->effects as $effect){
$pk = new MobEffectPacket();
$pk->eid = $this->id;
$pk->entityRuntimeId = $this->id;
$pk->effectId = $effect->getId();
$pk->amplifier = $effect->getAmplifier();
$pk->particles = $effect->isVisible();
@ -855,7 +855,7 @@ abstract class Entity extends Location implements Metadatable{
}
$pk = new SetEntityDataPacket();
$pk->eid = $this->getId();
$pk->entityRuntimeId = $this->getId();
$pk->metadata = $data === null ? $this->dataProperties : $data;
foreach($player as $p){
@ -878,7 +878,7 @@ abstract class Entity extends Location implements Metadatable{
if(isset($this->hasSpawned[$player->getLoaderId()])){
if($send){
$pk = new RemoveEntityPacket();
$pk->eid = $this->id;
$pk->entityUniqueId = $this->id;
$player->dataPacket($pk);
}
unset($this->hasSpawned[$player->getLoaderId()]);

View File

@ -73,7 +73,7 @@ abstract class Living extends Entity implements Damageable{
$this->attributeMap->getAttribute(Attribute::HEALTH)->setValue($this->getHealth(), true);
if($this->isAlive() and !$wasAlive){
$pk = new EntityEventPacket();
$pk->eid = $this->getId();
$pk->entityRuntimeId = $this->getId();
$pk->event = EntityEventPacket::RESPAWN;
$this->server->broadcastPacket($this->hasSpawned, $pk);
}
@ -166,7 +166,7 @@ abstract class Living extends Entity implements Damageable{
}
$pk = new EntityEventPacket();
$pk->eid = $this->getId();
$pk->entityRuntimeId = $this->getId();
$pk->event = $this->getHealth() <= 0 ? EntityEventPacket::DEATH_ANIMATION : EntityEventPacket::HURT_ANIMATION; //Ouch!
$this->server->broadcastPacket($this->hasSpawned, $pk);

View File

@ -65,7 +65,7 @@ class Squid extends WaterAnimal implements Ageable{
}
$pk = new EntityEventPacket();
$pk->eid = $this->getId();
$pk->entityRuntimeId = $this->getId();
$pk->event = EntityEventPacket::SQUID_INK_CLOUD;
$this->server->broadcastPacket($this->hasSpawned, $pk);
}