Added support for more NBT data, renaming inventories, fixed tags not being saved, added support for tags in /give

This commit is contained in:
Shoghi Cervantes
2015-08-07 16:27:30 +02:00
parent d1bfb304cb
commit 75b7b03857
42 changed files with 244 additions and 51 deletions

View File

@ -34,10 +34,11 @@ use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Short;
use pocketmine\nbt\tag\String;
use pocketmine\network\Network;
use pocketmine\network\protocol\ContainerSetDataPacket;
class Furnace extends Tile implements InventoryHolder, Container{
class Furnace extends Tile implements InventoryHolder, Container, Nameable{
/** @var FurnaceInventory */
protected $inventory;
@ -69,6 +70,23 @@ class Furnace extends Tile implements InventoryHolder, Container{
}
}
public function getName(){
return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Chest";
}
public function hasName(){
return isset($this->namedtag->CustomName);
}
public function setName($str){
if($str === ""){
unset($this->namedtag->CustomName);
return;
}
$this->namedtag->CustomName = new String("CustomName", $str);
}
public function close(){
if($this->closed === false){
foreach($this->getInventory()->getViewers() as $player){