namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Enchanting Table"; } public function hasName(){ return isset($this->namedtag->CustomName); } public function setName($str){ if($str === ""){ unset($this->namedtag->CustomName); return; } $this->namedtag->CustomName = new StringTag("CustomName", $str); } public function getSpawnCompound(){ $c = new CompoundTag("", [ new StringTag("id", Tile::ENCHANT_TABLE), new IntTag("x", (int) $this->x), new IntTag("y", (int) $this->y), new IntTag("z", (int) $this->z) ]); if($this->hasName()){ $c->CustomName = $this->namedtag->CustomName; } return $c; } }