Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
5719e128fa
This brings in Spigots Oversized Chunks fix so that servers migrating from Spigot 1.12 to Paper 1.12 can safely transition the save formats. Spigot Changes: 79a30d7d Allow Saving Large Chunks
54 Zeilen
1.8 KiB
Diff
54 Zeilen
1.8 KiB
Diff
From 65277bb5c79ac221f24ca1bded6e71b69f559815 Mon Sep 17 00:00:00 2001
|
|
From: Antony Riley <antony@cyberiantiger.org>
|
|
Date: Tue, 29 Mar 2016 06:56:23 +0300
|
|
Subject: [PATCH] Reduce IO ops opening a new region file.
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
|
|
index c3424a35..eac8b22b 100644
|
|
--- a/src/main/java/net/minecraft/server/RegionFile.java
|
|
+++ b/src/main/java/net/minecraft/server/RegionFile.java
|
|
@@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.DataInputStream;
|
|
import java.io.DataOutputStream;
|
|
+import java.io.EOFException;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.RandomAccessFile;
|
|
+import java.nio.ByteBuffer;
|
|
+import java.nio.IntBuffer;
|
|
import java.util.List;
|
|
import java.util.zip.DeflaterOutputStream;
|
|
import java.util.zip.GZIPInputStream;
|
|
@@ -72,8 +75,16 @@ public class RegionFile {
|
|
|
|
int k;
|
|
|
|
+ // Paper Start
|
|
+ ByteBuffer header = ByteBuffer.allocate(8192);
|
|
+ while (header.hasRemaining()) {
|
|
+ if (this.c.getChannel().read(header) == -1) throw new EOFException();
|
|
+ }
|
|
+ header.clear();
|
|
+ IntBuffer headerAsInts = header.asIntBuffer();
|
|
+ // Paper End
|
|
for (j = 0; j < 1024; ++j) {
|
|
- k = this.c.readInt();
|
|
+ k = headerAsInts.get(); // Paper
|
|
this.d[j] = k;
|
|
// Spigot start
|
|
int length = k & 255;
|
|
@@ -99,7 +110,7 @@ public class RegionFile {
|
|
}
|
|
|
|
for (j = 0; j < 1024; ++j) {
|
|
- k = this.c.readInt();
|
|
+ k = headerAsInts.get(); // Paper
|
|
this.e[j] = k;
|
|
}
|
|
} catch (IOException ioexception) {
|
|
--
|
|
2.20.1
|
|
|