Java Code Examples for org.bukkit.WorldCreator#generator()

The following examples show how to use org.bukkit.WorldCreator#generator() . 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: TerrainOptions.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void configureWorld(WorldCreator worldCreator) {
    worldCreator.generator(vanilla ? null : new NullChunkGenerator());
    worldCreator.seed(seed);
}
 
Example 2
Source File: CraftServer.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public World createWorld(WorldCreator creator) {
    Validate.notNull(creator, "Creator may not be null");

    String name = creator.name();
    ChunkGenerator generator = creator.generator();
    File folder = new File(getWorldContainer(), name);
    World world = getWorld(name);
    net.minecraft.world.WorldType type = net.minecraft.world.WorldType.parseWorldType(creator.type().getName());
    boolean generateStructures = creator.generateStructures();

    if ((folder.exists()) && (!folder.isDirectory())) {
        throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
    }

    if (world != null) {
        return world;
    }

    boolean hardcore = false;
    WorldSettings worldSettings = new WorldSettings(creator.seed(), net.minecraft.world.WorldSettings.GameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
    net.minecraft.world.WorldServer worldserver = DimensionManager.initDimension(creator, worldSettings);

    pluginManager.callEvent(new WorldInitEvent(worldserver.getWorld()));
    net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = true;
    System.out.print("Preparing start region for level " + (console.worlds.size() - 1) + " (Dimension: " + worldserver.provider.dimensionId + ", Seed: " + worldserver.getSeed() + ")"); // Cauldron - log dimension

    if (worldserver.getWorld().getKeepSpawnInMemory()) {
        short short1 = 196;
        long i = System.currentTimeMillis();
        for (int j = -short1; j <= short1; j += 16) {
            for (int k = -short1; k <= short1; k += 16) {
                long l = System.currentTimeMillis();

                if (l < i) {
                    i = l;
                }

                if (l > i + 1000L) {
                    int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
                    int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

                    System.out.println("Preparing spawn area for " + worldserver.getWorld().getName() + ", " + (j1 * 100 / i1) + "%");
                    i = l;
                }

                net.minecraft.util.ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
                worldserver.theChunkProviderServer.loadChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4);
            }
        }
    }
    pluginManager.callEvent(new WorldLoadEvent(worldserver.getWorld()));
    net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading = false;
    return worldserver.getWorld();
}