Fixed an issue with the save helper
This commit is contained in:
parent
06c88806dd
commit
fd6c5d5990
3 changed files with 16 additions and 4 deletions
|
@ -23,6 +23,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import dark.core.common.ExternalModHandler;
|
||||
import dark.core.prefab.helpers.FluidHelper;
|
||||
import dark.core.registration.ModObjectRegistry;
|
||||
import dark.core.save.SaveManager;
|
||||
|
||||
public abstract class ModPrefab
|
||||
{
|
||||
|
@ -94,6 +95,7 @@ public abstract class ModPrefab
|
|||
Modstats.instance().getReporter().registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new FluidHelper());
|
||||
MinecraftForge.EVENT_BUS.register(SaveManager.instance());
|
||||
UniversalElectricity.initiate();
|
||||
Compatibility.initiate();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class NBTFileHelper
|
|||
{
|
||||
try
|
||||
{
|
||||
File tempFile = new File(file.getAbsoluteFile(), file.getName() + ".tmp");
|
||||
File tempFile = new File(file.getParent(), file.getName() + ".tmp");
|
||||
|
||||
CompressedStreamTools.writeCompressed(data, new FileOutputStream(tempFile));
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class NBTFileHelper
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Failed to save " + file.getName() + ".dat!");
|
||||
System.out.println("Failed to save " + file.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class NBTFileHelper
|
|||
* @return true if everything goes well */
|
||||
public static boolean saveNBTFile(String filename, NBTTagCompound data)
|
||||
{
|
||||
return saveNBTFile(getWorldSaveDirectory(MinecraftServer.getServer().getFolderName()), filename, data);
|
||||
return saveNBTFile(getWorldSaveDirectory(MinecraftServer.getServer().getFolderName()), filename + ".dat", data);
|
||||
}
|
||||
|
||||
/** Reads NBT data from the world folder.
|
||||
|
@ -92,7 +92,7 @@ public class NBTFileHelper
|
|||
{
|
||||
if (saveDirectory != null && filename != null)
|
||||
{
|
||||
if(create && !saveDirectory.exists())
|
||||
if (create && !saveDirectory.exists())
|
||||
{
|
||||
saveDirectory.mkdirs();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,16 @@ public class SaveManager
|
|||
private static HashMap<Class<?>, String> classToIDMap = new HashMap<Class<?>, String>();
|
||||
private static List<Object> saveList = new ArrayList<Object>();
|
||||
private static List<Object> objects = new ArrayList<Object>();
|
||||
private static SaveManager instance;
|
||||
|
||||
public static SaveManager instance()
|
||||
{
|
||||
if(instance == null)
|
||||
{
|
||||
instance = new SaveManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/** Called when the object wants to be save only on the next save call. Will be removed from the
|
||||
* save manager after */
|
||||
|
|
Loading…
Reference in a new issue