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

@ -252,13 +252,13 @@ class Furnace extends Tile implements InventoryHolder, Container{
foreach($this->getInventory()->getViewers() as $player){
$windowId = $player->getWindowId($this->getInventory());
if($windowId > 0){
$pk = new ContainerSetDataPacket;
$pk = ContainerSetDataPacket::getFromPool();
$pk->windowid = $windowId;
$pk->property = 0; //Smelting
$pk->value = floor($this->namedtag["CookTime"]);
$player->dataPacket($pk);
$pk = new ContainerSetDataPacket;
$pk = ContainerSetDataPacket::getFromPool();
$pk->windowid = $windowId;
$pk->property = 1; //Fire icon
$pk->value = $this->namedtag["BurnTicks"];

View File

@ -36,7 +36,7 @@ abstract class Spawnable extends Tile{
$nbt = new NBT(NBT::LITTLE_ENDIAN);
$nbt->setData($this->getSpawnCompound());
$pk = new EntityDataPacket;
$pk = EntityDataPacket::getFromPool();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;