106 lines
3.9 KiB
Diff
106 lines
3.9 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java
|
|
@@ -107,20 +107,29 @@
|
|
NBTTagCompound nbttagcompound;
|
|
NBTTagCompound nbttagcompound1;
|
|
|
|
+ WorldInfo worldInfo = null;
|
|
+
|
|
if (file1.exists())
|
|
{
|
|
try
|
|
{
|
|
nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
|
|
nbttagcompound1 = nbttagcompound.func_74775_l("Data");
|
|
- return new WorldInfo(nbttagcompound1);
|
|
+ worldInfo = new WorldInfo(nbttagcompound1);
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
|
|
+ return worldInfo;
|
|
}
|
|
+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e)
|
|
+ {
|
|
+ throw e;
|
|
+ }
|
|
catch (Exception exception1)
|
|
{
|
|
exception1.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this);
|
|
file1 = new File(this.field_75770_b, "level.dat_old");
|
|
|
|
if (file1.exists())
|
|
@@ -129,7 +138,13 @@
|
|
{
|
|
nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
|
|
nbttagcompound1 = nbttagcompound.func_74775_l("Data");
|
|
- return new WorldInfo(nbttagcompound1);
|
|
+ worldInfo = new WorldInfo(nbttagcompound1);
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
|
|
+ return worldInfo;
|
|
+ }
|
|
+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e)
|
|
+ {
|
|
+ throw e;
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
@@ -146,6 +161,8 @@
|
|
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
|
nbttagcompound2.func_74782_a("Data", nbttagcompound1);
|
|
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound2);
|
|
+
|
|
try
|
|
{
|
|
File file1 = new File(this.field_75770_b, "level.dat_new");
|
|
@@ -184,6 +201,8 @@
|
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
|
nbttagcompound1.func_74782_a("Data", nbttagcompound);
|
|
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75761_1_, nbttagcompound1);
|
|
+
|
|
try
|
|
{
|
|
File file1 = new File(this.field_75770_b, "level.dat_new");
|
|
@@ -232,6 +251,7 @@
|
|
}
|
|
|
|
file1.renameTo(file2);
|
|
+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString());
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
@@ -262,6 +282,7 @@
|
|
p_75752_1_.func_70020_e(nbttagcompound);
|
|
}
|
|
|
|
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_75771_c, p_75752_1_.func_110124_au().toString());
|
|
return nbttagcompound;
|
|
}
|
|
|
|
@@ -301,4 +322,22 @@
|
|
{
|
|
return this.field_75767_f;
|
|
}
|
|
+
|
|
+ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player)
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ File file1 = new File(this.field_75771_c, player.func_110124_au().toString() + ".dat");
|
|
+
|
|
+ if (file1.exists() && file1.isFile())
|
|
+ {
|
|
+ return CompressedStreamTools.func_74796_a(new FileInputStream(file1));
|
|
+ }
|
|
+ }
|
|
+ catch (Exception exception)
|
|
+ {
|
|
+ field_151478_a.warn("Failed to load player data for " + player.func_70005_c_());
|
|
+ }
|
|
+ return null;
|
|
+ }
|
|
}
|