70 lines
2.9 KiB
Diff
70 lines
2.9 KiB
Diff
--- a/net/minecraft/world/storage/SaveHandler.java
|
|
+++ b/net/minecraft/world/storage/SaveHandler.java
|
|
@@ -50,6 +50,8 @@
|
|
CompoundNBT compoundnbt1 = new CompoundNBT();
|
|
compoundnbt1.func_218657_a("Data", compoundnbt);
|
|
|
|
+ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataSave(this, p_75755_1_, compoundnbt1);
|
|
+
|
|
try {
|
|
File file1 = new File(this.field_215774_c, "level.dat_new");
|
|
File file2 = new File(this.field_215774_c, "level.dat_old");
|
|
@@ -117,14 +119,14 @@
|
|
public WorldInfo func_75757_d() {
|
|
File file1 = new File(this.field_215774_c, "level.dat");
|
|
if (file1.exists()) {
|
|
- WorldInfo worldinfo = SaveFormat.func_215780_a(file1, this.field_215772_a);
|
|
+ WorldInfo worldinfo = SaveFormat.getWorldData(file1, this.field_215772_a, this);
|
|
if (worldinfo != null) {
|
|
return worldinfo;
|
|
}
|
|
}
|
|
|
|
file1 = new File(this.field_215774_c, "level.dat_old");
|
|
- return file1.exists() ? SaveFormat.func_215780_a(file1, this.field_215772_a) : null;
|
|
+ return file1.exists() ? SaveFormat.getWorldData(file1, this.field_215772_a, this) : null;
|
|
}
|
|
|
|
public void func_75761_a(WorldInfo p_75761_1_) {
|
|
@@ -142,6 +144,7 @@
|
|
}
|
|
|
|
file1.renameTo(file2);
|
|
+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, field_215775_d, p_75753_1_.func_110124_au().toString());
|
|
} catch (Exception var5) {
|
|
field_215773_b.warn("Failed to save player data for {}", (Object)p_75753_1_.func_200200_C_().getString());
|
|
}
|
|
@@ -165,6 +168,7 @@
|
|
int i = compoundnbt.func_150297_b("DataVersion", 3) ? compoundnbt.func_74762_e("DataVersion") : -1;
|
|
p_75752_1_.func_70020_e(NBTUtil.func_210822_a(this.field_215772_a, DefaultTypeReferences.PLAYER, compoundnbt, i));
|
|
}
|
|
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_215775_d, p_75752_1_.func_110124_au().toString());
|
|
|
|
return compoundnbt;
|
|
}
|
|
@@ -191,4 +195,24 @@
|
|
public DataFixer func_197718_i() {
|
|
return this.field_215772_a;
|
|
}
|
|
+
|
|
+ public CompoundNBT getPlayerNBT(net.minecraft.entity.player.ServerPlayerEntity player) {
|
|
+ try {
|
|
+ File file1 = new File(this.field_215775_d, player.func_189512_bd() + ".dat");
|
|
+ if (file1.exists() && file1.isFile()) {
|
|
+ CompoundNBT nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
|
|
+ if (nbt != null) {
|
|
+ nbt = NBTUtil.func_210822_a(this.field_215772_a, DefaultTypeReferences.PLAYER, nbt, nbt.func_150297_b("DataVersion", 3) ? nbt.func_74762_e("DataVersion") : -1);
|
|
+ }
|
|
+ return nbt;
|
|
+ }
|
|
+ } catch (Exception exception) {
|
|
+ field_215773_b.warn("Failed to load player data for " + player.func_200200_C_());
|
|
+ }
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ public File getPlayerFolder() {
|
|
+ return field_215775_d;
|
|
+ }
|
|
}
|