Example #1
0
        private void initWorld(ISaveFormat isaveformat, string s)
        {
            if (isaveformat.func_22102_a(s))
            {
                logger.info("Converting map!");
                isaveformat.func_22101_a(s, new ConvertProgressUpdater(this));
            }
            logger.info("Preparing start region");
            worldMngr = new WorldServer(this, new SaveOldDir(new File("."), s, true), s,
                                        propertyManagerObj.getBooleanProperty("hellworld", false) ? -1 : 0);
            worldMngr.addWorldAccess(new WorldManager(this));
            worldMngr.difficultySetting = propertyManagerObj.getBooleanProperty("spawn-monsters", true) ? 1 : 0;
            worldMngr.setAllowedSpawnTypes(propertyManagerObj.getBooleanProperty("spawn-monsters", true),
                                           spawnPeacefulMobs);
            configManager.setPlayerManager(worldMngr);
            char             c = '\x00C4'; // \304
            long             l = java.lang.System.currentTimeMillis();
            ChunkCoordinates chunkcoordinates = worldMngr.func_22078_l();

            for (int i = -c; i <= c && serverRunning; i += 16)
            {
                for (int j = -c; j <= c && serverRunning; j += 16)
                {
                    long l1 = java.lang.System.currentTimeMillis();
                    if (l1 < l)
                    {
                        l = l1;
                    }
                    if (l1 > l + 1000L)
                    {
                        int k  = (c * 2 + 1) * (c * 2 + 1);
                        int i1 = (i + c) * (c * 2 + 1) + (j + 1);
                        outputPercentRemaining("Preparing spawn area", (i1 * 100) / k);
                        l = l1;
                    }
                    worldMngr.field_20911_y.loadChunk(chunkcoordinates.posX + i >> 4, chunkcoordinates.posZ + j >> 4);
                    while (worldMngr.func_6156_d() && serverRunning)
                    {
                        ;
                    }
                }
            }

            clearCurrentTask();
        }