Paper/Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch
Aikar 13d1abf01e
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has only been PARTIALLY tested by PaperMC and as with ANY update, please do your own testing

I've tested basic region file saving as well as our oversized chunks approach.

Bukkit Changes:
e167e549 Clarify MerchantInventory#getSelectedRecipe.
3a1d5b8f Apply default permissions by registration order.
c64cc93f Make tags Keyed
ec037ed7 Added a method to get a list of tags
bfb6ef86 Introduce rotation methods to the Vector class
fc727372 Remove draft API from FluidLevelChangeEvent

CraftBukkit Changes:
6430d9c0 SPIGOT-4632: BlockState location is not fixed
14cd1688 Fix CraftInventoryMerchant#getSelectedRecipe if there is no active merchant recipe.
c24abab7 Load custom permissions after default permissions.
bc99dfe8 Make tags Keyed
6fce004f Added a method to get a list of tags

Spigot Changes:
e5e5c7c6 Allow Saving Large Chunks
e8d3881c Rebuild patches
2019-02-21 22:41:40 -05:00

42 lines
1.5 KiB
Diff

From 6411f52ac4ce53d7de71028c657dfc2e6b89e001 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 9626396745..e2d4450e90 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -71,9 +71,17 @@ public class RegionFile {
this.c.seek(0L);
int k;
+ // Paper Start
+ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192);
+ while (header.hasRemaining()) {
+ if (this.c.getChannel().read(header) == -1) throw new java.io.EOFException();
+ }
+ header.clear();
+ java.nio.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 +107,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