mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 16:18:02 +01:00
b62dfa0bf9
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers CraftBukkit Changes:1cf8b5dc
SPIGOT-4400: Populators running on existing chunks116cb9a1
SPIGOT-4399: Add attribute modifier equality test5ee1c18a
SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
53 lines
2 KiB
Diff
53 lines
2 KiB
Diff
From 3dcbb08c24ce42132cca1ad5df0ddddb756eae21 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 f4405be395..5d2853b9ce 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;
|
|
@@ -60,8 +63,16 @@ public class RegionFile {
|
|
this.f.set(1, false);
|
|
this.c.seek(0L);
|
|
|
|
+ // 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(int j1 = 0; j1 < 1024; ++j1) {
|
|
- int k = this.c.readInt();
|
|
+ int k = headerAsInts.get(); // Paper
|
|
this.d[j1] = k;
|
|
if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) {
|
|
for(int l = 0; l < (k & 255); ++l) {
|
|
@@ -71,7 +82,7 @@ public class RegionFile {
|
|
}
|
|
|
|
for(int k1 = 0; k1 < 1024; ++k1) {
|
|
- int l1 = this.c.readInt();
|
|
+ int l1 = headerAsInts.get(); // Paper
|
|
this.e[k1] = l1;
|
|
}
|
|
} catch (IOException ioexception) {
|
|
--
|
|
2.19.0
|
|
|