Пример #1
0
  protected void loadAllWorlds(
      String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) {
    this.convertMapIfNeeded(par1Str);
    this.setUserMessage("menu.loadingLevel");
    ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true);
    WorldInfo worldinfo = isavehandler.loadWorldInfo();
    WorldSettings worldsettings;

    if (worldinfo == null) {
      worldsettings =
          new WorldSettings(
              par3,
              this.getGameType(),
              this.canStructuresSpawn(),
              this.isHardcore(),
              par5WorldType);
      worldsettings.func_82750_a(par6Str);
    } else {
      worldsettings = new WorldSettings(worldinfo);
    }

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

    WorldServer overWorld =
        (isDemo()
            ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, func_98033_al())
            : new WorldServer(
                this, isavehandler, par2Str, 0, worldsettings, theProfiler, func_98033_al()));
    for (int dim : DimensionManager.getStaticDimensionIDs()) {
      WorldServer world =
          (dim == 0
              ? overWorld
              : new WorldServerMulti(
                  this,
                  isavehandler,
                  par2Str,
                  dim,
                  worldsettings,
                  overWorld,
                  theProfiler,
                  func_98033_al()));
      world.addWorldAccess(new WorldManager(this, world));

      if (!this.isSinglePlayer()) {
        world.getWorldInfo().setGameType(this.getGameType());
      }

      this.serverConfigManager.setPlayerManager(this.worldServers);

      MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
    }

    this.serverConfigManager.setPlayerManager(new WorldServer[] {overWorld});
    this.setDifficultyForAllWorlds(this.getDifficulty());
    this.initialWorldChunkLoad();
  }
 public IntegratedServer(
     Minecraft par1Minecraft, String par2Str, String par3Str, WorldSettings par4WorldSettings) {
   super(new File(par1Minecraft.mcDataDir, "saves"), par1Minecraft.getProxy());
   this.setServerOwner(par1Minecraft.getSession().getUsername());
   this.setFolderName(par2Str);
   this.setWorldName(par3Str);
   this.setDemo(par1Minecraft.isDemo());
   this.canCreateBonusChest(par4WorldSettings.isBonusChestEnabled());
   this.setBuildLimit(256);
   this.setConfigurationManager(new IntegratedPlayerList(this));
   this.mc = par1Minecraft;
   this.theWorldSettings = par4WorldSettings;
   Reflector.callVoid(Reflector.ModLoader_registerServer, new Object[] {this});
 }
Пример #3
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();
  }