Files
2019-02-24 22:29:41 +08:00

28 lines
1.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/storage/SaveFormatOld.java
+++ ../src-work/minecraft/net/minecraft/world/storage/SaveFormatOld.java
@@ -109,6 +109,24 @@
}
}
+ //Forge: Special version of the above that runs during actual world loading and not metadata gathering.
+ public static WorldInfo loadAndFix(File file, DataFixer fixer, SaveHandler save)
+ {
+ try
+ {
+ NBTTagCompound nbt = CompressedStreamTools.readCompressed(new FileInputStream(file));
+ WorldInfo info = new WorldInfo(fixer.process(FixTypes.LEVEL, nbt.getCompoundTag("Data")));
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(save, info, nbt);
+ return info;
+ }
+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) { throw e; }
+ catch (Exception exception)
+ {
+ LOGGER.error((String)("Exception reading " + file), (Throwable)exception);
+ return null;
+ }
+ }
+
@SideOnly(Side.CLIENT)
public void renameWorld(String dirName, String newName)
{