Progress on New Save Format

Integrated the base code for our new save format. It still needs more
work but at least some substance is there. Ignore the file not found
messages that come up when trying to save the world's data - since we're
not actually writing files, an exception occurs when we some later code
tries to move non-existent save files.

Also moved the FileFilter functionality out of DungeonHelper and into
its own class, FileFilters, since it's finally needed more broadly.
This commit is contained in:
SenseiKiwi
2013-09-11 22:13:42 -04:00
parent 1d3038288b
commit c2fa4964f8
12 changed files with 397 additions and 93 deletions

View File

@@ -33,29 +33,11 @@ import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonPackConfigReader;
import StevenDimDoors.mod_pocketDim.dungeon.pack.DungeonType;
import StevenDimDoors.mod_pocketDim.items.ItemDimensionalDoor;
import StevenDimDoors.mod_pocketDim.util.ConfigurationProcessingException;
import StevenDimDoors.mod_pocketDim.util.FileFilters;
import StevenDimDoors.mod_pocketDim.util.WeightedContainer;
public class DungeonHelper
{
//TODO: File-handling functionality should be spun off to a helper class later
private static class DirectoryFilter implements FileFilter
{
@Override
public boolean accept(File file)
{
return file.isDirectory();
}
}
private static class SchematicFileFilter implements FileFilter
{
@Override
public boolean accept(File file)
{
return file.isFile() && file.getName().endsWith(SCHEMATIC_FILE_EXTENSION);
}
}
private static DungeonHelper instance = null;
private static DDProperties properties = null;
@@ -387,7 +369,7 @@ public class DungeonHelper
File[] packFiles;
ArrayList<String> packFilePaths;
File directory = new File(path);
SchematicFileFilter schematicFileFilter = new SchematicFileFilter();
FileFilter schematicFileFilter = new FileFilters.FileExtensionFilter(SCHEMATIC_FILE_EXTENSION);
//Check that the Ruins pack has been loaded
if (RuinsPack == null)
@@ -411,7 +393,7 @@ public class DungeonHelper
schematics = null; //Release memory
//Load the custom dungeon packs
packDirectories = directory.listFiles(new DirectoryFilter());
packDirectories = directory.listFiles(new FileFilters.DirectoryFilter());
if (packDirectories != null)
{
//Loop through each directory, which is assumed to be a dungeon pack