Ejemplo n.º 1
0
 /**
  * Return the current root directory for the world save. Accesses getSaveHandler from the
  * overworld
  *
  * @return the root directory of the save
  */
 public static File getCurrentSaveRootDirectory() {
   if (DimensionManager.getWorld(0) != null) {
     return ((SaveHandler) DimensionManager.getWorld(0).getSaveHandler()).getWorldDirectory();
   } else if (MinecraftServer.getServer() != null) {
     MinecraftServer srv = MinecraftServer.getServer();
     SaveHandler saveHandler =
         (SaveHandler) srv.getActiveAnvilConverter().getSaveLoader(srv.getFolderName(), false);
     return saveHandler.getWorldDirectory();
   } else {
     return null;
   }
 }
Ejemplo n.º 2
0
  public static void onServerChanged(MinecraftServer server, WorldInfo worldInfo) {
    COWorldConfig.clearWorldConfigs();
    ;
    COWorldConfig.loadedOptionOverrides[1] = COWorldConfig.loadedOptionOverrides[2] = null;
    _populatedChunks.clear();

    _server = server;
    BiomeGenBase[] worldBaseDir = BiomeGenBase.biomeList;
    int saveFormat = worldBaseDir.length;

    for (int cfg = 0; cfg < saveFormat; ++cfg) {
      BiomeGenBase ex = worldBaseDir[cfg];

      if (ex != null && ex.theBiomeDecorator != null) {
        patchBiomeDecorator(ex.theBiomeDecorator);
      }
    }

    File saveDir = null;
    ISaveFormat var9 = _server.getActiveAnvilConverter();

    if (var9 != null && var9 instanceof SaveFormatOld) {
      saveDir = ((SaveFormatOld) var9).getSavesDirectory();
    }

    saveDir = new File(saveDir, _server.getFolderName());
    COWorldConfig var10 = null;

    while (var10 == null) {
      try {
        var10 = new COWorldConfig(worldInfo, saveDir);
        COWorldConfig.validateOptions(var10.getConfigOptions(), false);
        COWorldConfig.validateDistributions(var10.getOreDistributions(), false);
      } catch (Exception var7) {

        if (!COErrorHandler.onConfigError(var7)) {
          break;
        }

        var10 = null;
      }
    }
  }