Beispiel #1
0
  protected void loadAllWorlds(
      String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) {
    this.convertMapIfNeeded(p_71247_1_);
    this.setUserMessage("menu.loadingLevel");
    this.worldServers = new WorldServer[3];
    this.timeOfLastDimensionTick = new long[this.worldServers.length][100];
    ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true);
    this.setResourcePackFromWorld(this.getFolderName(), var7);
    WorldInfo var9 = var7.loadWorldInfo();
    WorldSettings var8;

    if (var9 == null) {
      if (this.isDemo()) {
        var8 = DemoWorldServer.demoWorldSettings;
      } else {
        var8 =
            new WorldSettings(
                seed, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), type);
        var8.setWorldName(p_71247_6_);

        if (this.enableBonusChest) {
          var8.enableBonusChest();
        }
      }

      var9 = new WorldInfo(var8, p_71247_2_);
    } else {
      var9.setWorldName(p_71247_2_);
      var8 = new WorldSettings(var9);
    }

    for (int var10 = 0; var10 < this.worldServers.length; ++var10) {
      byte var11 = 0;

      if (var10 == 1) {
        var11 = -1;
      }

      if (var10 == 2) {
        var11 = 1;
      }

      if (var10 == 0) {
        if (this.isDemo()) {
          this.worldServers[var10] =
              (WorldServer) (new DemoWorldServer(this, var7, var9, var11, this.theProfiler)).init();
        } else {
          this.worldServers[var10] =
              (WorldServer) (new WorldServer(this, var7, var9, var11, this.theProfiler)).init();
        }

        this.worldServers[var10].initialize(var8);
      } else {
        this.worldServers[var10] =
            (WorldServer)
                (new WorldServerMulti(this, var7, var11, this.worldServers[0], this.theProfiler))
                    .init();
      }

      this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10]));

      if (!this.isSinglePlayer()) {
        this.worldServers[var10].getWorldInfo().setGameType(this.getGameType());
      }
    }

    this.serverConfigManager.setPlayerManager(this.worldServers);
    this.setDifficultyForAllWorlds(this.getDifficulty());
    this.initialWorldChunkLoad();
  }