Code: Call to a member function setMaxHealth() on null" (EXCEPTION) in "plugins/Boss/src/MiniBosses/Main" at line 130 PHP: public function spawnBoss(string $name = "Boss") { $data = $this->data->get($name); if(!$data) { return "No data, Boss does not exist"; }elseif(!$this->getServer()->loadLevel($data["level"])) { return "Failed to load Level {$data["level"]}"; } $networkId = (int) $data["network-id"]; $pos = new Position($data["x"], $data["y"], $data["z"], $this->getServer()->getLevelByName($data["level"])); $health = $data["health"]; $range = $data["health"]; $attackDamage = $data["attackDamage"]; $attackRate = $data["attackRate"]; $speed = $data["speed"]; $drops = $data["drops"]; $respawnTime = $data["respawnTime"]; $skin = ($networkId === 63 ? $data["skin"] : ""); $heldItem = $data["heldItem"]; $scale = $data["scale"] ?? 1; $nbt = Boss::createBaseNBT($pos); $nbt->setTag(new ListTag("spawnPos", [new DoubleTag("", $pos->x), new DoubleTag("", $pos->y), new DoubleTag("", $pos->z)])); $nbt->setFloat("range", $range * $range); $nbt->setFloat("attackDamage", $attackDamage); $nbt->setInt("networkId", $networkId); $nbt->setInt("attackRate", $attackRate); $nbt->setFloat("speed", $speed); $nbt->setString("drops", $drops); $nbt->setInt("respawnTime", $respawnTime); $nbt->setString("skin", $skin); $nbt->setString("heldItem", $heldItem); $nbt->setFloat("scale", $scale); $ent = Entity::createEntity("network->id", $pos->level, $nbt); $ent->setMaxHealth($health);//line 130 $ent->setHealth($health); $ent->setNameTag($name); $ent->setNameTagAlwaysVisible(true); $ent->setNameTagVisible(true); $ent->spawnToAll(); return true; } The setMaxHealth() doesn't work. How can I solved this problem ?
PHP: $ent = Entity::createEntity("network->id", $pos->level, $nbt); There is no such entity "network->id" thats why its null use $networkId
PHP: $ent = Entity::createEntity("/*network->id*/", $pos->level, $nbt); It's the entity id in the folder.