Johannes Becker
Johannes Becker

Reputation: 67

How to modify the default world generator

I'm currently working on a spigot server plugin and I want to modify the default world generator so that every chunk is made out of one random block. I heard that you can make a custom world generator but I only want to modify the default one. Is there any way to do that? Thanks in advance!

Upvotes: 2

Views: 1847

Answers (1)

Elikill58
Elikill58

Reputation: 4908

You should use WorldCreator like that:

new WorldCreator("myWorld").environment(Environment.NORMAL).generator(new MyGenerator()).createWorld();

Then, create the class MyGenerator which should extend ChunkGenerator like that:

public class MyGenerator extends ChunkGenerator {

   // here define all methods from "ChunkGenerator" class like:
   @Override
   public boolean shouldGenerateCaves() {
       return false;
   }
}

You can change some configuration in the world creator, specially the name or the seed. Else, you should config other things in the MyGenerator's class.

Upvotes: 3

Related Questions