ForgePatch/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch

40 lines
1.2 KiB
Diff

--- a/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
+++ b/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
@@ -445,6 +445,16 @@
p_75820_3_.func_74782_a("Heightmaps", nbttagcompound2);
p_75820_3_.func_74782_a("Structures", this.func_202160_a(p_75820_1_.field_76635_g, p_75820_1_.field_76647_h, p_75820_1_.func_201609_c(), p_75820_1_.func_201604_d()));
+
+ try
+ {
+ final NBTTagCompound capTag = p_75820_1_.writeCapsToNBT();
+ if (capTag != null) p_75820_3_.func_74782_a("ForgeCaps", capTag);
+ }
+ catch (Exception exception)
+ {
+ org.apache.logging.log4j.LogManager.getLogger().error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception);
+ }
}
private Chunk func_75823_a(IWorld p_75823_1_, NBTTagCompound p_75823_2_) {
@@ -511,6 +521,10 @@
chunk.func_177427_f(true);
}
+ if (p_75823_2_.func_74764_b("ForgeCaps")) {
+ chunk.readCapsFromNBT(p_75823_2_.func_74775_l("ForgeCaps"));
+ }
+
return chunk;
}
@@ -813,4 +827,8 @@
return flag;
}
+
+ public int getPendingSaveCount() {
+ return this.field_75828_a.size();
+ }
}