Java Code Examples for cn.nukkit.level.generator.Generator#init()

The following examples show how to use cn.nukkit.level.generator.Generator#init() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Level.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Generator init() {
    try {
        Generator generator = generatorClass.getConstructor(Map.class).newInstance(provider.getGeneratorOptions());
        NukkitRandom rand = new NukkitRandom(getSeed());
        ChunkManager manager;
        if (Server.getInstance().isPrimaryThread()) {
            generator.init(Level.this, rand);
        }
        generator.init(new PopChunkManager(getSeed()), rand);
        return generator;
    } catch (Throwable e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 2
Source File: GeneratorRegisterTask.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRun() {
    Block.init();
    Biome.init();
    SimpleChunkManager manager = new SimpleChunkManager(this.seed);
    try {
        Generator generator = this.generator.getConstructor(Map.class).newInstance(this.settings);
        generator.init(manager, new NukkitRandom(manager.getSeed()));
        GeneratorPool.put(this.levelId, generator);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 3
Source File: GeneratorRegisterTask.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRun() {
    Block.init();
    Biome.init();
    SimpleChunkManager manager = new SimpleChunkManager(this.seed);
    try {
        Generator generator = this.generator.getConstructor(Map.class).newInstance(this.settings);
        generator.init(manager, new NukkitRandom(manager.getSeed()));
        GeneratorPool.put(this.levelId, generator);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}