public List func_22176_b() {
    ArrayList arraylist = new ArrayList();
    File afile[] = field_22180_a.listFiles();
    File afile1[] = afile;
    int i = afile1.length;
    for (int j = 0; j < i; j++) {
      File file = afile1[j];
      if (!file.isDirectory()) {
        continue;
      }
      String s = file.getName();
      WorldInfo worldinfo = func_22173_b(s);
      if (worldinfo == null) {
        continue;
      }
      boolean flag = worldinfo.getSaveVersion() != 19132;
      String s1 = worldinfo.getWorldName();
      if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) {
        s1 = s;
      }
      arraylist.add(
          new SaveFormatComparator(
              s, s1, worldinfo.getLastTimePlayed(), worldinfo.getSizeOnDisk(), flag));
    }

    return arraylist;
  }
  /**
   * Fired when a control is clicked. This is the equivalent of
   * ActionListener.actionPerformed(ActionEvent e).
   */
  protected void actionPerformed(GuiButton par1GuiButton) {
    if (par1GuiButton.id == 0) {
      this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
    }

    if (par1GuiButton.id == 5) {
      this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings));
    }

    if (par1GuiButton.id == 1) {
      this.mc.displayGuiScreen(new GuiSelectWorld(this));
    }

    if (par1GuiButton.id == 4) {
      this.mc.shutdown();
    }

    if (par1GuiButton.id == 11) {
      this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
    }

    if (par1GuiButton.id == 12) {
      ISaveFormat var2 = this.mc.getSaveLoader();
      WorldInfo var3 = var2.getWorldInfo("Demo_World");

      if (var3 != null) {
        GuiYesNo var4 = GuiSelectWorld.func_74061_a(this, var3.getWorldName(), 12);
        this.mc.displayGuiScreen(var4);
      }
    }
  }
 public boolean convertMapFormat(String s, IProgressUpdate iprogressupdate) {
   iprogressupdate.setLoadingProgress(0);
   ArrayList arraylist = new ArrayList();
   ArrayList arraylist1 = new ArrayList();
   ArrayList arraylist2 = new ArrayList();
   ArrayList arraylist3 = new ArrayList();
   File file = new File(field_22180_a, s);
   File file1 = new File(file, "DIM-1");
   System.out.println("Scanning folders...");
   func_22183_a(file, arraylist, arraylist1);
   if (file1.exists()) {
     func_22183_a(file1, arraylist2, arraylist3);
   }
   int i = arraylist.size() + arraylist2.size() + arraylist1.size() + arraylist3.size();
   System.out.println(
       (new StringBuilder()).append("Total conversion count is ").append(i).toString());
   func_22181_a(file, arraylist, 0, i, iprogressupdate);
   func_22181_a(file1, arraylist2, arraylist.size(), i, iprogressupdate);
   WorldInfo worldinfo = func_22173_b(s);
   worldinfo.setSaveVersion(19132);
   ISaveHandler isavehandler = getSaveLoader(s, false);
   isavehandler.saveWorldInfo(worldinfo);
   func_22182_a(arraylist1, arraylist.size() + arraylist2.size(), i, iprogressupdate);
   if (file1.exists()) {
     func_22182_a(
         arraylist3, arraylist.size() + arraylist2.size() + arraylist1.size(), i, iprogressupdate);
   }
   return true;
 }
示例#4
0
  public List func_22176_b() {
    ArrayList arraylist = new ArrayList();
    for (int i = 0; i < 5; i++) {
      String s = (new StringBuilder()).append("World").append(i + 1).toString();
      WorldInfo worldinfo = func_22173_b(s);
      if (worldinfo != null) {
        arraylist.add(
            new SaveFormatComparator(
                s, "", worldinfo.getLastTimePlayed(), worldinfo.getSizeOnDisk(), false));
      }
    }

    return arraylist;
  }
示例#5
0
  /**
   * Fired when a control is clicked. This is the equivalent of
   * ActionListener.actionPerformed(ActionEvent e).
   */
  protected void actionPerformed(GuiButton par1GuiButton) {
    if (par1GuiButton.id == 0) {
      mc.displayGuiScreen(new GuiOptions(this, mc.gameSettings));
    }

    if (par1GuiButton.id == 5) {
      mc.displayGuiScreen(new GuiLanguage(this, mc.gameSettings, mc.func_135016_M()));
    }

    if (par1GuiButton.id == 1) {
      mc.displayGuiScreen(new GuiSelectWorld(this));
    }

    if (par1GuiButton.id == 2) {
      mc.displayGuiScreen(new GuiMultiplayer(this));
    }

    if (par1GuiButton.id == 14 && field_130023_H.drawButton) {
      func_140005_i();
    }

    if (par1GuiButton.id == 4) {
      mc.shutdown();
    }

    if (par1GuiButton.id == 10) {
      mc.displayGuiScreen(new GuiScreenTemporaryResourcePackSelect(this, mc.gameSettings));
    }

    if (par1GuiButton.id == 11) {
      mc.enableSP = mc.useSP;
      if (mc.enableSP) {
        mc.playerController = new PlayerControllerDemo(mc);
        mc.startWorldSSP("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
        mc.displayGuiScreen(null);
      } else {
        mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
      }
    }

    if (par1GuiButton.id == 12) {
      ISaveFormat isaveformat = mc.getSaveLoader();
      WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");

      if (worldinfo != null) {
        GuiYesNo guiyesno = GuiSelectWorld.getDeleteWorldScreen(this, worldinfo.getWorldName(), 12);
        mc.displayGuiScreen(guiyesno);
      }
    }
  }
示例#6
0
  public static void fixWorldTime(Minecraft var0) {
    WorldClient var1 = var0.theWorld;

    if (var1 != null) {
      IntegratedServer var2 = var0.getIntegratedServer();

      if (var2 != null) {
        WorldInfo var3 = var1.worldInfo;

        if (var3 != null) {
          if (var3.getGameType().getID() == 1) {
            WorldProvider var4 = var1.provider;

            if (var4 != null) {
              int var5 = var4.dimensionId;

              if (var5 == 0) {
                WorldServer var6 = var2.worldServerForDimension(var5);

                if (var6 != null) {
                  long var7 = var6.getWorldTime();
                  long var9 = var7 % 24000L;

                  if (isTimeDayOnly()) {
                    if (var9 <= 1000L) {
                      var6.setWorldTime(var7 - var9 + 1001L);
                    }

                    if (var9 >= 11000L) {
                      var6.setWorldTime(var7 - var9 + 24001L);
                    }
                  }

                  if (isTimeNightOnly()) {
                    if (var9 <= 14000L) {
                      var6.setWorldTime(var7 - var9 + 14001L);
                    }

                    if (var9 >= 22000L) {
                      var6.setWorldTime(var7 - var9 + 24000L + 14001L);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
示例#7
0
  /** Saves the passed in world info. */
  public void saveWorldInfo(WorldInfo par1WorldInfo) {
    NBTTagCompound var2 = par1WorldInfo.getNBTTagCompound();
    NBTTagCompound var3 = new NBTTagCompound();
    var3.setTag("Data", var2);
    FMLCommonHandler.instance().handleWorldDataSave(this, par1WorldInfo, var3);
    try {
      File var4 = new File(this.worldDirectory, "level.dat_new");
      File var5 = new File(this.worldDirectory, "level.dat_old");
      File var6 = new File(this.worldDirectory, "level.dat");
      CompressedStreamTools.writeCompressed(var3, new FileOutputStream(var4));

      if (var5.exists()) {
        var5.delete();
      }

      var6.renameTo(var5);

      if (var6.exists()) {
        var6.delete();
      }

      var4.renameTo(var6);

      if (var4.exists()) {
        var4.delete();
      }
    } catch (Exception var7) {
      var7.printStackTrace();
    }
  }
示例#8
0
  /** Saves the given World Info with the given NBTTagCompound as the Player. */
  public void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo, NBTTagCompound par2NBTTagCompound) {
    NBTTagCompound var3 = par1WorldInfo.cloneNBTCompound(par2NBTTagCompound);
    NBTTagCompound var4 = new NBTTagCompound();
    var4.setTag("Data", var3);
    FMLCommonHandler.instance().handleWorldDataSave(this, par1WorldInfo, var4);
    try {
      File var5 = new File(this.worldDirectory, "level.dat_new");
      File var6 = new File(this.worldDirectory, "level.dat_old");
      File var7 = new File(this.worldDirectory, "level.dat");
      CompressedStreamTools.writeCompressed(var4, new FileOutputStream(var5));

      if (var6.exists()) {
        var6.delete();
      }

      var7.renameTo(var6);

      if (var7.exists()) {
        var7.delete();
      }

      var5.renameTo(var7);

      if (var5.exists()) {
        var5.delete();
      }
    } catch (Exception var8) {
      var8.printStackTrace();
    }
  }
  public List getSaveList() {
    ArrayList arraylist = new ArrayList();
    File afile[] = savesDirectory.listFiles();
    File afile1[] = afile;
    int i = afile1.length;

    for (int j = 0; j < i; j++) {
      File file = afile1[j];

      if (!file.isDirectory()) {
        continue;
      }

      String s = file.getName();
      WorldInfo worldinfo = getWorldInfo(s);

      if (worldinfo == null
          || worldinfo.getSaveVersion() != 19132 && worldinfo.getSaveVersion() != 19133) {
        continue;
      }

      boolean flag = worldinfo.getSaveVersion() != getSaveVersion();
      String s1 = worldinfo.getWorldName();

      if (s1 == null || MathHelper.stringNullOrLengthZero(s1)) {
        s1 = s;
      }

      long l = 0L;
      arraylist.add(
          new SaveFormatComparator(
              s,
              s1,
              worldinfo.getLastTimePlayed(),
              l,
              worldinfo.getGameType(),
              flag,
              worldinfo.isHardcoreModeEnabled(),
              worldinfo.areCommandsAllowed()));
    }

    return arraylist;
  }
示例#10
0
 /** saves level.dat and backs up the existing one to level.dat_old */
 public void saveWorldInfoAndPlayer(WorldInfo par1WorldInfo, List par2List) {
   par1WorldInfo.setSaveVersion(19133);
   super.saveWorldInfoAndPlayer(par1WorldInfo, par2List);
 }
 public String func_85140_a() {
   return WorldInfo.func_85130_c(this.field_85141_a);
 }
示例#12
0
 /** Saves the given World Info with the given NBTTagCompound as the Player. */
 public void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo, NBTTagCompound par2NBTTagCompound) {
   par1WorldInfo.setSaveVersion(19133);
   super.saveWorldInfoWithPlayer(par1WorldInfo, par2NBTTagCompound);
 }
  /** Converts the specified map to the new map format. Args: worldName, loadingScreen */
  public boolean convertMapFormat(String par1Str, IProgressUpdate par2IProgressUpdate) {
    par2IProgressUpdate.setLoadingProgress(0);
    ArrayList arraylist = new ArrayList();
    ArrayList arraylist1 = new ArrayList();
    ArrayList arraylist2 = new ArrayList();
    File file = new File(savesDirectory, par1Str);
    File file1 = new File(file, "DIM-1");
    File file2 = new File(file, "DIM1");
    System.out.println("Scanning folders...");
    addRegionFilesToCollection(file, arraylist);

    if (file1.exists()) {
      addRegionFilesToCollection(file1, arraylist1);
    }

    if (file2.exists()) {
      addRegionFilesToCollection(file2, arraylist2);
    }

    int i = arraylist.size() + arraylist1.size() + arraylist2.size();
    System.out.println(
        (new StringBuilder()).append("Total conversion count is ").append(i).toString());
    WorldInfo worldinfo = getWorldInfo(par1Str);
    Object obj = null;

    if (worldinfo.getTerrainType() == WorldType.FLAT) {
      obj = new WorldChunkManagerHell(BiomeGenBase.plains, 0.5F, 0.5F);
    } else {
      obj = new WorldChunkManager(worldinfo.getSeed(), worldinfo.getTerrainType());
    }

    convertFile(
        new File(file, "region"),
        arraylist,
        ((WorldChunkManager) (obj)),
        0,
        i,
        par2IProgressUpdate);
    convertFile(
        new File(file1, "region"),
        arraylist1,
        new WorldChunkManagerHell(BiomeGenBase.hell, 1.0F, 0.0F),
        arraylist.size(),
        i,
        par2IProgressUpdate);
    convertFile(
        new File(file2, "region"),
        arraylist2,
        new WorldChunkManagerHell(BiomeGenBase.sky, 0.5F, 0.0F),
        arraylist.size() + arraylist1.size(),
        i,
        par2IProgressUpdate);
    worldinfo.setSaveVersion(19133);

    if (worldinfo.getTerrainType() == WorldType.DEFAULT_1_1) {
      worldinfo.setTerrainType(WorldType.DEFAULT);
    }

    createFile(par1Str);
    ISaveHandler isavehandler = getSaveLoader(par1Str, false);
    isavehandler.saveWorldInfo(worldinfo);
    return true;
  }
示例#14
0
 public void func_22095_a(WorldInfo worldinfo, List list) {
   worldinfo.setVersion(19132);
   super.func_22095_a(worldinfo, list);
 }
 public boolean isOldMapFormat(String s) {
   WorldInfo worldinfo = func_22173_b(s);
   return worldinfo != null && worldinfo.getSaveVersion() == 0;
 }
示例#16
0
 public String func_85114_a() {
   return String.valueOf(WorldInfo.func_85122_i(this.field_85115_a));
 }
 /** Checks if the save directory uses the old map format */
 public boolean isOldMapFormat(String par1Str) {
   WorldInfo worldinfo = getWorldInfo(par1Str);
   return worldinfo != null && worldinfo.getSaveVersion() != getSaveVersion();
 }