/** * Gets the generator name and arguments of this World * * @return Chunk Generator name and arguments */ public String getChunkGeneratorName() { if (this.chunkGeneratorName == null) { World world = this.getWorld(); if (world != null) { ChunkGenerator gen = world.getGenerator(); if (gen != null) { Plugin genPlugin = CommonUtil.getPluginByClass(gen.getClass()); if (genPlugin != null) { this.chunkGeneratorName = genPlugin.getName(); } } } } return this.chunkGeneratorName; }
public Chunk getOrCreateChunk(int x, int z) { random.setSeed((long) x * 341873128712L + (long) z * 132897987541L); byte[] types = generator.generate(world.getWorld(), random, x, z); Chunk chunk = new Chunk(world, types, x, z); chunk.initLighting(); return chunk; }
public List<BlockPopulator> getDefaultPopulators(org.bukkit.World world) { return generator.getDefaultPopulators(world); }
public boolean canSpawn(org.bukkit.World world, int x, int z) { return generator.canSpawn(world, x, z); }
public byte[] generate(org.bukkit.World world, Random random, int x, int z) { return generator.generate(world, random, x, z); }
/** Initialize a single chunk from the chunk generator. */ private void generateChunk(GlowChunk chunk, int x, int z) { Random random = new Random((long) x * 341873128712L + (long) z * 132897987541L); BiomeGrid biomes = new BiomeGrid(); int[] biomeValues = biomeGrid[0].generateValues( x * GlowChunk.WIDTH, z * GlowChunk.HEIGHT, GlowChunk.WIDTH, GlowChunk.HEIGHT); for (int i = 0; i < biomeValues.length; i++) { biomes.biomes[i] = (byte) biomeValues[i]; } // extended sections with data if (generator instanceof GlowChunkGenerator) { short[][] extSections = ((GlowChunkGenerator) generator) .generateExtBlockSectionsWithData(world, random, x, z, biomes); if (extSections != null) { GlowChunk.ChunkSection[] sections = new GlowChunk.ChunkSection[extSections.length]; for (int i = 0; i < extSections.length; ++i) { // this is sort of messy. if (extSections[i] != null) { sections[i] = new GlowChunk.ChunkSection(); for (int j = 0; j < extSections[i].length; ++j) { sections[i].types[j] = (char) extSections[i][j]; } sections[i].recount(); } } chunk.initializeSections(sections); chunk.setBiomes(biomes.biomes); chunk.automaticHeightMap(); return; } } // extended sections short[][] extSections = generator.generateExtBlockSections(world, random, x, z, biomes); if (extSections != null) { GlowChunk.ChunkSection[] sections = new GlowChunk.ChunkSection[extSections.length]; for (int i = 0; i < extSections.length; ++i) { // this is sort of messy. if (extSections[i] != null) { sections[i] = new GlowChunk.ChunkSection(); for (int j = 0; j < extSections[i].length; ++j) { sections[i].types[j] = (char) (extSections[i][j] << 4); } sections[i].recount(); } } chunk.initializeSections(sections); chunk.setBiomes(biomes.biomes); chunk.automaticHeightMap(); return; } // normal sections byte[][] blockSections = generator.generateBlockSections(world, random, x, z, biomes); if (blockSections != null) { GlowChunk.ChunkSection[] sections = new GlowChunk.ChunkSection[blockSections.length]; for (int i = 0; i < blockSections.length; ++i) { // this is sort of messy. if (blockSections[i] != null) { sections[i] = new GlowChunk.ChunkSection(); for (int j = 0; j < blockSections[i].length; ++j) { sections[i].types[j] = (char) (blockSections[i][j] << 4); } sections[i].recount(); } } chunk.initializeSections(sections); chunk.setBiomes(biomes.biomes); chunk.automaticHeightMap(); return; } // deprecated flat generation byte[] types = generator.generate(world, random, x, z); GlowChunk.ChunkSection[] sections = new GlowChunk.ChunkSection[8]; for (int sy = 0; sy < sections.length; ++sy) { GlowChunk.ChunkSection sec = new GlowChunk.ChunkSection(); int by = 16 * sy; for (int cx = 0; cx < 16; ++cx) { for (int cz = 0; cz < 16; ++cz) { for (int cy = by; cy < by + 16; ++cy) { char type = (char) types[(cx * 16 + cz) * 128 + cy]; sec.types[sec.index(cx, cy, cz)] = (char) (type << 4); } } } sec.recount(); sections[sy] = sec; } chunk.initializeSections(sections); chunk.setBiomes(biomes.biomes); chunk.automaticHeightMap(); }
@Override public World createWorld(WorldCreator creator) { if (creator == null) { throw new IllegalArgumentException("Creator may not be null"); } String name = creator.name(); ChunkGenerator generator = creator.generator(); File folder = new File(getWorldContainer().getParentFile(), name); int dimension = DimensionManager.getNextFreeDimId(); World world = getWorld(dimension); WorldType type = WorldType.parseWorldType(creator.type().getName()); boolean generateStructures = creator.generateStructures(); if (world != null) { return world; } if ((folder.exists()) && (!folder.isDirectory())) { throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); } if (generator == null) { generator = getGenerator(dimension); } AnvilSaveConverter converter = new AnvilSaveConverter(getWorldContainer()); if (converter.isOldMapFormat(name)) { getLogger().info("Converting world '" + name + "'"); converter.convertMapFormat(name, new ConvertingProgressUpdate(theServer)); } boolean hardcore = false; WorldServer internal = new WorldServer(theServer, new AnvilSaveHandler(getWorldContainer().getParentFile(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type), theServer.theProfiler); if (!(worlds.containsKey(dimension))) { return null; } //internal.getWorldInfo().get = console.worldServerForDimension(0).worldMaps; //internal. = new EntityTracker(internal); // CraftBukkit internal.addWorldAccess((IWorldAccess) new WorldManager(theServer, internal)); internal.difficultySetting = 1; //internal.(true, true); //theServer.worldServers[theServer.worldServers.length] = internal; DimensionManager.setWorld(dimension, internal); this.worlds.put(dimension, new BukkitWorld(internal, creator.generator(), creator.environment())); if (generator != null) { (worlds.get(dimension)).getPopulators().addAll(generator.getDefaultPopulators(worlds.get(dimension))); } pluginManager.callEvent(new WorldInitEvent((worlds.get(dimension)))); System.out.print("Preparing start region for level " + (theServer.worldServers.length - 1) + " (Seed: " + internal.getSeed() + ")"); if (DimensionManager.shouldLoadSpawn(dimension)) { 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 " + name + ", " + (j1 * 100 / i1) + "%"); i = l; } ChunkCoordinates chunkcoordinates = internal.getSpawnPoint(); internal.theChunkProviderServer.provideChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4); //while (internal.updateLights()) { // ; }// } } pluginManager.callEvent( new WorldLoadEvent(worlds.get(dimension))); return worlds.get(dimension); }
public Chunk getOrCreateChunk(int x, int z) { random.setSeed((long) x * 341873128712L + (long) z * 132897987541L); Chunk chunk; // Get default biome data for chunk CustomBiomeGrid biomegrid = new CustomBiomeGrid(); biomegrid.biome = new BiomeGenBase[256]; world.getWorldChunkManager().getBiomeGenAt(biomegrid.biome, x << 4, z << 4, 16, 16, false); // Try extended block method (1.2+) short[][] xbtypes = generator.generateExtBlockSections( CraftServer.instance().getWorld(world.provider.dimensionId), this.random, x, z, biomegrid); if (xbtypes != null) { chunk = new Chunk(this.world, x, z); ExtendedBlockStorage[] csect = chunk.getBlockStorageArray(); int scnt = Math.min(csect.length, xbtypes.length); // Loop through returned sections for (int sec = 0; sec < scnt; sec++) { if (xbtypes[sec] == null) { continue; } byte[] secBlkID = new byte[4096]; // Allocate blk ID bytes byte[] secExtBlkID = (byte[]) null; // Delay getting extended ID nibbles short[] bdata = xbtypes[sec]; // Loop through data, 2 blocks at a time for (int i = 0, j = 0; i < bdata.length; i += 2, j++) { short b1 = bdata[i]; short b2 = bdata[i + 1]; byte extb = (byte) ((b1 >> 8) | ((b2 >> 4) & 0xF0)); secBlkID[i] = (byte) b1; secBlkID[(i + 1)] = (byte) b2; if (extb != 0) { // If extended block ID data if (secExtBlkID == null) { // Allocate if needed secExtBlkID = new byte[2048]; } secExtBlkID[j] = extb; } } // Build chunk section csect[sec] = new ExtendedBlockStorage(sec << 4, false); // , secBlkID, secExtBlkID); } } else { // Else check for byte-per-block section data byte[][] btypes = generator.generateBlockSections(getWorld(world), this.random, x, z, biomegrid); if (btypes != null) { chunk = new Chunk(this.world, x, z); ExtendedBlockStorage[] csect = chunk.getBlockStorageArray(); int scnt = Math.min(csect.length, btypes.length); for (int sec = 0; sec < scnt; sec++) { if (btypes[sec] == null) { continue; } csect[sec] = new ExtendedBlockStorage(sec << 4, false); // , btypes[sec], null); } } else { // Else, fall back to pre 1.2 method @SuppressWarnings("deprecation") byte[] types = generator.generate(getWorld(world), this.random, x, z); int ydim = types.length / 256; int scnt = ydim / 16; chunk = new Chunk(this.world, x, z); // Create empty chunk ExtendedBlockStorage[] csect = chunk.getBlockStorageArray(); scnt = Math.min(scnt, csect.length); // Loop through sections for (int sec = 0; sec < scnt; sec++) { ExtendedBlockStorage cs = null; // Add sections when needed byte[] csbytes = (byte[]) null; for (int cy = 0; cy < 16; cy++) { int cyoff = cy | (sec << 4); for (int cx = 0; cx < 16; cx++) { int cxyoff = (cx * ydim * 16) + cyoff; for (int cz = 0; cz < 16; cz++) { byte blk = types[cxyoff + (cz * ydim)]; if (blk != 0) { // If non-empty if (cs == null) { // If no section yet, get one cs = csect[sec] = new ExtendedBlockStorage(sec << 4, true); csbytes = cs.getBlockLSBArray(); } csbytes[(cy << 8) | (cz << 4) | cx] = blk; } } } } // If section built, finish prepping its state if (cs != null) { cs.getYLocation(); } } } } // Set biome grid byte[] biomeIndex = chunk.getBiomeArray(); for (int i = 0; i < biomeIndex.length; i++) { biomeIndex[i] = (byte) (biomegrid.biome[i].biomeID & 0xFF); } // Initialize lighting chunk.generateSkylightMap(); return chunk; }
public short[][] generateExtBlockSections( org.bukkit.World world, Random random, int x, int z, BiomeGrid biomes) { return generator.generateExtBlockSections(world, random, x, z, biomes); }
@SuppressWarnings("deprecation") public byte[] generate(org.bukkit.World world, Random random, int x, int z) { return generator.generate(world, random, x, z); }
private void a(Convertable convertable, String s, long i, WorldType worldtype) { if (convertable.isConvertable(s)) { log.info("Converting map!"); convertable.convert(s, new ConvertProgressUpdater(this)); } // CraftBukkit - removed world and ticktime arrays int j = this.propertyManager.getInt("gamemode", 0); j = WorldSettings.a(j); log.info("Default game type: " + j); // CraftBukkit start (+ removed worldsettings and servernbtmanager) boolean generateStructures = this.propertyManager.getBoolean("generate-structures", true); int worldCount = 3; for (int k = 0; k < worldCount; ++k) { WorldServer world; int dimension = 0; if (k == 1) { if (this.propertyManager.getBoolean("allow-nether", true)) { dimension = -1; } else { continue; } } if (k == 2) { // CraftBukkit - (+ don't do this in server.properties, do it in bukkit.yml) if (this.server.getAllowEnd()) { dimension = 1; } else { continue; } } String worldType = Environment.getEnvironment(dimension).toString().toLowerCase(); String name = (dimension == 0) ? s : s + "_" + worldType; org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name); WorldSettings settings = new WorldSettings(i, j, generateStructures, false, worldtype); if (k == 0) { world = new WorldServer( this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit } else { String dim = "DIM" + dimension; File newWorld = new File(new File(name), dim); File oldWorld = new File(new File(s), dim); if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) { log.info("---- Migration of old " + worldType + " folder required ----"); log.info( "Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly."); log.info( "We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future."); log.info("Attempting to move " + oldWorld + " to " + newWorld + "..."); if (newWorld.exists()) { log.severe("A file or folder already exists at " + newWorld + "!"); log.info("---- Migration of old " + worldType + " folder failed ----"); } else if (newWorld.getParentFile().mkdirs()) { if (oldWorld.renameTo(newWorld)) { log.info( "Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld); log.info("---- Migration of old " + worldType + " folder complete ----"); } else { log.severe("Could not move folder " + oldWorld + " to " + newWorld + "!"); log.info("---- Migration of old " + worldType + " folder failed ----"); } } else { log.severe("Could not create path for " + newWorld + "!"); log.info("---- Migration of old " + worldType + " folder failed ----"); } } if (convertable.isConvertable(name)) { log.info("Converting map!"); convertable.convert(name, new ConvertProgressUpdater(this)); } world = new SecondaryWorldServer( this, new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, settings, this.worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit } if (gen != null) { world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld())); } this.server .getPluginManager() .callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld())); world.tracker = new EntityTracker(this, world); // CraftBukkit world.addIWorldAccess(new WorldManager(this, world)); world.difficulty = this.propertyManager.getInt("difficulty", 1); world.setSpawnFlags( this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals); world.getWorldData().setGameType(j); this.worlds.add(world); this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0])); } // CraftBukkit end short short1 = 196; long l = System.currentTimeMillis(); // CraftBukkit start for (int i1 = 0; i1 < this.worlds.size(); ++i1) { WorldServer worldserver = this.worlds.get(i1); log.info("Preparing start region for level " + i1 + " (Seed: " + worldserver.getSeed() + ")"); if (!worldserver.getWorld().getKeepSpawnInMemory()) { continue; } // CraftBukkit end ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); for (int j1 = -short1; j1 <= short1 && this.isRunning; j1 += 16) { for (int k1 = -short1; k1 <= short1 && this.isRunning; k1 += 16) { long l1 = System.currentTimeMillis(); if (l1 < l) { l = l1; } if (l1 > l + 1000L) { int i2 = (short1 * 2 + 1) * (short1 * 2 + 1); int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1; this.b("Preparing spawn area", j2 * 100 / i2); l = l1; } worldserver.chunkProviderServer.getChunkAt( chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4); while (worldserver.updateLights() && this.isRunning) {; } } } } // CraftBukkit start for (World world : this.worlds) { this.server .getPluginManager() .callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld())); } // CraftBukkit end this.t(); }
protected void a(String s, String s1, long i, WorldType worldtype, String s2) { this.a(s); this.b("menu.loadingLevel"); this.worldServer = new WorldServer[3]; /* CraftBukkit start - Remove ticktime arrays and worldsettings this.h = new long[this.worldServer.length][100]; IDataManager idatamanager = this.convertable.a(s, true); this.a(this.T(), idatamanager); WorldData worlddata = idatamanager.getWorldData(); WorldSettings worldsettings; if (worlddata == null) { if (this.W()) { worldsettings = DemoWorldServer.a; } else { worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype); worldsettings.setGeneratorSettings(s2); if (this.M) { worldsettings.a(); } } worlddata = new WorldData(worldsettings, s1); } else { worlddata.a(s1); worldsettings = new WorldSettings(worlddata); } */ int worldCount = 3; for (int j = 0; j < worldCount; ++j) { WorldServer world; byte dimension = 0; if (j == 1) { if (getAllowNether()) { dimension = -1; } else { continue; } } if (j == 2) { if (server.getAllowEnd()) { dimension = 1; } else { continue; } } String worldType = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase(); String name = (dimension == 0) ? s : s + "_" + worldType; org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name); WorldSettings worldsettings = new WorldSettings( i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype); worldsettings.setGeneratorSettings(s2); if (j == 0) { IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), s1, true); WorldData worlddata = idatamanager.getWorldData(); if (worlddata == null) { worlddata = new WorldData(worldsettings, s1); } worlddata.checkName( s1); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take // the last loaded world as respawn (in this case the end) if (this.W()) { world = (WorldServer) (new DemoWorldServer( this, idatamanager, worlddata, dimension, this.methodProfiler)) .b(); } else { world = (WorldServer) (new WorldServer( this, idatamanager, worlddata, dimension, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)) .b(); } world.a(worldsettings); this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager( this, world.getScoreboard()); } else { String dim = "DIM" + dimension; File newWorld = new File(new File(name), dim); File oldWorld = new File(new File(s), dim); if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) { MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder required ----"); MinecraftServer.LOGGER.info( "Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly."); MinecraftServer.LOGGER.info( "We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future."); MinecraftServer.LOGGER.info("Attempting to move " + oldWorld + " to " + newWorld + "..."); if (newWorld.exists()) { MinecraftServer.LOGGER.warn("A file or folder already exists at " + newWorld + "!"); MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder failed ----"); } else if (newWorld.getParentFile().mkdirs()) { if (oldWorld.renameTo(newWorld)) { MinecraftServer.LOGGER.info( "Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld); // Migrate world data too. try { com.google.common.io.Files.copy( new File(new File(s), "level.dat"), new File(new File(name), "level.dat")); } catch (IOException exception) { MinecraftServer.LOGGER.warn("Unable to migrate world data."); } MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder complete ----"); } else { MinecraftServer.LOGGER.warn( "Could not move folder " + oldWorld + " to " + newWorld + "!"); MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder failed ----"); } } else { MinecraftServer.LOGGER.warn("Could not create path for " + newWorld + "!"); MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder failed ----"); } } IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), name, true); // world =, b0 to dimension, s1 to name, added Environment and gen WorldData worlddata = idatamanager.getWorldData(); if (worlddata == null) { worlddata = new WorldData(worldsettings, name); } worlddata.checkName( name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take // the last loaded world as respawn (in this case the end) world = (WorldServer) new SecondaryWorldServer( this, idatamanager, dimension, this.worlds.get(0), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen) .b(); } if (gen != null) { world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld())); } this.server .getPluginManager() .callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld())); world.addIWorldAccess(new WorldManager(this, world)); if (!this.S()) { world.getWorldData().setGameType(this.getGamemode()); } worlds.add(world); getPlayerList().setPlayerFileData(worlds.toArray(new WorldServer[worlds.size()])); } // CraftBukkit end this.a(this.getDifficulty()); this.k(); }
@Override public World createWorld(WorldCreator creator) { if (creator == null) { throw new IllegalArgumentException("Creator may not be null"); } String name = creator.name(); World world = getWorld(name); // WorldType type = WorldType.parseWorldType(creator.type().getName()); if (world != null) { // Existing forge world return world; } if (firstBukkitWorld) { DimensionManager.registerProviderType( CraftWorldProvider.ProviderID, CraftWorldProvider.class, false); firstBukkitWorld = false; } int dimension = -1000; if (CraftWorldProvider.hasDimensionIdForName(name)) { dimension = CraftWorldProvider.getDimensionIdForName(name); } else { dimension = DimensionManager.getNextFreeDimId(); CraftWorldProvider.setDimensionIdForName(name, dimension); } DimensionManager.registerDimension(dimension, CraftWorldProvider.ProviderID); CraftWorldProvider wp = (CraftWorldProvider) DimensionManager.createProviderFor(dimension); wp.setName(creator.name()); File folder = new File(getWorldContainer(), wp.getDimName()); if ((folder.exists()) && (!folder.isDirectory())) { throw new IllegalArgumentException( "File exists with the name '" + name + "' and isn't a folder"); } ChunkGenerator generator = creator.generator(); boolean generateStructures = creator.generateStructures(); AnvilSaveConverter converter = new AnvilSaveConverter(folder); if (converter.isOldMapFormat(wp.getDimensionName())) { getLogger().info("Converting world '" + name + "'"); converter.convertMapFormat(name, new ConvertingProgressUpdate(theServer)); } WorldType type = WorldType.parseWorldType(creator.type().getName()); // WorldServer internal = new WorldServer(theServer, new // AnvilSaveHandler(getWorldContainer().getParentFile(), name, true), name, dimension, new // WorldSettings(creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()), // generateStructures, false, type), theServer.theProfiler); // WorldServerMulti internal = new WorldServerMulti(theServer, new // AnvilSaveHandler(getWorldContainer() , name, true), name, dimension, new // WorldSettings(creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()), // generateStructures, false, type), theServer.theProfiler, creator.environment(), // generator); WorldServer internal = new WorldServerMulti( theServer, new AnvilSaveHandler(getWorldContainer(), wp.getDimName(), true), name, dimension, new WorldSettings( creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()), generateStructures, false, type), worlds.get(0).getHandle(), theServer.theProfiler); internal.addWorldAccess((IWorldAccess) new WorldManager(theServer, internal)); internal.difficultySetting = 1; internal.provider = wp; wp.registerWorld(internal); // DimensionManager.setWorld(dimension, internal); not necessary, done in constructor of // WorldServer worlds.cacheIfNotPresent(dimension); if (generator != null) { (worlds.get(dimension)) .getPopulators() .addAll(generator.getDefaultPopulators(worlds.get(dimension))); } pluginManager.callEvent(new WorldInitEvent((worlds.get(dimension)))); System.out.print( "Preparing start region for level " + (theServer.worldServers.length - 1) + " (Seed: " + internal.getSeed() + ")"); if (DimensionManager.shouldLoadSpawn(dimension)) { 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 " + name + ", " + (j1 * 100 / i1) + "%"); i = l; } ChunkCoordinates chunkcoordinates = internal.getSpawnPoint(); internal.theChunkProviderServer.provideChunk( chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4); } // } } MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(internal)); pluginManager.callEvent(new WorldLoadEvent(worlds.get(dimension))); return worlds.get(dimension); }