i am try to create entity but when i spawn it, it give me error: Code: [18:51:23] [Server thread/CRITICAL]: Unhandled exception executing command 'boss zombie' in boss: Argument 2 passed to pocketmine\entity\Entity::createEntity() must be an instance of pocketmine\level\Level, instance of pocketmine\level\format\Chunk given, called in C:\Users\Khaled\Desktop\PocketMine-MP\plugins\BossTest\src\BossTest\BossTest.php on line 75 And this the code at line 75 PHP: $mob = Entity::createEntity(Zombie::NETWORK_ID, $sender->chunk, $nbt);$mob->setMaxHealth(500);$mob->setHealth(500);$mob->setScale(5);$mob->setNameTag("§8<§aTITAN§8>");$mob->spawnToAll();
PHP: $mob = Entity::createEntity("Zombie", $sender->getLevel(), $nbt);$mob->setMaxHealth(500);$mob->setHealth(500);$mob->setScale(5);$mob->setNameTag("§8<§aTITAN§8>");$mob->spawnToAll(); SOLVED ?
Your issue is: [18:51:23] [Server thread/CRITICAL]: Unhandled exception executing command 'boss zombie' in boss: Argument 2 passed to pocketmine\entity\Entity::createEntity() must be an instance of pocketmine\level\Level, instance of pocketmine\level\format\Chunk given, called in C:\Users\Khaled\Desktop\PocketMine-MP\plugins\BossTest\src\BossTest\BossTest.php on line 75 that's too much so lets narrow it down: Unhandled exception executing command 'boss zombie' in (plugin name): Argument 2 passed to pocketmine\entity\Entity::createEntity() must be an instance of pocketmine\level\Level, instance of pocketmine\level\format\Chunk given, called in file on line X still clueless? Argument 2 passed to pocketmine\entity\Entity::createEntity() must be an instance of pocketmine\level\Level, instance of pocketmine\level\format\Chunk given basically you given the wrong thing PMMP wanted it's like trying to give a key to a smart reader door PHP: # SmartDoor::open(SmartCard$card) is the method# looks like public function open(SmartCard$card){...} in class# but you did$key = new Key()$smartDoor->open($key) the smart door type hinted to need SmartCard not Key so it emits: Argument 1 passed to SmartDoor::Open() must be an instance of SmartCard, instance of Key given which is basically your issue of unknowingly passing wrong things