more packets will be always sent to the client

This commit is contained in:
GameHerobrine 2025-05-13 03:15:49 +03:00
parent 5458c04983
commit fe07ec81ee
13 changed files with 85 additions and 68 deletions

View file

@ -72,7 +72,7 @@ abstract class Creature extends Living{
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->metadata = $this->getMetadata();
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
$pk = new SetEntityMotionPacket;
$pk->eid = $this->eid;

View file

@ -1125,14 +1125,7 @@ class Entity extends Position
$pk->itemID = 0;
$pk->itemAuxValue = 0;
$pk->metadata = $this->getMetadata();
$player->directDataPacket($pk, 2, true);
$pk = new SetEntityMotionPacket();
$pk->eid = $this->eid;
$pk->speedX = $this->speedX;
$pk->speedY = $this->speedY;
$pk->speedZ = $this->speedZ;
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk, 2, true);
$pk = new PlayerEquipmentPacket();
$pk->eid = $this->eid;
@ -1142,18 +1135,6 @@ class Entity extends Position
$player->dataPacket($pk);
$this->player->sendArmor($player);
break;
case ENTITY_FALLING:
$pk = new AddEntityPacket();
$pk->eid = $this->eid;
$pk->type = $this->type;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->speedX = $this->speedX;
$pk->speedY = $this->speedY;
$pk->speedZ = $this->speedZ;
$pk->did = -$this->data["Tile"];
$player->dataPacket($pk);
}
if($this->linkedEntity != 0 && $this->isRider){
@ -1563,6 +1544,7 @@ class Entity extends Position
"health" => $health,
"cause" => $cause
)) !== false or $force === true){
$this->health = min(127, max(- 127, $health));
if($harm === true && $allowHarm){
$pk = new EntityEventPacket;
@ -1578,6 +1560,7 @@ class Entity extends Position
}
}
}
if($this->player instanceof Player){
$pk = new SetHealthPacket();
$pk->health = $this->health;

View file

@ -210,7 +210,7 @@ abstract class Projectile extends Entity{
$pk->speedY = $this->speedY;
$pk->speedZ = $this->speedZ;
$pk->did = 0;
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
}
}

View file

@ -272,7 +272,7 @@ class Arrow extends Entity{
$pk->speedX = $this->speedX;
$pk->speedY = $this->speedY;
$pk->speedZ = $this->speedZ;
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
}
}
}

View file

@ -19,6 +19,20 @@ class FallingSand extends Entity{
public function isPickable(){
return !$this->dead;
}
public function spawn($player)
{
$pk = new AddEntityPacket();
$pk->eid = $this->eid;
$pk->type = $this->type;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->speedX = $this->speedX;
$pk->speedY = $this->speedY;
$pk->speedZ = $this->speedZ;
$pk->did = -$this->data["Tile"];
$player->dataPacketAlwaysRecover($pk);
}
public function update($now){
if($this->closed) return;

View file

@ -54,7 +54,7 @@ class ItemEntity extends Entity{
$pk->roll = 0;
$pk->item = BlockAPI::getItem($this->itemID, $this->meta, $this->stack);
$pk->metadata = $this->getMetadata();
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
$pk = new SetEntityMotionPacket();
$pk->eid = $this->eid;

View file

@ -435,8 +435,8 @@ class Minecart extends Vehicle{
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
$pk = new SetEntityMotionPacket;
$pk->eid = $this->eid;
$pk->speedX = $this->speedX;

View file

@ -205,6 +205,6 @@ class Painting extends Entity{
$pk->z = (int) $this->zPos;
$pk->direction = $this->direction;
$pk->title = $this->motive;
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
}
}

View file

@ -76,6 +76,6 @@ class PrimedTNT extends Entity{
$pk->speedX = $this->speedX;
$pk->speedY = $this->speedY;
$pk->speedZ = $this->speedZ;
$player->dataPacket($pk);
$player->dataPacketAlwaysRecover($pk);
}
}