85 lines
3.5 KiB
Diff
85 lines
3.5 KiB
Diff
--- a/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
|
|
+++ b/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
|
|
@@ -214,6 +214,9 @@
|
|
this.func_202156_a((ChunkPrimer)p_75816_2_, p_75816_1_, nbttagcompound1);
|
|
}
|
|
|
|
+ net.minecraftforge.common.ForgeChunkManager.storeChunkNBT(p_75816_1_, p_75816_2_, nbttagcompound1);
|
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound));
|
|
+
|
|
this.func_75824_a(chunkpos, nbttagcompound);
|
|
} catch (Exception exception) {
|
|
field_151505_a.error("Failed to save chunk", (Throwable)exception);
|
|
@@ -391,10 +394,14 @@
|
|
for(int j = 0; j < p_75820_1_.func_177429_s().length; ++j) {
|
|
for(Entity entity : p_75820_1_.func_177429_s()[j]) {
|
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
+ try {
|
|
if (entity.func_70039_c(nbttagcompound)) {
|
|
p_75820_1_.func_177409_g(true);
|
|
nbttaglist1.add((INBTBase)nbttagcompound);
|
|
}
|
|
+ } catch (Exception e) {
|
|
+ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", entity.func_200600_R(), e);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -405,7 +412,11 @@
|
|
TileEntity tileentity = p_75820_1_.func_175625_s(blockpos);
|
|
if (tileentity != null) {
|
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
|
- tileentity.func_189515_b(nbttagcompound1);
|
|
+ try {
|
|
+ tileentity.func_189515_b(nbttagcompound1);
|
|
+ } catch (Exception e) {
|
|
+ LogManager.getLogger().error("A TileEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", tileentity.getClass().getName(), e);
|
|
+ }
|
|
nbttagcompound1.func_74757_a("keepPacked", false);
|
|
nbttaglist2.add((INBTBase)nbttagcompound1);
|
|
} else {
|
|
@@ -445,6 +456,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,12 +532,16 @@
|
|
chunk.func_177427_f(true);
|
|
}
|
|
|
|
+ if (p_75823_2_.func_74764_b("ForgeCaps")) {
|
|
+ chunk.readCapsFromNBT(p_75823_2_.func_74775_l("ForgeCaps"));
|
|
+ }
|
|
+
|
|
return chunk;
|
|
}
|
|
|
|
private void func_199814_a(NBTTagCompound p_199814_1_, Chunk p_199814_2_) {
|
|
NBTTagList nbttaglist = p_199814_1_.func_150295_c("Entities", 10);
|
|
- World world = p_199814_2_.func_177412_p();
|
|
+ World world = p_199814_2_.getWorld();
|
|
|
|
for(int i = 0; i < nbttaglist.size(); ++i) {
|
|
NBTTagCompound nbttagcompound = nbttaglist.func_150305_b(i);
|
|
@@ -813,4 +838,8 @@
|
|
|
|
return flag;
|
|
}
|
|
+
|
|
+ public int getPendingSaveCount() {
|
|
+ return this.field_75828_a.size();
|
|
+ }
|
|
}
|