geforkt von Mirrors/Paper
Only write chunk data to disk if it serializes without throwing
This ensures at least a valid version of the chunk exists on disk, even if outdated
Dieser Commit ist enthalten in:
Ursprung
a5872264a3
Commit
a08630ed35
@ -0,0 +1,38 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||||
|
Date: Sun, 19 Dec 2021 09:13:41 -0800
|
||||||
|
Subject: [PATCH] Only write chunk data to disk if it serializes without
|
||||||
|
throwing
|
||||||
|
|
||||||
|
This ensures at least a valid version of the chunk exists
|
||||||
|
on disk, even if outdated
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
NbtIo.write(nbt, (DataOutput) dataoutputstream);
|
||||||
|
regionfile.setStatus(pos.x, pos.z, ChunkSerializer.getStatus(nbt)); // Paper - cache status on disk
|
||||||
|
regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone
|
||||||
|
+ dataoutputstream.close(); // Paper - only write if successful
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
if (dataoutputstream != null) {
|
||||||
|
try {
|
||||||
|
- dataoutputstream.close();
|
||||||
|
+ //dataoutputstream.close(); // Paper - don't write garbage data to disk if writing serialization fails
|
||||||
|
} catch (Throwable throwable1) {
|
||||||
|
throwable.addSuppressed(throwable1);
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
|
||||||
|
|
||||||
|
throw throwable;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- if (dataoutputstream != null) {
|
||||||
|
- dataoutputstream.close();
|
||||||
|
- }
|
||||||
|
+ // Paper - move into try block to only write if successfully serialized
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paper start
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren