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

@ -25,14 +25,38 @@ use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
class EnchantTable extends Spawnable{
class EnchantTable extends Spawnable implements Nameable{
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 getSpawnCompound(){
return new Compound("", [
$c = new Compound("", [
new String("id", Tile::ENCHANT_TABLE),
new Int("x", (int) $this->x),
new Int("y", (int) $this->y),
new Int("z", (int) $this->z)
]);
if($this->hasName()){
$c->CustomName = $this->namedtag->CustomName;
}
return $c;
}
}