Add in a savehandler strategy for reading and writing data to the

world save. This service is only available to coremods via the
WorldAccessContainer interface on the mod wrapper. This is deliberate
and will not change.
This commit is contained in:
Christian committed 2012-10-02 21:54:47 -04:00
1 parent a554846e57
commit 550e622bc7
6 files changed
+236 -1

No files matched your search

@@ -0,0 +1,59 @@
--- ../src-base/common/net/minecraft/src/SaveHandler.java
+++ ../src-work/common/net/minecraft/src/SaveHandler.java
@@ -7,6 +7,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Logger;
+
+import cpw.mods.fml.common.FMLCommonHandler;
public class SaveHandler implements ISaveHandler, IPlayerFileData
{
@@ -97,14 +99,16 @@
File var1 = new File(this.field_75770_b, "level.dat");
NBTTagCompound var2;
NBTTagCompound var3;
-
+ WorldInfo worldInfo = null;
if (var1.exists())
{
try
{
var2 = CompressedStreamTools.func_74796_a(new FileInputStream(var1));
var3 = var2.func_74775_l("Data");
- return new WorldInfo(var3);
+ worldInfo = new WorldInfo(var3);
+ FMLCommonHandler.instance().handleWorldDataLoad(worldInfo, var2);
+ return worldInfo;
}
catch (Exception var5)
{
@@ -120,7 +124,9 @@
{
var2 = CompressedStreamTools.func_74796_a(new FileInputStream(var1));
var3 = var2.func_74775_l("Data");
- return new WorldInfo(var3);
+ worldInfo = new WorldInfo(var3);
+ FMLCommonHandler.instance().handleWorldDataLoad(worldInfo, var2);
+ return worldInfo;
}
catch (Exception var4)
{
@@ -136,7 +142,7 @@
NBTTagCompound var3 = p_75755_1_.func_76082_a(p_75755_2_);
NBTTagCompound var4 = new NBTTagCompound();
var4.func_74782_a("Data", var3);
-
+ FMLCommonHandler.instance().handleWorldDataSave(p_75755_1_, var4);
try
{
File var5 = new File(this.field_75770_b, "level.dat_new");
@@ -174,7 +180,7 @@
NBTTagCompound var2 = p_75761_1_.func_76066_a();
NBTTagCompound var3 = new NBTTagCompound();
var3.func_74782_a("Data", var2);
-
+ FMLCommonHandler.instance().handleWorldDataSave(p_75761_1_, var3);
try
{
File var4 = new File(this.field_75770_b, "level.dat_new");