From f2606228bb13bf29fcc75fbca09a861070cfb67d Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Fri, 13 Nov 2020 14:51:22 +0000 Subject: [PATCH] Revert "Zero pad chunks before saving them to the disk" This reverts commit 4ba3c0542f6f854e1d5186dd94bb1ecb2e30bc76. --- ...hunks-before-saving-them-to-the-disk.patch | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 Spigot-Server-Patches/0599-Zero-pad-chunks-before-saving-them-to-the-disk.patch diff --git a/Spigot-Server-Patches/0599-Zero-pad-chunks-before-saving-them-to-the-disk.patch b/Spigot-Server-Patches/0599-Zero-pad-chunks-before-saving-them-to-the-disk.patch deleted file mode 100644 index 908de7cbba..0000000000 --- a/Spigot-Server-Patches/0599-Zero-pad-chunks-before-saving-them-to-the-disk.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Toon Schoenmakers -Date: Mon, 12 Oct 2020 18:59:12 +0200 -Subject: [PATCH] Zero pad chunks before saving them to the disk - -This makes the unused data inside region files more repeatable. -Which will result in better compression in case the entire world directory -is compressed (like in backups). Which will naturally result in smaller backups. - -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 1751fb6934d9242e475c1a44b2a4a1ade6987766..e969625d246f4657b4e802ac6a9d11e5c3b2e8c3 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -513,13 +513,14 @@ public class RegionFile implements AutoCloseable { - } - - } -+ private static final ByteBuffer zero = ByteBuffer.allocateDirect(4096); - // Paper end - class ChunkBuffer extends ByteArrayOutputStream { - - private final ChunkCoordIntPair b; - - public ChunkBuffer(ChunkCoordIntPair chunkcoordintpair) { -- super(8096); -+ super(8192); // Paper - super.write(0); - super.write(0); - super.write(0); -@@ -532,6 +533,17 @@ public class RegionFile implements AutoCloseable { - ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count); - - bytebuffer.putInt(0, this.count - 5 + 1); -+ -+ // Paper start -+ int size = (this.count + 4095) & ~4095; -+ -+ // increase the limit to be the next chunk of 4096 -+ bytebuffer.limit(size); -+ -+ // now just fill the rest with zeros from our static buffer -+ bytebuffer.put(zero); -+ // Paper end -+ - RegionFile.this.a(this.b, bytebuffer); - } - }