Added Tile::saveNBT(), moved Player::broadcastPacket() to Server

This commit is contained in:
Shoghi Cervantes
2014-05-24 13:21:55 +02:00
parent 1fd7e0431b
commit ef6ca9d2cd
11 changed files with 57 additions and 25 deletions

View File

@ -26,8 +26,10 @@ use pocketmine\inventory\FurnaceInventory;
use pocketmine\inventory\InventoryHolder;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Short;
class Furnace extends Tile implements InventoryHolder, Container{
@ -57,6 +59,14 @@ class Furnace extends Tile implements InventoryHolder, Container{
}
}
public function saveNBT(){
$this->namedtag->Inventory = new Enum("Inventory", []);
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
for($index = 0; $index < $this->getSize(); ++$index){
$this->setItem($index, $this->inventory->getItem($index));
}
}
/**
* @return int
*/