This is my code: $player = $sender; $sender->sendMessage("Spawned a Cow"); $nbt = new CompoundTag("", [ "Pos" => new ListTag("Pos", [ new DoubleTag("", $player->x), new DoubleTag("", $player->y), new DoubleTag("", $player->z) ]), "Motion" => new ListTag("Motion", [ new DoubleTag("", -sin($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI)), new DoubleTag("", -sin($player->pitch / 180 * M_PI)), new DoubleTag("", cos($player->yaw / 180 * M_PI) * cos($player->pitch / 180 * M_PI)) ]), "Rotation" => new ListTag("Rotation", [ new FloatTag("", $player->yaw), new FloatTag("", $player->pitch) ]), ]); $entity = Entity::createEntity("Cow", $player->getLevel(), $nbt, $player); $entity->spawnToAll(); And this is the error: Call to a meber function spawnToAll() on null
You will need to register your Entity first: https://github.com/pmmp/PocketMine-...170980b/src/pocketmine/entity/Entity.php#L389