Improved network packets allocation

This commit is contained in:
Shoghi Cervantes
2014-10-27 20:30:33 +01:00
parent 3f5b129cf5
commit db82f76c11
69 changed files with 366 additions and 222 deletions

View File

@ -150,7 +150,7 @@ class FallingBlock extends Entity{
}
public function spawnTo(Player $player){
$pk = new AddEntityPacket;
$pk = AddEntityPacket::getFromPool();
$pk->type = FallingBlock::NETWORK_ID;
$pk->eid = $this->getID();
$pk->x = $this->x;
@ -159,7 +159,7 @@ class FallingBlock extends Entity{
$pk->did = -$this->getBlock();
$player->dataPacket($pk);
$pk = new SetEntityMotionPacket;
$pk = SetEntityMotionPacket::getFromPool();
$pk->entities = [
[$this->getID(), $this->motionX, $this->motionY, $this->motionZ]
];