Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5072

Process phantom, cat and patrol spawning in CustomCunkGenerator

XMLWordPrintable

    • CraftBukkit version git-Spigot-df0eb25-9e95da1 (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT)
    • Yes

      While creating a plugin that uses custom chunk generators (provides org.bukkit.generator.ChunkGenerator to world creator), I notice that in my new world Phantoms, Cats (in villages) and Patrols are not spawning at all. Even more, they are not processed at all. 

      When trying to find out a reason for this behavior I notice, that if ChunkGenerator is provided to world creator, then it always uses "org.bukkit.craftbukkit.generator.CustomChunkGenerator" class that process chunk generation and controls mob spawning.

      Unfortunately, this CustomChunkGenerator does not contain methods that could process phantoms, cats and patrols. Unlike it is in Mojang chunk generators (like ChunkProviderGenerate), here on method call doMobSpawning
      nothing is processed, so these 3 mob spawning processed are not happening.

      I suggest to add 3 new fields for CustomChunkGenerator:

          private final MobSpawnerPhantom phantoms = new MobSpawnerPhantom();
          private final MobSpawnerPatrol patrols = new MobSpawnerPatrol();
          private final MobSpawnerCat cats = new MobSpawnerCat();
      

      and in method doMobSpawning process these spawners:

          @Override
          public void doMobSpawning(WorldServer worldserver, boolean flag, boolean flag1) {
              this.phantoms.a(worldserver, flag, flag1);
              this.patrols.a(worldserver, flag, flag1);
              this.cats.a(worldserver, flag, flag1);
          }
      

      This change will allow processing phantoms, cats and patrols in the same way as it is in default chunk generator (ChunkProviderGenerate).

       

            Unassigned Unassigned
            BONNe BONNe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: