Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
SPIGOT-1626 / MC-98994: Fix slow chunk performance
Please see https://bugs.mojang.com/browse/MC-98994 for full explanation.
Dieser Commit ist enthalten in:
Ursprung
94ba824302
Commit
60f01ef304
@ -79,11 +79,16 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
@@ -49,11 +70,15 @@
|
||||
@@ -49,11 +70,20 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Add async variant, provide compatibility
|
||||
+ public Chunk getOrCreateChunkFast(int x, int z) {
|
||||
+ Chunk chunk = chunks.get(LongHash.toLong(x, z));
|
||||
+ return (chunk == null) ? getChunkAt(x, z) : chunk;
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return chunks.get(LongHash.toLong(x, z));
|
||||
+ }
|
||||
@ -98,7 +103,7 @@
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@@ -61,20 +86,67 @@
|
||||
@@ -61,20 +91,67 @@
|
||||
Chunk chunk = this.getLoadedChunkAt(i, j);
|
||||
|
||||
if (chunk == null) {
|
||||
@ -168,7 +173,7 @@
|
||||
|
||||
if (chunk == null) {
|
||||
long k = ChunkCoordIntPair.a(i, j);
|
||||
@@ -92,11 +164,38 @@
|
||||
@@ -92,11 +169,38 @@
|
||||
crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator);
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@ -209,7 +214,7 @@
|
||||
chunk.loadNearby(this, this.chunkGenerator);
|
||||
}
|
||||
|
||||
@@ -142,10 +241,12 @@
|
||||
@@ -142,10 +246,12 @@
|
||||
|
||||
public boolean a(boolean flag) {
|
||||
int i = 0;
|
||||
@ -225,7 +230,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.saveChunkNOP(chunk);
|
||||
@@ -170,22 +271,43 @@
|
||||
@@ -170,22 +276,43 @@
|
||||
|
||||
public boolean unloadChunks() {
|
||||
if (!this.world.savingDisabled) {
|
||||
@ -276,7 +281,7 @@
|
||||
|
||||
this.chunkLoader.a();
|
||||
}
|
||||
@@ -198,7 +320,8 @@
|
||||
@@ -198,7 +325,8 @@
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -286,7 +291,7 @@
|
||||
}
|
||||
|
||||
public List<BiomeBase.BiomeMeta> a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
@@ -210,10 +333,11 @@
|
||||
@@ -210,10 +338,11 @@
|
||||
}
|
||||
|
||||
public int g() {
|
||||
|
9
nms-patches/IChunkProvider.patch
Normale Datei
9
nms-patches/IChunkProvider.patch
Normale Datei
@ -0,0 +1,9 @@
|
||||
--- a/net/minecraft/server/IChunkProvider.java
|
||||
+++ b/net/minecraft/server/IChunkProvider.java
|
||||
@@ -9,4 +9,6 @@
|
||||
boolean unloadChunks();
|
||||
|
||||
String getName();
|
||||
+
|
||||
+ Chunk getOrCreateChunkFast(int x, int z); // CraftBukkit
|
||||
}
|
@ -86,7 +86,12 @@
|
||||
}
|
||||
|
||||
public World b() {
|
||||
@@ -197,6 +260,27 @@
|
||||
@@ -193,10 +256,31 @@
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
- return this.chunkProvider.getChunkAt(i, j);
|
||||
+ return this.chunkProvider.getOrCreateChunkFast(i, j); // CraftBukkit
|
||||
}
|
||||
|
||||
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren