Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Spawning doesn't work properly #271

Open
tgwaste opened this issue Jul 14, 2020 · 13 comments
Open

Spawning doesn't work properly #271

tgwaste opened this issue Jul 14, 2020 · 13 comments

Comments

@tgwaste
Copy link

tgwaste commented Jul 14, 2020

Nothing else seems to spawn other than Creepers.

@PopGTN
Copy link

PopGTN commented Jul 18, 2020

Have u wait and fly around the world about it from some odd reason creepers spawn the most

@tgwaste
Copy link
Author

tgwaste commented Jul 18, 2020

I’m not sure what you mean but mobs are definitely broken.

@PopGTN
Copy link

PopGTN commented Jul 18, 2020

Do u have plugins that uses its own mod ai like pureenitites, burgerspawners, vanillaenitityai, etc?

@tgwaste
Copy link
Author

tgwaste commented Jul 18, 2020

No I am not using any of those plugins with Altay.

@tgwaste
Copy link
Author

tgwaste commented Jul 18, 2020

Maybe this is related:

./src/pocketmine/level/Level.php:               if($this->server->getAltayProperty("level.generic-auto-mob-spawning", false) and $this->gameRules->getBool(GameRules::RULE_DO_MOB_SPAWNING) and $currentTick % 400 === 0){

./src/pocketmine/level/Level.php:                               if($this->gameRules->getBool(GameRules::RULE_DO_MOB_SPAWNING, false)){

So the default there is False. Maybe we want to ignore the gamerule since there is a config file setting? Or maybe default that to true?

Even with the gamerule set to true though all I get are a bunch of Creepers.

@PopGTN
Copy link

PopGTN commented Jul 19, 2020

Idk lol not coder because it works for me well...

@phoshp
Copy link
Member

phoshp commented Jul 19, 2020

pls try latest commits

@tgwaste
Copy link
Author

tgwaste commented Jul 21, 2020

Using the latest release I watched a neutral spot in the plains for 1 hour.

Results:

  • Creeper (37)
  • Zombie (8)
  • Spider (8)
  • Skeleton (8)

No other mobs spawned any where.

I have a counter that shows me the number of mobs near me and every now and again the total would double for a second (like it was trying to spawn something) but then immediately go back to the previous value.

I am not running any other plugins.

There is definitely something wrong here. I don't see a single friendly mob. Perhaps thats what its trying to spawn and failing on?

@tgwaste
Copy link
Author

tgwaste commented Jul 26, 2020

I adjusted my debug plugin to print whats spawning and de-spawning. I did this test sitting at the bottom of the ocean, you can see in the log that as soon as the mobs spawn they despawn.

spawnlog.txt

@tgwaste
Copy link
Author

tgwaste commented Jul 27, 2020

To dramatically improve spawning I edited

src/pocketmine/level/AnimalSpawner.php

and made findChunksForSpawning look like:

  public function findChunksForSpawning(Level $level, bool $spawnHostileMobs, bool $spawnPeacefulMobs, array $eligibleChunks) : void{
    $x = $level->getTime() % 24000;
    $dayTime = ($x < 12300 or $x > 23850) ? true : false;

    if($spawnHostileMobs or $spawnPeacefulMobs){
      $spawn = $level->getSpawnLocation();

      foreach(self::$creatureTypes as $creatureType){
        if((!$creatureType->isPeacefulCreature() or $spawnPeacefulMobs) and ($creatureType->isPeacefulCreature() or $spawnHostileMobs) and ($creatureType->getCreatureClass() !== Animal::class or $dayTime)) {

I tried to do a PR but for some reason it wants to commit ~108 files instead of just the one I changed. Maybe ill keep trying.

@tgwaste tgwaste changed the title Only Creepers are spawning Spawning doesn't work properly Jul 27, 2020
@tgwaste
Copy link
Author

tgwaste commented Jul 31, 2020

Notes:
PR #283 fixes animal spawning in normal worlds.
Water Mob Spawning is still broken (Squids will spawn and immediately despawn in masses)
Im thinking maybe its a biome issue. This happens when I am standing next to an Ocean.
I also believe FlatWorlds may have some spawning issues as well. Again, Biome related?

@tgwaste
Copy link
Author

tgwaste commented Jul 31, 2020

In a FlatWorld standing in one spot for an hour yielded:
flatworld (22) - Spider (4) - Chicken (4) - Sheep (3) - Cow (1) - Slime (4) - Zombie (3) - Creeper (2) - Cat (1)
So I guess this is OK? I would expect at least 4 of each to obtain the min values but at least we're getting something.
Going to try to debug the Squid issue.

@tgwaste
Copy link
Author

tgwaste commented Jul 31, 2020

Standing in normal world for an hour yields:
normalworld (73) - Spider (22) - Creeper (15) - Skeleton (12) - Sheep (4) - Pig (5) - Zombie (11) - Cow (3) - Chicken (1)
So while Creepers look a bit better there is definitely an over spawn of hostile mobs happening still.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants