Hi, I was wondering how I could get my plugin to spawn mobs (I know there is no AI, the plugin I am working on one already has the AI done, we just need it to spawn mobs) in random areas around the world, like what normally occurs in nature in Vanilla PE. If it's not too much trouble, I would also like to know how to spawn Monsters at night. Thanks
Just to make sure, you're asking for the algorithm for random mobs right? As far as I remember, it is to randomly pick a position in a chunk, check its light level and other conditions, spawn mob there if applicable, or pick another position if not.
Yep, IM had really no improvements except a buggy Redstone implementation and some useless features (no offense to anyone who helped in the development of it) Edit: Damn, I'm going off-topic again...
http://minecraft.gamepedia.com/Spawn#Natural_generation Note that some of the detailed information are customized in pocketmine.yml Whether they do or not it has no relevance to this thread if you don't accurately point out how they do so.
Instead of randomly spawning mobs anywhere around a world, I would rather spawn them in random positions around the player. I experienced issues spawning mobs in areas where no chunks were loaded yet. "If it's not too much trouble, I would also like to know how to spawn Monsters at night." PHP: $hostile = [["Zombie", "Creeper", "Skeleton", "Spider", "Enderman", "ZombieVillager"]];$time = $player->getLevel()->getTime() % Level::TIME_FULL;$night = ($time >= Level::TIME_NIGHT && $time < Level::TIME_SUNRISE);if($player instanceof Player && $night){ Entity::createEntity($hostile, $pos);}//removed Entity::createEntity($hostile[mt_rand(0, 1)][mt_rand(0, 10)], $pos);