예제 #1
0
  protected void actionPerformed(GuiButton button) throws IOException {
    if (button.enabled) {
      if (button.id == 2) {
        String var2 = this.func_146614_d(this.field_146640_r);

        if (var2 != null) {
          this.field_146643_x = true;
          GuiYesNo var3 = func_152129_a(this, var2, this.field_146640_r);
          this.mc.displayGuiScreen(var3);
        }
      } else if (button.id == 1) {
        this.func_146615_e(this.field_146640_r);
      } else if (button.id == 3) {
        this.mc.displayGuiScreen(new GuiCreateWorld(this));
      } else if (button.id == 6) {
        this.mc.displayGuiScreen(new GuiRenameWorld(this, this.func_146621_a(this.field_146640_r)));
      } else if (button.id == 0) {
        this.mc.displayGuiScreen(this.field_146632_a);
      } else if (button.id == 7) {
        GuiCreateWorld var5 = new GuiCreateWorld(this);
        ISaveHandler var6 =
            this.mc.getSaveLoader().getSaveLoader(this.func_146621_a(this.field_146640_r), false);
        WorldInfo var4 = var6.loadWorldInfo();
        var6.flush();
        var5.func_146318_a(var4);
        this.mc.displayGuiScreen(var5);
      } else {
        this.field_146638_t.actionPerformed(button);
      }
    }
  }
예제 #2
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();
  }
예제 #3
0
  protected void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) {
    File var3 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip");

    if (var3.isFile()) {
      this.setResourcePack("level://" + worldNameIn + "/" + var3.getName(), "");
    }
  }
예제 #4
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();
  }