/** * Attempts to delete all Minecraft Worlds with "TEMP_" in front of the name * @param currentWorld excludes this world from deletion, can be null */ public static void cleanupTemporaryWorlds(String currentWorld){ List<SaveFormatComparator> saveList; ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader(); isaveformat.flushCache(); try{ saveList = isaveformat.getSaveList(); } catch (AnvilConverterException e){ e.printStackTrace(); return; } String searchString = tempMark + AddressHelper.getMissionControlPort() + "_"; for (SaveFormatComparator s: saveList){ String folderName = s.getFileName(); if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){ isaveformat.deleteWorldDirectory(folderName); } } }
public static void reloadSaves() { File saveDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/local"); if (!saveDir.exists()) return; List<SaveFormatComparator> saves; try { saves = Minecraft.getMinecraft().getSaveLoader().getSaveList(); } catch (Exception e) { logger.error("Error loading saves", e); return; } HashSet<String> saveFileNames = new HashSet<String>(); for (SaveFormatComparator save : saves) saveFileNames.add(save.getFileName()); for (File file : saveDir.listFiles()) if (file.isDirectory() && !saveFileNames.contains(file.getName())) ObfuscationRun.deleteDir(file, true); }
public void loadSaveList() throws AnvilConverterException, IllegalAccessException { ISaveFormat saveFormat = mc.getSaveLoader(); java.util.List list = saveFormat.getSaveList(); ArrayList newList = new ArrayList(); for(Object obj : list) { if(obj instanceof SaveFormatComparator) { //SaveFormatComparator comparator = (SaveFormatComparator) obj; //if(saveFormat.getWorldInfo(comparator.getFileName()).getNBTTagCompound().hasKey("AgeCraft")) { newList.add(obj); //} } } Collections.sort(newList); super_field_146639_s.set(this, newList); super_field_146640_r.setInt(this, -1); }
public List<SaveFormatComparator> getSaveList() throws AnvilConverterException { if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory()) { List<SaveFormatComparator> list = Lists.<SaveFormatComparator>newArrayList(); File[] afile = this.savesDirectory.listFiles(); for (File file1 : afile) { if (file1.isDirectory()) { String s = file1.getName(); WorldInfo worldinfo = this.getWorldInfo(s); if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133)) { boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion(); String s1 = worldinfo.getWorldName(); if (StringUtils.isEmpty(s1)) { s1 = s; } long i = 0L; list.add(new SaveFormatComparator(s, s1, worldinfo.getLastTimePlayed(), i, worldinfo.getGameType(), flag, worldinfo.isHardcoreModeEnabled(), worldinfo.areCommandsAllowed())); } } } return list; } else { throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!"); } }
public List<RealmsLevelSummary> getLevelList() throws AnvilConverterException { List<RealmsLevelSummary> list = Lists.<RealmsLevelSummary>newArrayList(); for (SaveFormatComparator saveformatcomparator : this.levelStorageSource.getSaveList()) { list.add(new RealmsLevelSummary(saveformatcomparator)); } return list; }
protected String func_146614_d(int p_146614_1_) { String s = ((SaveFormatComparator)this.field_146639_s.get(p_146614_1_)).getDisplayName(); if (StringUtils.isEmpty(s)) { s = I18n.format("selectWorld.world", new Object[0]) + " " + (p_146614_1_ + 1); } return s; }
protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) { SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.this.field_146639_s.get(entryID); String s = saveformatcomparator.getDisplayName(); if (StringUtils.isEmpty(s)) { s = GuiSelectWorld.this.field_146637_u + " " + (entryID + 1); } String s1 = saveformatcomparator.getFileName(); s1 = s1 + " (" + GuiSelectWorld.this.field_146633_h.format(new Date(saveformatcomparator.getLastTimePlayed())); s1 = s1 + ")"; String s2 = ""; if (saveformatcomparator.requiresConversion()) { s2 = GuiSelectWorld.this.field_146636_v + " " + s2; } else { s2 = GuiSelectWorld.this.field_146635_w[saveformatcomparator.getEnumGameType().getID()]; if (saveformatcomparator.isHardcoreModeEnabled()) { s2 = EnumChatFormatting.DARK_RED + I18n.format("gameMode.hardcore", new Object[0]) + EnumChatFormatting.RESET; } if (saveformatcomparator.getCheatsEnabled()) { s2 = s2 + ", " + I18n.format("selectWorld.cheats", new Object[0]); } } GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s, p_180791_2_ + 2, p_180791_3_ + 1, 16777215); GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s1, p_180791_2_ + 2, p_180791_3_ + 12, 8421504); GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s2, p_180791_2_ + 2, p_180791_3_ + 12 + 10, 8421504); }
protected String func_146614_d(int p_146614_1_) { String var2 = ((SaveFormatComparator)this.field_146639_s.get(p_146614_1_)).getDisplayName(); if (var2 == null || MathHelper.stringNullOrLengthZero(var2)) { var2 = I18n.format("selectWorld.world", new Object[0]) + " " + (p_146614_1_ + 1); } return var2; }
protected void drawSlot(int p_148126_1_, int p_148126_2_, int p_148126_3_, int p_148126_4_, Tessellator p_148126_5_, int p_148126_6_, int p_148126_7_) { SaveFormatComparator var8 = (SaveFormatComparator)GuiSelectWorld.this.field_146639_s.get(p_148126_1_); String var9 = var8.getDisplayName(); if (var9 == null || MathHelper.stringNullOrLengthZero(var9)) { var9 = GuiSelectWorld.this.field_146637_u + " " + (p_148126_1_ + 1); } String var10 = var8.getFileName(); var10 = var10 + " (" + GuiSelectWorld.this.field_146633_h.format(new Date(var8.getLastTimePlayed())); var10 = var10 + ")"; String var11 = ""; if (var8.requiresConversion()) { var11 = GuiSelectWorld.this.field_146636_v + " " + var11; } else { var11 = GuiSelectWorld.this.field_146635_w[var8.getEnumGameType().getID()]; if (var8.isHardcoreModeEnabled()) { var11 = EnumChatFormatting.DARK_RED + I18n.format("gameMode.hardcore", new Object[0]) + EnumChatFormatting.RESET; } if (var8.getCheatsEnabled()) { var11 = var11 + ", " + I18n.format("selectWorld.cheats", new Object[0]); } } GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, var9, p_148126_2_ + 2, p_148126_3_ + 1, 16777215); GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, var10, p_148126_2_ + 2, p_148126_3_ + 12, 8421504); GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, var11, p_148126_2_ + 2, p_148126_3_ + 12 + 10, 8421504); }
public List getLevelList() throws AnvilConverterException { ArrayList arraylist = new ArrayList(); Iterator iterator = this.levelStorageSource.getSaveList().iterator(); while (iterator.hasNext()) { SaveFormatComparator saveformatcomparator = (SaveFormatComparator)iterator.next(); arraylist.add(new RealmsLevelSummary(saveformatcomparator)); } return arraylist; }
protected String func_146614_d(int p_146614_1_) { String s = ((SaveFormatComparator)this.field_146639_s.get(p_146614_1_)).getDisplayName(); if (s == null || MathHelper.stringNullOrLengthZero(s)) { s = I18n.format("selectWorld.world", new Object[0]) + " " + (p_146614_1_ + 1); } return s; }
protected void drawSlot(int p_148126_1_, int p_148126_2_, int p_148126_3_, int p_148126_4_, Tessellator p_148126_5_, int p_148126_6_, int p_148126_7_) { SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.this.field_146639_s.get(p_148126_1_); String s = saveformatcomparator.getDisplayName(); if (s == null || MathHelper.stringNullOrLengthZero(s)) { s = GuiSelectWorld.this.field_146637_u + " " + (p_148126_1_ + 1); } String s1 = saveformatcomparator.getFileName(); s1 = s1 + " (" + GuiSelectWorld.this.field_146633_h.format(new Date(saveformatcomparator.getLastTimePlayed())); s1 = s1 + ")"; String s2 = ""; if (saveformatcomparator.requiresConversion()) { s2 = GuiSelectWorld.this.field_146636_v + " " + s2; } else { s2 = GuiSelectWorld.this.field_146635_w[saveformatcomparator.getEnumGameType().getID()]; if (saveformatcomparator.isHardcoreModeEnabled()) { s2 = EnumChatFormatting.DARK_RED + I18n.format("gameMode.hardcore", new Object[0]) + EnumChatFormatting.RESET; } if (saveformatcomparator.getCheatsEnabled()) { s2 = s2 + ", " + I18n.format("selectWorld.cheats", new Object[0]); } } GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s, p_148126_2_ + 2, p_148126_3_ + 1, 16777215); GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s1, p_148126_2_ + 2, p_148126_3_ + 12, 8421504); GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s2, p_148126_2_ + 2, p_148126_3_ + 12 + 10, 8421504); }
@SideOnly(Side.CLIENT) public List func_75799_b() throws AnvilConverterException { if(this.field_75808_a != null && this.field_75808_a.exists() && this.field_75808_a.isDirectory()) { ArrayList var1 = new ArrayList(); File[] var2 = this.field_75808_a.listFiles(); File[] var3 = var2; int var4 = var2.length; for(int var5 = 0; var5 < var4; ++var5) { File var6 = var3[var5]; if(var6.isDirectory()) { String var7 = var6.getName(); WorldInfo var8 = this.func_75803_c(var7); if(var8 != null && (var8.func_76088_k() == 19132 || var8.func_76088_k() == 19133)) { boolean var9 = var8.func_76088_k() != this.func_75812_c(); String var10 = var8.func_76065_j(); if(var10 == null || MathHelper.func_76139_a(var10)) { var10 = var7; } long var11 = 0L; var1.add(new SaveFormatComparator(var7, var10, var8.func_76057_l(), var11, var8.func_76077_q(), var9, var8.func_76093_s(), var8.func_76086_u())); } } } return var1; } else { throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!"); } }
@SideOnly(Side.CLIENT) public List func_75799_b() throws AnvilConverterException { ArrayList var1 = new ArrayList(); for(int var2 = 0; var2 < 5; ++var2) { String var3 = "World" + (var2 + 1); WorldInfo var4 = this.func_75803_c(var3); if(var4 != null) { var1.add(new SaveFormatComparator(var3, "", var4.func_76057_l(), var4.func_76092_g(), var4.func_76077_q(), false, var4.func_76093_s(), var4.func_76086_u())); } } return var1; }
protected void func_77214_a(int p_77214_1_, int p_77214_2_, int p_77214_3_, int p_77214_4_, Tessellator p_77214_5_) { SaveFormatComparator var6 = (SaveFormatComparator)GuiSelectWorld.func_74068_a(this.field_77254_a).get(p_77214_1_); String var7 = var6.func_75788_b(); if(var7 == null || MathHelper.func_76139_a(var7)) { var7 = GuiSelectWorld.func_82313_g(this.field_77254_a) + " " + (p_77214_1_ + 1); } String var8 = var6.func_75786_a(); var8 = var8 + " (" + GuiSelectWorld.func_82315_h(this.field_77254_a).format(new Date(var6.func_75784_e())); var8 = var8 + ")"; String var9 = ""; if(var6.func_75785_d()) { var9 = GuiSelectWorld.func_82311_i(this.field_77254_a) + " " + var9; } else { var9 = GuiSelectWorld.func_82314_j(this.field_77254_a)[var6.func_75790_f().func_77148_a()]; if(var6.func_75789_g()) { var9 = EnumChatFormatting.DARK_RED + I18n.func_135053_a("gameMode.hardcore") + EnumChatFormatting.RESET; } if(var6.func_75783_h()) { var9 = var9 + ", " + I18n.func_135053_a("selectWorld.cheats"); } } this.field_77254_a.func_73731_b(this.field_77254_a.field_73886_k, var7, p_77214_2_ + 2, p_77214_3_ + 1, 16777215); this.field_77254_a.func_73731_b(this.field_77254_a.field_73886_k, var8, p_77214_2_ + 2, p_77214_3_ + 12, 8421504); this.field_77254_a.func_73731_b(this.field_77254_a.field_73886_k, var9, p_77214_2_ + 2, p_77214_3_ + 12 + 10, 8421504); }
protected String func_74063_d(int p_74063_1_) { String var2 = ((SaveFormatComparator)this.field_74078_n.get(p_74063_1_)).func_75788_b(); if(var2 == null || MathHelper.func_76139_a(var2)) { var2 = I18n.func_135053_a("selectWorld.world") + " " + (p_74063_1_ + 1); } return var2; }
protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) { SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.getSize(this.parentWorldGui).get(par1); String s = saveformatcomparator.getDisplayName(); if (s == null || MathHelper.stringNullOrLengthZero(s)) { s = GuiSelectWorld.func_82313_g(this.parentWorldGui) + " " + (par1 + 1); } String s1 = saveformatcomparator.getFileName(); s1 = s1 + " (" + GuiSelectWorld.func_82315_h(this.parentWorldGui).format(new Date(saveformatcomparator.getLastTimePlayed())); s1 = s1 + ")"; String s2 = ""; if (saveformatcomparator.requiresConversion()) { s2 = GuiSelectWorld.func_82311_i(this.parentWorldGui) + " " + s2; } else { s2 = GuiSelectWorld.func_82314_j(this.parentWorldGui)[saveformatcomparator.getEnumGameType().getID()]; if (saveformatcomparator.isHardcoreModeEnabled()) { s2 = EnumChatFormatting.DARK_RED + I18n.getString("gameMode.hardcore") + EnumChatFormatting.RESET; } if (saveformatcomparator.getCheatsEnabled()) { s2 = s2 + ", " + I18n.getString("selectWorld.cheats"); } } this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, s, par2 + 2, par3 + 1, 16777215); this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, s1, par2 + 2, par3 + 12, 8421504); this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, s2, par2 + 2, par3 + 12 + 10, 8421504); }
/** * returns the name of the saved game */ protected String getSaveName(int par1) { String s = ((SaveFormatComparator)this.saveList.get(par1)).getDisplayName(); if (s == null || MathHelper.stringNullOrLengthZero(s)) { s = I18n.getString("selectWorld.world") + " " + (par1 + 1); } return s; }
protected String getSaveFileName(int i) { if (saveList.size() < i + 1) { return null; } else { return ((SaveFormatComparator) saveList.get(i)).getFileName(); } }
/** * returns the name of the saved game */ protected String getSaveName(int par1) { String s = ((SaveFormatComparator) this.saveList.get(par1)).getDisplayName(); if (s == null || MathHelper.stringNullOrLengthZero(s)) { s = I18n.func_135053_a("selectWorld.world") + " " + (par1 + 1); } return s; }
public RealmsLevelSummary(SaveFormatComparator p_i1109_1_) { this.levelSummary = p_i1109_1_; }
public int compareTo(SaveFormatComparator p_compareTo_1_) { return this.levelSummary.compareTo(p_compareTo_1_); }
protected String func_146621_a(int p_146621_1_) { return ((SaveFormatComparator)this.field_146639_s.get(p_146621_1_)).getFileName(); }