namedtag->getInt("Profession", self::PROFESSION_FARMER); if($profession > 4 or $profession < 0){ $profession = self::PROFESSION_FARMER; } $this->setProfession($profession); } public function saveNBT(){ parent::saveNBT(); $this->namedtag->setInt("Profession", $this->getProfession()); } /** * Sets the villager profession * * @param int $profession */ public function setProfession(int $profession){ $this->propertyManager->setInt(self::DATA_VARIANT, $profession); } public function getProfession() : int{ return $this->propertyManager->getInt(self::DATA_VARIANT); } public function isBaby() : bool{ return $this->getGenericFlag(self::DATA_FLAG_BABY); } }