3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-19 13:00:06 +01:00

Readd chunk priority patch, including many chunk system fixes from tuinity (#6488)

Dieser Commit ist enthalten in:
Spottedleaf 2021-08-25 19:16:27 -07:00 committet von GitHub
Ursprung 3773df24ce
Commit ba4cf68774
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
176 geänderte Dateien mit 1055 neuen und 480 gelöschten Zeilen

Datei anzeigen

@ -3079,7 +3079,7 @@ index e9d2034f0753670c2ce69cc93c7e98e89af65c87..2b62f4664f439808661d559dc99762bf
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401efca995293 100644
index 9591f50922343283597bad6d9ac17c175d8ae230..48c876381d75c66f24d59bd2c415dd7de293afee 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -44,6 +44,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
@ -3090,7 +3090,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
public class ServerChunkCache extends ChunkSource {
@@ -66,6 +67,158 @@ public class ServerChunkCache extends ChunkSource {
@@ -66,6 +67,156 @@ public class ServerChunkCache extends ChunkSource {
@Nullable
@VisibleForDebug
private NaturalSpawner.SpawnState lastSpawnState;
@ -3227,9 +3227,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
+
+ try {
+ if (onLoad != null) {
+ chunkMap.callbackExecutor.execute(() -> {
+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback.
+ });
+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback.
+ }
+ } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath) {
@ -3249,7 +3247,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, boolean flag, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<DimensionDataStorage> supplier) {
this.level = world;
@@ -127,6 +280,49 @@ public class ServerChunkCache extends ChunkSource {
@@ -127,6 +278,49 @@ public class ServerChunkCache extends ChunkSource {
this.lastChunk[0] = chunk;
}
@ -3299,7 +3297,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
@Nullable
@Override
public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) {
@@ -453,7 +649,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -453,7 +647,7 @@ public class ServerChunkCache extends ChunkSource {
}
this.level.getProfiler().popPush("broadcast");

Datei anzeigen

@ -1135,10 +1135,10 @@ index 2b62f4664f439808661d559dc99762bfbac09b16..4788946d7fb25c1b0f26e6a038924c4a
public void broadcast(Entity entity, Packet<?> packet) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947ba2c285ae 100644
index 48c876381d75c66f24d59bd2c415dd7de293afee..e11b4be6e6990101ce77b6349ab8c70453e835a5 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -348,13 +348,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -346,13 +346,15 @@ public class ServerChunkCache extends ChunkSource {
}
gameprofilerfiller.incrementCounter("getChunkCacheMiss");
@ -1156,7 +1156,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
}, (playerchunk_failure) -> {
@@ -554,7 +556,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -552,7 +554,9 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
@ -1166,7 +1166,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b
}
@Override
@@ -592,7 +596,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -590,7 +594,9 @@ public class ServerChunkCache extends ChunkSource {
this.runDistanceManagerUpdates();
this.level.timings.doChunkMap.stopTiming(); // Spigot
this.level.getProfiler().popPush("chunks");
@ -1176,7 +1176,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b
this.level.timings.doChunkUnload.startTiming(); // Spigot
this.level.getProfiler().popPush("unload");
this.chunkMap.tick(booleansupplier);
@@ -616,14 +622,17 @@ public class ServerChunkCache extends ChunkSource {
@@ -614,14 +620,17 @@ public class ServerChunkCache extends ChunkSource {
boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit
this.level.getProfiler().push("naturalSpawnCount");
@ -1194,7 +1194,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b
list.forEach((playerchunk) -> {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
@@ -637,15 +646,18 @@ public class ServerChunkCache extends ChunkSource {
@@ -635,15 +644,18 @@ public class ServerChunkCache extends ChunkSource {
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
}
@ -1215,7 +1215,7 @@ index 8513490230f5fae0042f536b69b401efca995293..c5bffd1b40ca9ae3c973044c1ad4947b
}
this.level.getProfiler().popPush("broadcast");
@@ -653,15 +665,20 @@ public class ServerChunkCache extends ChunkSource {
@@ -651,15 +663,20 @@ public class ServerChunkCache extends ChunkSource {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error
Objects.requireNonNull(playerchunk);

Datei anzeigen

@ -36,10 +36,10 @@ index 5ce8ac377b0d2b05dd90baa67f420945cc419609..919a489a5c7b338659c62ae67fc0a6ce
});
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c5bffd1b40ca9ae3c973044c1ad4947ba2c285ae..918555ba0af8a779ad55c7cf73f615eb804d00d9 100644
index e11b4be6e6990101ce77b6349ab8c70453e835a5..a778eff06a24a665874a315704f00dc5996420c9 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -632,6 +632,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -630,6 +630,15 @@ public class ServerChunkCache extends ChunkSource {
List<ChunkHolder> list = Lists.newArrayList(this.chunkMap.getChunks());
Collections.shuffle(list);
@ -56,7 +56,7 @@ index c5bffd1b40ca9ae3c973044c1ad4947ba2c285ae..918555ba0af8a779ad55c7cf73f615eb
list.forEach((playerchunk) -> {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 823fc38b5bbf5eac2d2e7cc48c4b0557d252f960..fb42d7e3a1a23c02e8fd2cc04e6986ead581018c 100644
index 9761078ba0c984eec303e96d1ee64fbce659075c..ca9662d92db176270ec5490ecc51208b666bc594 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1,5 +1,6 @@

Datei anzeigen

@ -2344,7 +2344,7 @@ index 24f72050229031898fd9da585ad2ceec835f83f9..2b235508ffd01de14714de1a31c2139e
ChunkHolder.FullChunkStatus playerchunk_state1 = ChunkHolder.getFullChunkStatus(this.ticketLevel);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa1a240c62 100644
index db4dac607cf24d3d2cd407255c60678ae4be1a1b..ed208c058f5e22111284ffa6985b223565c83f67 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -408,6 +408,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -2418,7 +2418,7 @@ index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa
+ }
+
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.level, chunkPos.x, chunkPos.z,
+ poiData, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY);
+ poiData, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY);
+
+ if (!chunk.isUnsaved()) {
+ return;
@ -2439,7 +2439,7 @@ index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa
+ asyncSaveData = ChunkSerializer.getAsyncSaveData(this.level, chunk);
+ }
+
+ this.level.asyncChunkTaskManager.scheduleChunkSave(chunkPos.x, chunkPos.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY,
+ this.level.asyncChunkTaskManager.scheduleChunkSave(chunkPos.x, chunkPos.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY,
+ asyncSaveData, chunk);
+
+ chunk.setUnsaved(false);
@ -2623,10 +2623,10 @@ index db4dac607cf24d3d2cd407255c60678ae4be1a1b..6d024db8bfbd5139d4c94be3d3a48cfa
return this.poiManager;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1cac53072 100644
index a778eff06a24a665874a315704f00dc5996420c9..13313635e994f848edbe3e3fe607a21f8baa1790 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -322,10 +322,128 @@ public class ServerChunkCache extends ChunkSource {
@@ -320,10 +320,128 @@ public class ServerChunkCache extends ChunkSource {
return ret;
}
// Paper end
@ -2755,7 +2755,7 @@ index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1
if (Thread.currentThread() != this.mainThread) {
return (ChunkAccess) CompletableFuture.supplyAsync(() -> {
return this.getChunk(x, z, leastStatus, create);
@@ -348,13 +466,18 @@ public class ServerChunkCache extends ChunkSource {
@@ -346,13 +464,18 @@ public class ServerChunkCache extends ChunkSource {
}
gameprofilerfiller.incrementCounter("getChunkCacheMiss");
@ -2775,7 +2775,7 @@ index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1
this.level.timings.syncChunkLoad.stopTiming(); // Paper
} // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
@@ -441,6 +564,11 @@ public class ServerChunkCache extends ChunkSource {
@@ -439,6 +562,11 @@ public class ServerChunkCache extends ChunkSource {
}
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) {
@ -2787,7 +2787,7 @@ index 918555ba0af8a779ad55c7cf73f615eb804d00d9..c0bde909755190603e9b4946fe924ba1
ChunkPos chunkcoordintpair = new ChunkPos(i, j);
long k = chunkcoordintpair.toLong();
int l = 33 + ChunkStatus.getDistance(chunkstatus);
@@ -838,11 +966,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -836,11 +964,12 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() {
try {
@ -2925,7 +2925,7 @@ index 265d147de39e306fac27913b2dc3899e82c63796..912171f8b3280a6c45311104216e04d6
StringReader stringreader = new StringReader(packet.getCommand());
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 3ca8b13744b406c3e563747f0cb69647c94103df..6c3455823f996e0421975b7f4a00f4e333e9f514 100644
index 3ca8b13744b406c3e563747f0cb69647c94103df..7b1d2748328ffc1447bcacd1316f2c6fdbaf92b0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -37,9 +37,11 @@ public class PoiManager extends SectionStorage<PoiSection> {
@ -2954,7 +2954,7 @@ index 3ca8b13744b406c3e563747f0cb69647c94103df..6c3455823f996e0421975b7f4a00f4e3
+ data = this.getData(chunkcoordintpair);
+ }
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world,
+ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY);
+ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY);
+ }
+ // Paper end
this.distanceTracker.runAllUpdates();

Datei anzeigen

@ -32,7 +32,7 @@ index 7af33e8c470e499b7ec47467cce7df699c96873a..2720f4a51ffc8c9748932be55cebd507
public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getFutureIfPresentUnchecked(ChunkStatus leastStatus) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6d024db8bfbd5139d4c94be3d3a48cfa1a240c62..6f5e1f7c23b19257c89b7c5a992ad76623bf4006 100644
index ed208c058f5e22111284ffa6985b223565c83f67..10a4939b1169dfc3012a66d7af2f4a36616e5fb9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -84,6 +84,7 @@ import net.minecraft.world.level.chunk.ProtoChunk;
@ -108,10 +108,10 @@ index 6d024db8bfbd5139d4c94be3d3a48cfa1a240c62..6f5e1f7c23b19257c89b7c5a992ad766
// Spigot start
return this.isOutsideOfRange(chunkPos, false);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c0bde909755190603e9b4946fe924ba1cac53072..6dc28903dfefd6b454252f70763ce2b93773b75e 100644
index 13313635e994f848edbe3e3fe607a21f8baa1790..d5ec4a19869e04877869e3bb53c98a7e5943c931 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -323,6 +323,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -321,6 +321,7 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end
// Paper start - async chunk io

Datei anzeigen

@ -25,7 +25,7 @@ index fe79c0add4f7cb18d487c5bb9415c40c5b551ea2..8d9ddad1879e7616d980ca70de8aecac
poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 31f192773fe5159ed2109f0d367e6b7287ffd186..f2e4939c8144b9bc7441130302ab3e2358c42063 100644
index 4e7fbe5367c6cf91d54545e7829ec74e9accba8a..7dc740d392becc622e98a5a83be332adf6fcc4e8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -574,5 +574,10 @@ public class PaperWorldConfig {
@ -545,7 +545,7 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index c7d708cc5c20d46ed085f1f1db7666246614a57d..b2d88e0423d93fdb45dc8ca7d53c98069ade749e 100644
index a10f33a301e40484c7e253c6235c93c54918bf6c..5a8b919cd3a2aa3c12ae16cf970f7ce36cdeb4aa 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -145,6 +145,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -591,10 +591,10 @@ index c7d708cc5c20d46ed085f1f1db7666246614a57d..b2d88e0423d93fdb45dc8ca7d53c9806
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 6dc28903dfefd6b454252f70763ce2b93773b75e..01bcd74b846773f3922e0e77e46ecda3b19cd0be 100644
index d5ec4a19869e04877869e3bb53c98a7e5943c931..8763b20019ad0d3beae3825d126c4ccab1e1252d 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -753,7 +753,22 @@ public class ServerChunkCache extends ChunkSource {
@@ -751,7 +751,22 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().push("naturalSpawnCount");
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
@ -619,7 +619,7 @@ index 6dc28903dfefd6b454252f70763ce2b93773b75e..01bcd74b846773f3922e0e77e46ecda3
this.lastSpawnState = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 34c7c414cd3f92395a701f0f494ebab82c7b67b3..fd0734cc9a7b1d918f635048878227f8b18944e1 100644
index d234f08782b1a0c50714b8911d048699dc7741d5..d581945ff25f8a7a5e00599e9a939f2c0728b601 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -224,6 +224,11 @@ public class ServerPlayer extends Player {

Datei anzeigen

@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either,
then unwrap it...
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 01bcd74b846773f3922e0e77e46ecda3b19cd0be..7d4efbf0a705bea7e088a9991341e3abfd1b1727 100644
index 8763b20019ad0d3beae3825d126c4ccab1e1252d..072ef1efde7bc9dd9343310996339be9c5f70f6b 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -450,6 +450,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -448,6 +448,12 @@ public class ServerChunkCache extends ChunkSource {
return this.getChunk(x, z, leastStatus, create);
}, this.mainThreadProcessor).join();
} else {
@ -23,7 +23,7 @@ index 01bcd74b846773f3922e0e77e46ecda3b19cd0be..7d4efbf0a705bea7e088a9991341e3ab
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
gameprofilerfiller.incrementCounter("getChunk");
@@ -501,39 +507,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -499,39 +505,7 @@ public class ServerChunkCache extends ChunkSource {
if (Thread.currentThread() != this.mainThread) {
return null;
} else {

Datei anzeigen

@ -13,7 +13,7 @@ chunks, however it must be enabled by setting the startup flag
/paper syncloadinfo clear
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index c6254f39f98b821f75a21c0ecea457f73247385f..30452d2cef4d296513d582f65264ae58ad7609fc 100644
index 3091c100eaf5a86ba270ef0d96de1852a2a0ac9e..51e469146f0712a509071c8438ff6b69f961f945 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -1,11 +1,17 @@
@ -305,10 +305,10 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 7d4efbf0a705bea7e088a9991341e3abfd1b1727..5891d79abc5dc0b8ab85cc40819249f399fd1251 100644
index 072ef1efde7bc9dd9343310996339be9c5f70f6b..19544c9e6393cba361c9cf00d5767a06686426bf 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -482,6 +482,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -480,6 +480,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1);
// Paper end
@ -317,7 +317,7 @@ index 7d4efbf0a705bea7e088a9991341e3abfd1b1727..5891d79abc5dc0b8ab85cc40819249f3
chunkproviderserver_a.managedBlock(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fac80bdbf0fa68cd8e63130a6a9de3b60a44583e..00a064305dd8c671566dc32b8cd85f593ad139a3 100644
index afb62f6d7d0c4dc80e9ceea6c6fe420f551b40b6..54008a97cc88ac431c3517c19160903408ee9255 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -276,6 +276,12 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -926,10 +926,10 @@ index 1dd1b9afaee38fdc994ad0a069bd63b02eedf55c..bbb94e8a5e3585701849e025b534a69a
});
// Paper end
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 5891d79abc5dc0b8ab85cc40819249f399fd1251..6f33d4f4ca86bfcad907b451a56e71de0d4585d5 100644
index 19544c9e6393cba361c9cf00d5767a06686426bf..12bf78c993d2360c37b143b51c425fc5fdf33647 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -219,6 +219,18 @@ public class ServerChunkCache extends ChunkSource {
@@ -217,6 +217,18 @@ public class ServerChunkCache extends ChunkSource {
}, this.mainThreadProcessor);
}
// Paper end

Datei anzeigen

@ -70,7 +70,7 @@ index 4bc418f45c6f16a9a1c78b6688625268870a96ad..2d5b8e35d52b0dfd075af81a3a936d8a
List<ChunkHolder> allChunks = new ArrayList<>(visibleChunks.values());
List<ServerPlayer> players = world.players;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 2b291296821dc6d6a8437bd977eeba517cdb5003..962028a58ee54b99be20905c1fd16cfe15c82175 100644
index 22517debf77123b2d02f2127eba4b3700040c97d..5e828201871086994f7037a50a0d12aecb0c0ece 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -112,9 +112,36 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -233,10 +233,10 @@ index 2b291296821dc6d6a8437bd977eeba517cdb5003..962028a58ee54b99be20905c1fd16cfe
while (objectbidirectionaliterator.hasNext()) {
Entry<ChunkHolder> entry = (Entry) objectbidirectionaliterator.next();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 6f33d4f4ca86bfcad907b451a56e71de0d4585d5..228ff4b52a017e8af987f60d84b7906c9be098f0 100644
index 12bf78c993d2360c37b143b51c425fc5fdf33647..4efefcea2dcf895c4847269bc258cc338f21f230 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -760,7 +760,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -758,7 +758,7 @@ public class ServerChunkCache extends ChunkSource {
this.lastSpawnState = spawnercreature_d;
this.level.getProfiler().pop();

Datei anzeigen

@ -147,10 +147,10 @@ index ce5cb696dfa2ff9a07ab9e7547ba54920e58f53a..3c299bae9095ddc3732f1817c2d52f8d
// Spigot Start
CrashReport crashreport;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f31ac1be2 100644
index 4efefcea2dcf895c4847269bc258cc338f21f230..0765eefbba823570149f076a0d4d6aba1aa4e863 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -709,6 +709,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -707,6 +707,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().push("purge");
this.level.timings.doChunkMap.startTiming(); // Spigot
this.distanceManager.purgeStaleTickets();
@ -158,7 +158,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f
this.runDistanceManagerUpdates();
this.level.timings.doChunkMap.stopTiming(); // Spigot
this.level.getProfiler().popPush("chunks");
@@ -718,6 +719,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -716,6 +717,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.doChunkUnload.startTiming(); // Spigot
this.level.getProfiler().popPush("unload");
this.chunkMap.tick(booleansupplier);
@ -166,7 +166,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f
this.level.timings.doChunkUnload.stopTiming(); // Spigot
this.level.getProfiler().pop();
this.clearCache();
@@ -773,6 +775,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -771,6 +773,7 @@ public class ServerChunkCache extends ChunkSource {
};
// Paper end
this.level.timings.chunkTicks.startTiming(); // Paper
@ -174,7 +174,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f
list.forEach((playerchunk) -> {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
@@ -784,6 +787,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -782,6 +785,7 @@ public class ServerChunkCache extends ChunkSource {
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
@ -182,7 +182,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f
}
// this.level.timings.doTickTiles.startTiming(); // Spigot // Paper
@@ -801,7 +805,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -799,7 +803,7 @@ public class ServerChunkCache extends ChunkSource {
}
this.level.getProfiler().popPush("broadcast");
@ -191,7 +191,7 @@ index 228ff4b52a017e8af987f60d84b7906c9be098f0..c9e4802251dd1582e467112d45a3bd5f
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error
Objects.requireNonNull(playerchunk);
@@ -965,6 +969,41 @@ public class ServerChunkCache extends ChunkSource {
@@ -963,6 +967,41 @@ public class ServerChunkCache extends ChunkSource {
super.doRunTask(task);
}

Datei anzeigen

@ -25,7 +25,7 @@ This successfully fixed a reoccurring and highly reproduceable crash
for heightmaps.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6d810cdb538d078dbf7ccd2ef84a4be27eb1f3e7..aa9846c7d6b8499e01bf0ffeece6a940e0879328 100644
index b5459099b368ff6c8e62d254196350c2189e52a9..e7b29f632ee7a2fa77a191b25256134dae620739 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -195,6 +195,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -46,10 +46,10 @@ index 6d810cdb538d078dbf7ccd2ef84a4be27eb1f3e7..aa9846c7d6b8499e01bf0ffeece6a940
completablefuture1.thenAcceptAsync((either) -> {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c9e4802251dd1582e467112d45a3bd5f31ac1be2..a50ad7a3268ea87be36f9718b1030d5ff56628b2 100644
index 0765eefbba823570149f076a0d4d6aba1aa4e863..5009a782d80d5c358acb5a412d63a567fd7db3ab 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1016,6 +1016,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1014,6 +1014,7 @@ public class ServerChunkCache extends ChunkSource {
return super.pollTask() || execChunkTask; // Paper
}
} finally {

Datei anzeigen

@ -1,51 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 21 Apr 2020 03:51:53 -0400
Subject: [PATCH] Allow multiple callbacks to schedule for Callback Executor
ChunkMapDistance polls multiple entries for pendingChunkUpdates
Each of these have the potential to move a chunk in and out of
"Loaded" state, which will result in multiple callbacks being
needed within a single tick of ChunkMapDistance
Use an ArrayDeque to store this Queue
We make sure to also implement a pattern that is recursion safe too.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 2b4c35d9bd186fd7c3650a7ad791cd67fb64e635..e7c78106aa34d948a77cf72d5716e17d10beae72 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -178,17 +178,29 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {
- private final java.util.Queue<Runnable> queue = new java.util.ArrayDeque<>();
+ // Paper start - replace impl with recursive safe multi entry queue
+ // it's possible to schedule multiple tasks currently, so it's vital we change this impl
+ // If we recurse into the executor again, we will append to another queue, ensuring task order consistency
+ private java.util.Queue<Runnable> queue = new java.util.ArrayDeque<>(); // Paper - remove final
@Override
public void execute(Runnable runnable) {
+ if (this.queue == null) {
+ this.queue = new java.util.ArrayDeque<>();
+ }
this.queue.add(runnable);
}
@Override
public void run() {
+ if (this.queue == null) {
+ return;
+ }
+ java.util.Queue<Runnable> queue = this.queue;
+ this.queue = null;
+ // Paper end
Runnable task;
- while ((task = this.queue.poll()) != null) {
+ while ((task = queue.poll()) != null) { // Paper
task.run();
}
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add phantom creative and insomniac controls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2d038185846ae34bc301ab93d881022a05ee458b..1460cd36e8d38c1c4318adf818b87961bfe07aec 100644
index 3eed64b9562257b7a9fdfd51137a9ddf2cc0a84a..91b5267dcb24646c29ea1ff0b50f3b369f984244 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -513,6 +513,13 @@ public class PaperWorldConfig {

Datei anzeigen

@ -10,7 +10,7 @@ Adds CommandRegisteredEvent
- Allows manipulating the CommandNode to add more children/metadata for the client
diff --git a/build.gradle.kts b/build.gradle.kts
index 76a8db5ff623b0a3b83a0861f642da67ad2be3aa..2c0b95f3ed2c4f8ba84885ff922fc29a8fb9fe99 100644
index 5543c8e30c707d7cee5fd0579dd3d3dd7c26a13e..eea412347cef390555166a988058ae877afdfa4a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -17,6 +17,7 @@ repositories {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Villager Restocks API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index a5faa655cb0169ca5088bcc39e7b988135d150d6..0e247979b5ced02c1de422547fc8ebf7067006ee 100644
index 18fbf866fd7a6de2ed037b8d9c53e25d180be98b..83b7b136794ad855eb0faf839edfcf4a024b2c2a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -83,6 +83,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {

Datei anzeigen

@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache.
Set system properly at server startup if not set already to help protect from this.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index dfff422b6f957c65224b269fd57b1e25733a403e..87674042ea6ebf17d9f6f5f0839ae4bd3de07932 100644
index 1d63b1da588ef8930133d4cf7ca541fe4d753a4b..c687df04b3543df763a4d5225342357355fab7ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -28,6 +28,7 @@ public class Main {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts
index caea57d19dfd6f44536329d8a283c75c87a49d9d..31a6e07981f20fc0cedbca24cf65807e50ab8142 100644
index eea412347cef390555166a988058ae877afdfa4a..81d507895572e9c0ec3c87d3745f95067922093a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -48,6 +48,7 @@ dependencies {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker
Use the distance map to find candidate players for tracking.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74829cbc4e 100644
index 2b4c35d9bd186fd7c3650a7ad791cd67fb64e635..514d859ab0fbd25e2217c27dfbbdba1f688848c1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -63,6 +63,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
@ -17,7 +17,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
@@ -226,11 +227,33 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -214,11 +215,33 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceTickMap;
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceNoTickMap;
// Paper end - no-tick view distance
@ -51,7 +51,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
// Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -247,7 +270,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -235,7 +258,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
void removePlayerFromDistanceMaps(ServerPlayer player) {
@ -64,7 +64,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
// Paper start - no-tick view distance
this.playerViewDistanceBroadcastMap.remove(player);
this.playerViewDistanceTickMap.remove(player);
@@ -259,6 +286,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -247,6 +274,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated
@ -79,7 +79,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
// Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -312,6 +347,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -300,6 +335,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance);
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
@ -125,7 +125,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
// Paper start - no-tick view distance
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
@@ -1465,17 +1539,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1453,17 +1527,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void move(ServerPlayer player) {
@ -144,7 +144,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
int i = SectionPos.blockToSectionCoord(player.getBlockX());
int j = SectionPos.blockToSectionCoord(player.getBlockZ());
@@ -1630,7 +1694,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1618,7 +1682,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
@ -153,7 +153,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -1674,7 +1738,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1662,7 +1726,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = null; // Paper - We're no longer tracked
}
@ -191,7 +191,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
@@ -1783,23 +1877,31 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
@@ -1771,23 +1865,31 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
List<Entity> list = Lists.newArrayList();
List<Entity> list1 = Lists.newArrayList();
@ -235,7 +235,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
Iterator iterator;
Entity entity1;
@@ -1882,6 +1984,42 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
@@ -1870,6 +1972,42 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
this.lastSectionPos = SectionPos.of(entity);
}
@ -278,7 +278,7 @@ index e7c78106aa34d948a77cf72d5716e17d10beae72..073aa637fcaf14a5ae8b203604d75b74
public boolean equals(Object object) {
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
}
@@ -1967,7 +2105,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
@@ -1955,7 +2093,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
int j = entity.getType().clientTrackingRange() * 16;
j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper

Datei anzeigen

@ -37,10 +37,10 @@ index bbb94e8a5e3585701849e025b534a69a6e67949f..7223c6daf6f0eb959a5cab701096324a
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b838c5ca09d 100644
index 04ece67574bb95f575edc6f5337a3492e7260102..1e944b2fdfd382bfcc7f94f9a8daf1782931110b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -241,6 +241,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -229,6 +229,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return MinecraftServer.getServer().getScaledTrackingDistance(vanilla);
}
// Paper end - use distance map to optimise tracker
@ -58,7 +58,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
void addPlayerToDistanceMaps(ServerPlayer player) {
int chunkX = MCUtil.getChunkCoordinate(player.getX());
@@ -254,6 +265,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -242,6 +253,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
}
// Paper end - use distance map to optimise entity tracker
@ -71,7 +71,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
// Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -275,6 +292,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -263,6 +280,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerEntityTrackerTrackMaps[i].remove(player);
}
// Paper end - use distance map to optimise tracker
@ -82,7 +82,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
// Paper start - no-tick view distance
this.playerViewDistanceBroadcastMap.remove(player);
this.playerViewDistanceTickMap.remove(player);
@@ -294,6 +315,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -282,6 +303,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
}
// Paper end - use distance map to optimise entity tracker
@ -92,7 +92,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
// Paper start - no-tick view distance
int effectiveTickViewDistance = this.getEffectiveViewDistance();
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
@@ -342,7 +366,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -330,7 +354,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false);
this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false);// Paper
this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false));
@ -101,7 +101,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance);
@@ -386,6 +410,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -374,6 +398,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
}
// Paper end - use distance map to optimise entity tracker
@ -140,7 +140,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
// Paper start - no-tick view distance
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
@@ -655,6 +711,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -643,6 +699,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
if (holder != null) {
holder.setTicketLevel(level);
@ -148,7 +148,7 @@ index 073aa637fcaf14a5ae8b203604d75b74829cbc4e..1b2e7af2824cecc5010f2beefa4f5b83
}
if (holder != null) {
@@ -1475,29 +1532,50 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1463,29 +1520,50 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.isOutsideOfRange(chunkPos, false);
}
@ -291,10 +291,10 @@ index b49d380ef088aed3204ec71abc437c348ef004fa..577b391dcba1db712c1e2c83296e1c87
public String getDebugStatus() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d28bf44eca 100644
index 5009a782d80d5c358acb5a412d63a567fd7db3ab..d02eaf281b752f5b1442d06471b80ce28361f31a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -735,6 +735,37 @@ public class ServerChunkCache extends ChunkSource {
@@ -733,6 +733,37 @@ public class ServerChunkCache extends ChunkSource {
boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
if (!flag) {
@ -332,7 +332,7 @@ index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d2
this.level.getProfiler().push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit
@@ -765,15 +796,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -763,15 +794,7 @@ public class ServerChunkCache extends ChunkSource {
List<ChunkHolder> list = Lists.newArrayList(this.chunkMap.visibleChunkMap.values()); // Paper
Collections.shuffle(list);
@ -349,7 +349,7 @@ index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d2
this.level.timings.chunkTicks.startTiming(); // Paper
final int[] chunksTicked = {0}; // Paper
list.forEach((playerchunk) -> {
@@ -783,9 +806,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -781,9 +804,9 @@ public class ServerChunkCache extends ChunkSource {
LevelChunk chunk = (LevelChunk) optional.get();
ChunkPos chunkcoordintpair = chunk.getPos();
@ -362,7 +362,7 @@ index a50ad7a3268ea87be36f9718b1030d5ff56628b2..7d8db5bc79fbff0832b87f4004f919d2
if (chunksTicked[0]++ % 10 == 0) this.level.getServer().midTickLoadChunks(); // Paper
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7424def8aa625d1a11c3fdc4f6f4128e579c108b..89fcf88f35a071db1704c026a99625c84daf2f28 100644
index 30f8f4a8314c849a66143a545c1af3440965c6aa..cf09bd17b9d2be04f79edef6debdd815b5f7f86c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -250,6 +250,7 @@ public class ServerPlayer extends Player {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1460cd36e8d38c1c4318adf818b87961bfe07aec..b6742a4ef1a798e60289586f5cccf6886afa360a 100644
index 91b5267dcb24646c29ea1ff0b50f3b369f984244..beaf99e1e6fb9f850f4119017a4dfc50fa374ace 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -356,6 +356,12 @@ public class PaperWorldConfig {
@ -22,7 +22,7 @@ index 1460cd36e8d38c1c4318adf818b87961bfe07aec..b6742a4ef1a798e60289586f5cccf688
private void squidMaxSpawnHeight() {
squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 771632c9bc5c352e894dc6cb99fd73bc07c3a9e7..07a51f0ee7aa94c707debffbb7ae3532c94df966 100644
index d49627866c9151ffe4be3eef3d944f0a7b3e8ffe..6c17e7696d39f49aa6dde4f8cc352eb1ac78373b 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -625,16 +625,30 @@ public class CraftEventFactory {

Datei anzeigen

@ -9,7 +9,7 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 07a51f0ee7aa94c707debffbb7ae3532c94df966..be7a9b0d8f65c884c0ff183041c20b7a99c30e2a 100644
index 6c17e7696d39f49aa6dde4f8cc352eb1ac78373b..d5588bca58d999b7242041127fac3809aa9e2ddd 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -635,7 +635,7 @@ public class CraftEventFactory {

Datei anzeigen

@ -56,7 +56,7 @@ index a861b4b55862b1c5583101fe7f28a3a43c547468..1575fb0bbad6e11f25fb9ce51fd1f15a
this.level.getProfiler().push("explosion_blocks");
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 9cf64082555d848e4149f9a982dd770db9defa3c..36fd88239da908c2685a853ec28c0f3db691fad0 100644
index f7fc4a9d3c0132df6024b33e4f893d3b7ebc6ec3..970a67d82219fa642080c78a814c12ca8d9a5ee9 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -425,6 +425,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 1b2e7af2824cecc5010f2beefa4f5b838c5ca09d..a1529fef41543486d29271b1de62a6246d07d384 100644
index fd79caa3fd62eb6ef09b1eb63cb569560cd7b9a9..6fdbd1396265d0671bf888e88f516b1c9453a0d4 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -2147,9 +2147,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
@@ -2135,9 +2135,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) {

Datei anzeigen

@ -8,7 +8,7 @@ so inline where possible, and avoid the abstraction of the
Either class.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bfc855adc411269b63b44157266d6ef7945aa7e0..6fc4b479dcb40b7f6f018731956bc003e95ea05b 100644
index 021915680f6aa054585527dc0caf18b65795a1b7..e3b9f7b92e4f3e8b64e2b13bdf2b3fcee12c7cda 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2034,15 +2034,18 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -17,7 +17,7 @@ This allows servers with smaller worlds who do less long distance exploring to s
wasting cpu cycles on saving/unloading/reloading chunks repeatedly.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b6742a4ef1a798e60289586f5cccf6886afa360a..9e5810eb0085ad956f0bd1cd69fa88909d9d638a 100644
index beaf99e1e6fb9f850f4119017a4dfc50fa374ace..e1f6190a8ea8606404060b3d2ebc5ceea6665a6e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -531,6 +531,15 @@ public class PaperWorldConfig {

Datei anzeigen

@ -139,7 +139,7 @@ index 7223c6daf6f0eb959a5cab701096324a34b9c88a..8245e07f6ecfd9dd997c8525b52c6ead
for (int i = 0; i < this.futures.length(); ++i) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bfc34ce890 100644
index 58a05168e88272fd4d54c9c7855c41063c53cf8c..12f9f512dc8b9e094dab2caec7b6ddaf2a378ee9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -97,6 +97,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
@ -150,7 +150,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -750,6 +751,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -738,6 +739,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@ -215,7 +215,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf
protected void saveAllChunks(boolean flush) {
Long2ObjectLinkedOpenHashMap<ChunkHolder> visibleChunks = this.getVisibleChunks(); // Paper remove clone of visible Chunks unless saving off main thread (watchdog kill)
if (flush) {
@@ -888,6 +947,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -876,6 +935,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
asyncSaveData, chunk);
chunk.setUnsaved(false);
@ -223,7 +223,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf
}
// Paper end
@@ -919,6 +979,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -907,6 +967,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level.unload(chunk);
}
@ -231,7 +231,7 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf
this.lightEngine.updateChunkStatus(ichunkaccess.getPos());
this.lightEngine.tryScheduleUpdate();
@@ -1272,6 +1333,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1260,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!chunk.isUnsaved()) {
return false;
} else {
@ -240,10 +240,10 @@ index a1529fef41543486d29271b1de62a6246d07d384..f518fc7a39a807bff2e141fd238ab1bf
ChunkPos chunkcoordintpair = chunk.getPos();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 7d8db5bc79fbff0832b87f4004f919d28bf44eca..ffe700489cb2d507421abfb48939808de0adc8be 100644
index d02eaf281b752f5b1442d06471b80ce28361f31a..6d947343b6ff2f86a23ea669e371d5ecd9e903c0 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -677,6 +677,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -675,6 +675,15 @@ public class ServerChunkCache extends ChunkSource {
} // Paper - Timings
}

Datei anzeigen

@ -81,7 +81,7 @@ index 4eac07022a7d896ee8921afa6d35cba7f0c89941..dd50a29d47a62df8cdfd69358218d155
}
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index f18b20f94b4d2d7f07a70414834b3b284f65da78..7b987071405229678f10a75e49786f5055026521 100644
index 54020a3f2b18c4f42008f5d5f4541ef1a1efbcd7..be4360cc580e3b92b76cdcf54265d5ac25d3d59b 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -285,7 +285,7 @@ public class PistonMovingBlockEntity extends BlockEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index b6a36706846a3106f7e747ce761aa2064a934d05..8a0722455bf303f50b2955b53f9d7284a20f672e 100644
index 44df201abb930b455d9de8f36260ec5e4f20f5c2..0c7ed53964675c81185644549898369cdda80377 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3359,7 +3359,7 @@ public abstract class LivingEntity extends Entity {

Datei anzeigen

@ -80,7 +80,7 @@ index 2d5b8e35d52b0dfd075af81a3a936d8a21053b31..9ddedd310eb0323a5a09f51a61bfb7b3
chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey));
chunkData.addProperty("status", status == null ? "unloaded" : status.toString());
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4c099af87 100644
index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..a0334dde56829fd895323f4cab2ab55d5d5ecf30 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -60,7 +60,7 @@ public class ChunkHolder {
@ -235,21 +235,61 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4
// Paper start - optimise isOutsideOfRange
// cached here to avoid a map lookup
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInMobSpawnRange;
@@ -485,7 +614,7 @@ public class ChunkHolder {
// CraftBukkit start
@@ -470,12 +599,25 @@ public class ChunkHolder {
});
}
+ // Paper start
+ private boolean loadCallbackScheduled = false;
+ private boolean unloadCallbackScheduled = false;
+ static void ensureTickThread(final String reason) {
+ // TODO REMOVE
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ MinecraftServer.LOGGER.fatal("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
+ throw new IllegalStateException(reason);
+ }
+ }
+ // Paper end
+
private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) {
this.pendingFullStateConfirmation.cancel(false);
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
}
protected void updateFutures(ChunkMap chunkStorage, Executor executor) {
+ ensureTickThread("Async ticket level update"); // Paper
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
@@ -486,9 +628,22 @@ public class ChunkHolder {
// ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
- this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
+ this.getStatusFutureUncheckedMain(ChunkStatus.FULL).thenAccept((either) -> { // Paper - ensure main
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
+ ensureTickThread("Async full status chunk future completion"); // Paper
LevelChunk chunk = (LevelChunk)either.left().orElse(null);
if (chunk != null) {
- if (chunk != null) {
+ if (chunk != null && chunk.wasLoadCallbackInvoked() && ChunkHolder.this.ticketLevel > 33) { // Paper - only invoke unload if load was called
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
+ if (ChunkHolder.this.unloadCallbackScheduled) {
+ return;
+ }
+ ChunkHolder.this.unloadCallbackScheduled = true;
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
chunkStorage.callbackExecutor.execute(() -> {
@@ -544,13 +673,14 @@ public class ChunkHolder {
this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this);
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
+ ChunkHolder.this.unloadCallbackScheduled = false;
+ if (ChunkHolder.this.ticketLevel <= 33) {
+ return;
+ }
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
// Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
// lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
// These actions may however happen deferred, so we manually set the needsSaving flag already here.
@@ -545,12 +700,14 @@ public class ChunkHolder {
this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER);
// Paper start - cache ticking ready status
- this.fullChunkFuture.thenAccept(either -> {
+ ensureMain(this.fullChunkFuture).thenAccept(either -> { // Paper - ensure main
this.fullChunkFuture.thenAccept(either -> {
+ ensureTickThread("Async full chunk future completion"); // Paper
final Optional<LevelChunk> left = either.left();
if (left.isPresent() && ChunkHolder.this.fullChunkCreateCount == expectCreateCount) {
// note: Here is a very good place to add callbacks to logic waiting on this.
@ -260,25 +300,23 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4
}
});
this.updateChunkToSave(this.fullChunkFuture, "full");
@@ -574,7 +704,7 @@ public class ChunkHolder {
this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this);
@@ -575,6 +732,7 @@ public class ChunkHolder {
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING);
// Paper start - cache ticking ready status
- this.tickingChunkFuture.thenAccept(either -> {
+ ensureMain(this.tickingChunkFuture).thenAccept(either -> { // Paper - ensure main
this.tickingChunkFuture.thenAccept(either -> {
+ ensureTickThread("Async full chunk future completion"); // Paper
either.ifLeft(chunk -> {
// note: Here is a very good place to add callbacks to logic waiting on this.
ChunkHolder.this.isTickingReady = true;
@@ -606,7 +736,7 @@ public class ChunkHolder {
this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos);
@@ -607,6 +765,7 @@ public class ChunkHolder {
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING);
// Paper start - cache ticking ready status
- this.entityTickingChunkFuture.thenAccept(either -> {
+ ensureMain(this.entityTickingChunkFuture).thenAccept(either -> { // Paper ensureMain
this.entityTickingChunkFuture.thenAccept(either -> {
+ ensureTickThread("Async full chunk future completion"); // Paper
either.ifLeft(chunk -> {
ChunkHolder.this.isEntityTickingReady = true;
});
@@ -624,12 +754,30 @@ public class ChunkHolder {
@@ -624,16 +783,42 @@ public class ChunkHolder {
this.demoteFullChunk(chunkStorage, playerchunk_state1);
}
@ -306,13 +344,26 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..3364ff7e8a829771a84c6f2e61d37bb4
// CraftBukkit start
// ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
- this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
+ this.getStatusFutureUncheckedMain(ChunkStatus.FULL).thenAccept((either) -> { // Paper - ensure main
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
+ ensureTickThread("Async full status chunk future completion"); // Paper
LevelChunk chunk = (LevelChunk)either.left().orElse(null);
if (chunk != null) {
- if (chunk != null) {
+ if (chunk != null && ChunkHolder.this.oldTicketLevel <= 33 && !chunk.wasLoadCallbackInvoked()) { // Paper - ensure ticket level is set to loaded before calling, as now this can complete with ticket level > 33
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
+ if (ChunkHolder.this.loadCallbackScheduled) {
+ return;
+ }
+ ChunkHolder.this.loadCallbackScheduled = true;
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
chunkStorage.callbackExecutor.execute(() -> {
- chunk.loadCallback();
+ ChunkHolder.this.loadCallbackScheduled = false; // Paper - only schedule once, now the future is no longer completed as RIGHT if unloaded...
+ if (ChunkHolder.this.oldTicketLevel <= 33) chunk.loadCallback(); // Paper "
});
}
}).exceptionally((throwable) -> {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa5f523b68 100644
index 12f9f512dc8b9e094dab2caec7b6ddaf2a378ee9..5b1b91ab4d351f47a05a73cf65539b0bc92df13b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -323,23 +374,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
public final ChunkGenerator generator;
public final Supplier<DimensionDataStorage> overworldDataStorage;
private final PoiManager poiManager;
@@ -187,6 +188,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Override
public void execute(Runnable runnable) {
+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute");
if (this.queue == null) {
this.queue = new java.util.ArrayDeque<>();
}
@@ -195,6 +197,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Override
public void run() {
+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor run");
if (this.queue == null) {
return;
}
@@ -353,6 +356,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -341,6 +342,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.level = world;
this.generator = chunkGenerator;
this.mainThreadExecutor = mainThreadExecutor;
@ -355,7 +390,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
ProcessorMailbox<Runnable> threadedmailbox = ProcessorMailbox.create(executor, "worldgen");
Objects.requireNonNull(mainThreadExecutor);
@@ -448,6 +460,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -436,6 +446,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
(ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> newState) -> {
@ -363,7 +398,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
if (newState.size() != 1) {
return;
}
@@ -466,7 +479,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -454,7 +465,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
ChunkPos chunkPos = new ChunkPos(rangeX, rangeZ);
ChunkMap.this.level.getChunkSource().removeTicketAtLevel(TicketType.PLAYER, chunkPos, 31, chunkPos); // entity ticking level, TODO check on update
@ -379,7 +414,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
this.playerViewDistanceNoTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
this.playerViewDistanceBroadcastMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
(ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
@@ -484,6 +504,116 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -472,6 +490,116 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - no-tick view distance
}
@ -496,7 +531,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
// Paper start
public void updatePlayerMobTypeMap(Entity entity) {
if (!this.level.paperConfig.perPlayerMobSpawns) {
@@ -642,6 +772,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -630,6 +758,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = Lists.newArrayList();
int j = centerChunk.x;
int k = centerChunk.z;
@ -504,7 +539,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
for (int l = -margin; l <= margin; ++l) {
for (int i1 = -margin; i1 <= margin; ++i1) {
@@ -660,6 +791,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -648,6 +777,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1);
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this);
@ -519,7 +554,36 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
list.add(completablefuture);
}
@@ -1103,14 +1242,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1016,11 +1153,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (requiredStatus == ChunkStatus.EMPTY) {
return this.scheduleChunkLoad(chunkcoordintpair);
} else {
+ // Paper start - revert 1.17 chunk system changes
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = holder.getOrScheduleFuture(requiredStatus.getParent(), this);
+ return future.thenComposeAsync((either) -> {
+ Optional<ChunkAccess> optional = either.left();
+ if (!optional.isPresent()) {
+ return CompletableFuture.completedFuture(either);
+ }
+ // Paper end - revert 1.17 chunk system changes
if (requiredStatus == ChunkStatus.LIGHT) {
this.distanceManager.addTicket(TicketType.LIGHT, chunkcoordintpair, 33 + ChunkStatus.getDistance(ChunkStatus.LIGHT), chunkcoordintpair);
}
- Optional<ChunkAccess> optional = ((Either) holder.getOrScheduleFuture(requiredStatus.getParent(), this).getNow(ChunkHolder.UNLOADED_CHUNK)).left();
+ // Paper - revert 1.17 chunk system changes
if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) {
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (ichunkaccess) -> {
@@ -1032,6 +1177,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
return this.scheduleChunkGeneration(holder, requiredStatus);
}
+ }, this.mainThreadExecutor).thenComposeAsync(CompletableFuture::completedFuture, this.mainThreadExecutor); // Paper - revert 1.17 chunk system changes
}
}
@@ -1091,14 +1237,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
CompletableFuture<CompoundTag> chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z);
@ -549,7 +613,19 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..dd0f9ab476735e0a61533bdfed5868fa
return ret;
// Paper end
}
@@ -1242,7 +1391,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1147,7 +1303,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.releaseLightTicket(chunkcoordintpair);
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
});
- }, executor);
+ }, executor).thenComposeAsync((either) -> { // Paper start - force competion on the main thread
+ return CompletableFuture.completedFuture(either);
+ }, this.mainThreadExecutor); // use the main executor, we want to ensure only one chunk callback can be completed per runnable execute
+ // Paper end - force competion on the main thread
}
protected void releaseLightTicket(ChunkPos pos) {
@@ -1230,7 +1389,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
long i = playerchunk.getPos().toLong();
Objects.requireNonNull(playerchunk);
@ -941,10 +1017,10 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e588f22bf2 100644
index 6d947343b6ff2f86a23ea669e371d5ecd9e903c0..d6f0c82b503a0fa73f6589fc4c331d27fbe27638 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -451,6 +451,26 @@ public class ServerChunkCache extends ChunkSource {
@@ -449,6 +449,26 @@ public class ServerChunkCache extends ChunkSource {
public <T> void removeTicketAtLevel(TicketType<T> ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) {
this.distanceManager.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier);
}
@ -971,7 +1047,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5
// Paper end - async chunk io
@Nullable
@@ -491,6 +511,8 @@ public class ServerChunkCache extends ChunkSource {
@@ -489,6 +509,8 @@ public class ServerChunkCache extends ChunkSource {
Objects.requireNonNull(completablefuture);
if (!completablefuture.isDone()) { // Paper
// Paper start - async chunk io/loading
@ -980,7 +1056,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5
this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1);
// Paper end
@@ -499,6 +521,8 @@ public class ServerChunkCache extends ChunkSource {
@@ -497,6 +519,8 @@ public class ServerChunkCache extends ChunkSource {
chunkproviderserver_a.managedBlock(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
this.level.timings.syncChunkLoad.stopTiming(); // Paper
@ -989,7 +1065,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5
} // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
@@ -572,10 +596,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -570,10 +594,12 @@ public class ServerChunkCache extends ChunkSource {
if (flag && !currentlyUnloading) {
// CraftBukkit end
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
@ -1002,7 +1078,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5
this.runDistanceManagerUpdates();
playerchunk = this.getVisibleChunkIfPresent(k);
gameprofilerfiller.pop();
@@ -584,8 +610,13 @@ public class ServerChunkCache extends ChunkSource {
@@ -582,8 +608,13 @@ public class ServerChunkCache extends ChunkSource {
}
}
}
@ -1018,7 +1094,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..c63cbb6da6f734c3a93c63af2b28a6e5
}
private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) {
@@ -637,6 +668,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -635,6 +666,7 @@ public class ServerChunkCache extends ChunkSource {
}
public boolean runDistanceManagerUpdates() {
@ -1113,10 +1189,18 @@ index ae3465cd5be426f3bddc3552b6aad6cad8c8ee25..91df850e66aa14b13a679357e02e2f74
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e0c9857a922d8a3f421d7df0f056b82c4775390e..4918f89401cdf6a85d8b71f3e3a6608239a388bd 100644
index e0c9857a922d8a3f421d7df0f056b82c4775390e..fefd3e4b7d9b2ec77dd2bc26298c3732d651df32 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -286,8 +286,8 @@ public abstract class PlayerList {
@@ -175,6 +175,7 @@ public abstract class PlayerList {
}
public void placeNewPlayer(Connection connection, ServerPlayer player) {
+ player.isRealPlayer = true; // Paper - Chunk priority
ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper
if (prev != null) {
disconnectPendingPlayer(prev);
@@ -286,8 +287,8 @@ public abstract class PlayerList {
net.minecraft.server.level.ChunkMap playerChunkMap = worldserver1.getChunkSource().chunkMap;
net.minecraft.server.level.DistanceManager distanceManager = playerChunkMap.distanceManager;
distanceManager.addTicketAtLevel(net.minecraft.server.level.TicketType.LOGIN, pos, 31, pos.toLong());
@ -1127,14 +1211,6 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..4918f89401cdf6a85d8b71f3e3a66082
net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong());
if (updatingChunk != null) {
return updatingChunk.getEntityTickingChunkFuture();
@@ -705,6 +705,7 @@ public abstract class PlayerList {
SocketAddress socketaddress = loginlistener.connection.getRemoteAddress();
ServerPlayer entity = new ServerPlayer(this.server, this.server.getLevel(Level.OVERWORLD), gameprofile);
+ entity.isRealPlayer = true; // Paper - Chunk priority
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.getRawAddress()).getAddress());
@@ -893,6 +894,7 @@ public abstract class PlayerList {
// CraftBukkit end
@ -1144,7 +1220,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..4918f89401cdf6a85d8b71f3e3a66082
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3e951522169fcb071cc578e8bd9a78baa10f4e4d..cc4b48f6c62aaccddaf81576865b56f8ece4d040 100644
index 73fc8ebd2ec207db2efc545f6bb304d53880b78f..e1b6a390105232500d7146cc456bf30912934904 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -223,7 +223,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@ -1156,11 +1232,40 @@ index 3e951522169fcb071cc578e8bd9a78baa10f4e4d..cc4b48f6c62aaccddaf81576865b56f8
private float xRot;
public float yRotO;
public float xRotO;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e..d580f0375cce5e995c024f1b0cd4843b5718121c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -192,7 +192,7 @@ public class LevelChunk implements ChunkAccess {
return NEIGHBOUR_CACHE_RADIUS;
}
- boolean loadedTicketLevel;
+ boolean loadedTicketLevel; public final boolean wasLoadCallbackInvoked() { return this.loadedTicketLevel; } // Paper - public accessor
private long neighbourChunksLoadedBitset;
private final LevelChunk[] loadedNeighbourChunks = new LevelChunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)];
@@ -794,6 +794,7 @@ public class LevelChunk implements ChunkAccess {
// CraftBukkit start
public void loadCallback() {
+ if (this.loadedTicketLevel) { LOGGER.error("Double calling chunk load!", new Throwable()); } // Paper
// Paper start - neighbour cache
int chunkX = this.chunkPos.x;
int chunkZ = this.chunkPos.z;
@@ -848,6 +849,7 @@ public class LevelChunk implements ChunkAccess {
}
public void unloadCallback() {
+ if (!this.loadedTicketLevel) { LOGGER.error("Double calling chunk unload!", new Throwable()); } // Paper
org.bukkit.Server server = this.level.getCraftServer();
org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved());
server.getPluginManager().callEvent(unloadEvent);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 32c24f9e37262f2a854556787f61cd7b7336da11..08b4589c3b565db70e89aea0715e53c7c0529460 100644
index 496bb91da1138fb6a4e004da1eab43e588c82592..ff1cb5f679f57988eb30b77fbcc5de2699a90dca 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2604,6 +2604,12 @@ public class CraftWorld implements World {
@@ -1912,6 +1912,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return future;
}

Datei anzeigen

@ -36,10 +36,10 @@ scenario / path:
Previously would have hopped to SERVER around 12+ times there extra.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..52ae149d22e8b0f3c2321f383351a4244c517b5e 100644
index a0334dde56829fd895323f4cab2ab55d5d5ecf30..81696d822c00e506ba2128590e95341994ff93f6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -113,6 +113,20 @@ public class ChunkHolder {
@@ -242,6 +242,13 @@ public class ChunkHolder {
// Paper end - optimise isOutsideOfRange
long lastAutoSaveTime; // Paper - incremental autosave
long inactiveTimeStart; // Paper - incremental autosave
@ -49,22 +49,15 @@ index 8245e07f6ecfd9dd997c8525b52c6eadd392e6f1..52ae149d22e8b0f3c2321f383351a424
+ ChunkAccess chunk = getAvailableChunkNow();
+ return chunk != null && (status == null || chunk.getStatus().isOrAfter(getNextStatus(status)));
+ }
+ // Yanked from chunk priotisation patch - remove?
+ public static ChunkStatus getNextStatus(ChunkStatus status) {
+ if (status == ChunkStatus.FULL) {
+ return status;
+ }
+ return CHUNK_STATUSES.get(status.getIndex() + 1);
+ }
+ // Paper end
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f518fc7a39a807bff2e141fd238ab1bfc34ce890..cd76029f2dc3ecfa52bae127ae261a028fa8839a 100644
index 5b1b91ab4d351f47a05a73cf65539b0bc92df13b..d470fdcbc79c4a491e9a078930b54e8d8949d68c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -702,7 +702,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -827,7 +827,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return either.mapLeft((list) -> {
return (LevelChunk) list.get(list.size() / 2);
});
@ -73,7 +66,7 @@ index f518fc7a39a807bff2e141fd238ab1bfc34ce890..cd76029f2dc3ecfa52bae127ae261a02
}
@Nullable
@@ -1133,6 +1133,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1277,6 +1277,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return "chunkGenerate " + requiredStatus.getName();
});
Executor executor = (runnable) -> {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ae3465cd5be426f3bddc3552b6aad6cad8c8ee25..e307f8695643360289b998a8d2ad244d966f1180 100644
index 91df850e66aa14b13a679357e02e2f74dc653628..03ad0c0365f85a1536fb35bfdf08d6d44240df80 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1672,17 +1672,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1673,17 +1673,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Direction enumdirection = movingobjectpositionblock.getDirection();

Datei anzeigen

@ -25,19 +25,19 @@ Massive update to light to improve performance and chunk loading/generation.
8) Fix NPE risk that crashes server in getting nibble data
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 52ae149d22e8b0f3c2321f383351a4244c517b5e..03f0a745283012f08919f8e786d402ca01c15f00 100644
index 81696d822c00e506ba2128590e95341994ff93f6..c6c4894427e5e98dccc1506d9d20157e1acbbd21 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -640,6 +640,7 @@ public class ChunkHolder {
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
@@ -810,6 +810,7 @@ public class ChunkHolder {
}
// Paper end
this.oldTicketLevel = this.ticketLevel;
+ //chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper // Restore this in chunk priority later?
// CraftBukkit start
// ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c26097761e 100644
index d470fdcbc79c4a491e9a078930b54e8d8949d68c..1c662deee2a3184c7612cf7de5f798753fbd7381 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -97,6 +97,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
@ -48,7 +48,7 @@ index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c2
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.logging.log4j.LogManager;
@@ -335,6 +336,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -324,6 +325,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// Paper end
@ -56,7 +56,7 @@ index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c2
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync);
//this.visibleChunks = this.updatingChunks.clone(); // Paper - no more cloning
@@ -360,7 +362,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -358,7 +360,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.progressListener = worldGenerationProgressListener;
this.chunkStatusListener = chunkStatusChangeListener;
@ -73,7 +73,7 @@ index cd76029f2dc3ecfa52bae127ae261a028fa8839a..c42f564ecac75f7947c580e7514795c2
this.queueSorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(threadedmailbox, mailbox, threadedmailbox1), executor, Integer.MAX_VALUE);
this.worldgenMailbox = this.queueSorter.getProcessor(threadedmailbox, false);
@@ -742,6 +752,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -867,6 +877,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Override
public void close() throws IOException {
try {
@ -126,10 +126,10 @@ index d3d6651eb51c852ed1d1eeb5689569d5308b246d..c2d36600a0081c78425868154bdcf7f4
m = Long.MAX_VALUE;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ffe700489cb2d507421abfb48939808de0adc8be..5a2b3c150ceaaae651c3ec6aeff3bb894dd5f94d 100644
index d6f0c82b503a0fa73f6589fc4c331d27fbe27638..db6a0246e83045015fc41f27e0aec0e07d1fb568 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1044,7 +1044,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1074,7 +1074,7 @@ public class ServerChunkCache extends ChunkSource {
if (ServerChunkCache.this.runDistanceManagerUpdates()) {
return true;
} else {
@ -139,7 +139,7 @@ index ffe700489cb2d507421abfb48939808de0adc8be..5a2b3c150ceaaae651c3ec6aeff3bb89
}
} finally {
diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303dc73d98ad 100644
index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..833b6b2193cf08e123aabb344f2283730aed1bcd 100644
--- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
+++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
@@ -1,6 +1,7 @@
@ -158,7 +158,7 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d
import net.minecraft.world.level.chunk.DataLayer;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.LightChunkGetter;
@@ -26,15 +28,149 @@ import org.apache.logging.log4j.Logger;
@@ -26,15 +28,140 @@ import org.apache.logging.log4j.Logger;
public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable {
private static final Logger LOGGER = LogManager.getLogger();
private final ProcessorMailbox<Runnable> taskMailbox;
@ -167,15 +167,6 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d
+ // Paper start
+ private static final int MAX_PRIORITIES = ChunkMap.MAX_CHUNK_DISTANCE + 2;
+
+ private boolean isChunkLightStatus(long pair) {
+ ChunkHolder playerChunk = playerChunkMap.getVisibleChunkIfPresent(pair);
+ if (playerChunk == null) {
+ return false;
+ }
+ ChunkStatus status = ChunkHolder.getStatus(playerChunk.getTicketLevel());
+ return status != null && status.isOrAfter(ChunkStatus.LIGHT);
+ }
+
+ static class ChunkLightQueue {
+ public boolean shouldFastUpdate;
+ java.util.ArrayDeque<Runnable> pre = new java.util.ArrayDeque<Runnable>();
@ -311,7 +302,7 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d
this.sorterMailbox = executor;
this.taskMailbox = processor;
}
@@ -120,13 +256,9 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
@@ -120,13 +247,9 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
}
private void addTask(int x, int z, IntSupplier completedLevelSupplier, ThreadedLevelLightEngine.TaskType stage, Runnable task) {
@ -328,7 +319,7 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d
}
@Override
@@ -142,8 +274,19 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
@@ -142,8 +265,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) {
ChunkPos chunkPos = chunk.getPos();
@ -341,16 +332,11 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..f0df7b2bd618c7be18c4c86f735b303d
+ IntSupplier prioritySupplier = playerChunkMap.getChunkQueueLevel(pair);
+ boolean[] skippedPre = {false};
+ this.queue.addChunk(pair, prioritySupplier, Util.name(() -> {
+ if (!isChunkLightStatus(pair)) {
+ future.complete(chunk);
+ skippedPre[0] = true;
+ return;
+ }
+ // Paper end
LevelChunkSection[] levelChunkSections = chunk.getSections();
for(int i = 0; i < chunk.getSectionsCount(); ++i) {
@@ -163,51 +306,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
@@ -163,51 +292,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
}, () -> {
return "lightChunk " + chunkPos + " " + excludeBlocks;

Datei anzeigen

@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773bf23b64ae 100644
index 4918f89401cdf6a85d8b71f3e3a6608239a388bd..83df832b1fe5be1c1114ce3ae10c1985bf564a0c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -79,6 +79,7 @@ import net.minecraft.world.level.GameRules;
@ -21,7 +21,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.BorderChangeListener;
import net.minecraft.world.level.border.WorldBorder;
@@ -829,6 +830,7 @@ public abstract class PlayerList {
@@ -830,6 +831,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
boolean isRespawn = false;
@ -29,7 +29,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b
// Paper end
// CraftBukkit start - fire PlayerRespawnEvent
@@ -839,7 +841,7 @@ public abstract class PlayerList {
@@ -840,7 +842,7 @@ public abstract class PlayerList {
Optional optional;
if (blockposition != null) {
@ -38,7 +38,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b
} else {
optional = Optional.empty();
}
@@ -882,7 +884,12 @@ public abstract class PlayerList {
@@ -883,7 +885,12 @@ public abstract class PlayerList {
}
// Spigot End
@ -52,7 +52,7 @@ index e0c9857a922d8a3f421d7df0f056b82c4775390e..82a646365b5b0619825995c722cf773b
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper
} else {
@@ -919,8 +926,12 @@ public abstract class PlayerList {
@@ -921,8 +928,12 @@ public abstract class PlayerList {
}
// entityplayer1.syncInventory();
entityplayer1.setHealth(entityplayer1.getHealth());

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 496bb91da1138fb6a4e004da1eab43e588c82592..f45e92fd85bdb99e072d95ee76ef926bda99f733 100644
index ff1cb5f679f57988eb30b77fbcc5de2699a90dca..ffb512ac2e2f827cf4079e9b24dd88e363eb95ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1977,6 +1977,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1983,6 +1983,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
lightning.visualOnly = true;
lightning.isSilent = isSilent;

Datei anzeigen

@ -55,7 +55,7 @@ index 01394284fca2f56c1808e75f70a64c4cc2a196ea..de2c21486f07bc2dbbaa9598354cd4ed
} // Paper start
for (ServerLevel level : this.getAllLevels()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index cf09bd17b9d2be04f79edef6debdd815b5f7f86c..7c05dd7489e686af3ce9c0d63cff30827467c263 100644
index 6cf83d9b1e43ade17cb67843dbdc11937eda1e08..f3e4b9f302fbc4b615a5e735d5aab0f403e16903 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -175,6 +175,7 @@ public class ServerPlayer extends Player {
@ -67,10 +67,10 @@ index cf09bd17b9d2be04f79edef6debdd815b5f7f86c..7c05dd7489e686af3ce9c0d63cff3082
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 82a646365b5b0619825995c722cf773bf23b64ae..e990c9d936b9b2b510dd9c7f5a507b4ba9e79965 100644
index 476a3a317779fdecbced48caa85f6835c54eb018..9a73364f4d56f3a7cecb27bc8034166b8f5731b9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -569,6 +569,7 @@ public abstract class PlayerList {
@@ -570,6 +570,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug)
@ -78,7 +78,7 @@ index 82a646365b5b0619825995c722cf773bf23b64ae..e990c9d936b9b2b510dd9c7f5a507b4b
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1206,10 +1207,21 @@ public abstract class PlayerList {
@@ -1208,10 +1209,21 @@ public abstract class PlayerList {
}
public void saveAll() {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e2f890479 100644
index 03ad0c0365f85a1536fb35bfdf08d6d44240df80..27fc9ec7183b100dcfc755d41b3348ccc04c705b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
@ -33,7 +33,7 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server;
this.connection = connection;
@@ -2980,6 +2984,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2981,6 +2985,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -42,7 +42,7 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3007,6 +3013,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3008,6 +3014,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -58,7 +58,7 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3016,6 +3031,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3017,6 +3032,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
@ -72,10 +72,10 @@ index e307f8695643360289b998a8d2ad244d966f1180..b7454592b9cee09f41631db6664cb18e
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a3951039eeb1f5d3529213ca02d11c97d499be38..e87a08d93abd507785ac5c79f97c02236aa6f43d 100644
index 9ce4ebc9a0ddeefdc9fb3a7bd91be77aeb075011..7257c8fedb6937d925dea592a69fd56ddd05c50d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2431,6 +2431,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2441,6 +2441,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e990c9d936b9b2b510dd9c7f5a507b4ba9e79965..518c93b7aa7a77c19d0256f3d9c24e3b21ac44de 100644
index 13f1b62e6f3adce54f82d6d131dd60976dc6f548..f2b139d565662fca1bbad46e50b5ccb0d08c4e37 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -145,7 +145,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -17,7 +17,7 @@ index 2653a55d3c947577ea153f3060d9b98acdf31c07..7d97ca9449b123a82b41937353d8fd0b
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f45e92fd85bdb99e072d95ee76ef926bda99f733..a6d04ddfc49eab2cabeab1af95635139a2cfdecd 100644
index ffb512ac2e2f827cf4079e9b24dd88e363eb95ee..b363af7a8ca8a3bbfd562095ac0f72acdb7dc192 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -246,11 +246,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a6d04ddfc49eab2cabeab1af95635139a2cfdecd..2ed3f753fe2e353815cc3201d2dc363639ca85f1 100644
index b363af7a8ca8a3bbfd562095ac0f72acdb7dc192..abab9734f77014ed2627337656ebbb2f3c018e55 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -184,6 +184,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add zombie targets turtle egg config
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 77e90a6b7d29ad989fd961e00a6fd97c7e5ec4fe..2252b9f36ea22a655592c6f176d18b70b7440e4e 100644
index acb4fe32835bca485cfb2ec509370c9f596d6a0f..7df8648240d43d01bcc2eb1f05f3dab2dc174f38 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -38,6 +38,11 @@ public class PaperWorldConfig {

Datei anzeigen

@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2252b9f36ea22a655592c6f176d18b70b7440e4e..8504f4dcfca35c8fe8e266af59762edde76bec77 100644
index 7df8648240d43d01bcc2eb1f05f3dab2dc174f38..f35bf9e1515d55143a1604e0aa7ec0b810a1a4c5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -43,6 +43,16 @@ public class PaperWorldConfig {

Datei anzeigen

@ -9,7 +9,7 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b7454592b9cee09f41631db6664cb18e2f890479..b45f79e83fc033424472b4044ab15a8c93cb0aec 100644
index 27fc9ec7183b100dcfc755d41b3348ccc04c705b..a6a14c6d3eb6d77997e1763e2dd451e0718511ea 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -681,7 +681,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -27,11 +27,11 @@ index b7454592b9cee09f41631db6664cb18e2f890479..b45f79e83fc033424472b4044ab15a8c
this.awaitingTeleportTime = this.tickCount;
- this.player.absMoveTo(d0, d1, d2, f, f1);
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - use proper setPositionRotation for teleportation
this.player.forceCheckHighPriority(); // Paper
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 73fc8ebd2ec207db2efc545f6bb304d53880b78f..bf1f22ee4e2a38b0fe2430dbeb20ae9f544ea423 100644
index e1b6a390105232500d7146cc456bf30912934904..993a7000595181a83754f192a53ec2bfe1a2eddc 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -152,6 +152,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e60d2ef3482c002b082ee84f34b9e681447fa09e..01abe5e21639b990e5ae6d2021cd86149ddf93e5 100644
index 7d97ca9449b123a82b41937353d8fd0b2c98ea4e..9c2d43c95f2f4bab0c8bbae7390500aa676ce4da 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1166,6 +1166,13 @@ public class ServerLevel extends Level implements WorldGenLevel {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086)
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 72dd0141cb360c346690ecdb1e14d2c94ae6de90..ed9588e4f0e9da2c6bdf2b34357d8de46131f84c 100644
index 6333a310fe32c631be95889f7438414d4a2c03bd..2e983077143a0a7ce6857d5796c9e4f7a4629caf 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -257,6 +257,7 @@ public class ChunkHolder {
@@ -379,6 +379,7 @@ public class ChunkHolder {
}
public void blockChanged(BlockPos pos) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bf1f22ee4e2a38b0fe2430dbeb20ae9f544ea423..eab21c1a6fb0b0a5d3ecbf6cf580a8fa9d0c6b4b 100644
index 993a7000595181a83754f192a53ec2bfe1a2eddc..77de5d23e508998045fe13680cdf1f032d6f4336 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3935,4 +3935,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index eab21c1a6fb0b0a5d3ecbf6cf580a8fa9d0c6b4b..65f26b0d3fa43a09a9d20052f01aadc78206370b 100644
index 77de5d23e508998045fe13680cdf1f032d6f4336..ae2937e6b6b0ac150f6f608459d2b75a05e16c36 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey;

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix for large move vectors crashing server
Check movement distance also based on current position.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5e90c722405f9e00bfaf9e2fed523552d9755c8d..4c958e44f2e4627d848cef197167b7f8b0f5e965 100644
index a6a14c6d3eb6d77997e1763e2dd451e0718511ea..eb723a356217d21352b82485050d316291e669ca 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -506,19 +506,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -506,20 +506,31 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
ServerLevel worldserver = this.player.getLevel();
@ -32,16 +32,37 @@ index 5e90c722405f9e00bfaf9e2fed523552d9755c8d..4c958e44f2e4627d848cef197167b7f8
double d8 = d5 - this.vehicleFirstGoodZ;
double d9 = entity.getDeltaMovement().lengthSqr();
- double d10 = d6 * d6 + d7 * d7 + d8 * d8;
-
+ // Paper start - fix large move vectors killing the server
+ double currDeltaX = toX - fromX;
+ double currDeltaY = toY - fromY;
+ double currDeltaZ = toZ - fromZ;
+ double d10 = Math.max(d6 * d6 + d7 * d7 + d8 * d8, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
+ // Paper end - fix large move vectors killing the server
+
+ // Paper start - fix large move vectors killing the server
+ double otherFieldX = d3 - this.vehicleLastGoodX;
+ double otherFieldY = d4 - this.vehicleLastGoodY - 1.0E-6D;
+ double otherFieldZ = d5 - this.vehicleLastGoodZ;
+ d10 = Math.max(d10, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
+ // Paper end - fix large move vectors killing the server
// CraftBukkit start - handle custom speeds and skipped ticks
@@ -1232,14 +1237,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
@@ -562,9 +573,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean flag = worldserver.noCollision(entity, entity.getBoundingBox().deflate(0.0625D));
- d6 = d3 - this.vehicleLastGoodX;
- d7 = d4 - this.vehicleLastGoodY - 1.0E-6D;
- d8 = d5 - this.vehicleLastGoodZ;
+ d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above
+ d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above
+ d8 = d5 - this.vehicleLastGoodZ; // Paper - diff on change, used for checking large move vectors above
entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
double d11 = d7;
@@ -1232,14 +1243,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
float prevPitch = this.player.getXRot();
// CraftBukkit end
double d3 = this.player.getX(); final double toX = d3; // Paper - OBFHELPER
@ -59,7 +80,26 @@ index 5e90c722405f9e00bfaf9e2fed523552d9755c8d..4c958e44f2e4627d848cef197167b7f8
+ double currDeltaY = toY - prevY;
+ double currDeltaZ = toZ - prevZ;
+ double d11 = Math.max(d7 * d7 + d8 * d8 + d9 * d9, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1);
+ // Paper end - fix large move vectors killing the server
+ // Paper start - fix large move vectors killing the server
+ double otherFieldX = d0 - this.lastGoodX;
+ double otherFieldY = d1 - this.lastGoodY;
+ double otherFieldZ = d2 - this.lastGoodZ;
+ d11 = Math.max(d11, (otherFieldX * otherFieldX + otherFieldY * otherFieldY + otherFieldZ * otherFieldZ) - 1);
+ // Paper end - fix large move vectors killing the server
if (this.player.isSleeping()) {
if (d11 > 1.0D) {
@@ -1291,9 +1313,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
AABB axisalignedbb = this.player.getBoundingBox();
- d7 = d0 - this.lastGoodX;
- d8 = d1 - this.lastGoodY;
- d9 = d2 - this.lastGoodZ;
+ d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
+ d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
+ d9 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above
boolean flag = d8 > 0.0D;
if (this.player.isOnGround() && !packet.isOnGround() && flag) {

Datei anzeigen

@ -10,7 +10,7 @@ In general, look at making this logic more robust (i.e properly handling
cases where a captured entry is overriden) - but for now this will do.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 36fd88239da908c2685a853ec28c0f3db691fad0..e095f699a1e79e89fa87cb1d7096316450274495 100644
index 970a67d82219fa642080c78a814c12ca8d9a5ee9..f56b2f3a0b390d960224a4090267d1295d573bd0 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -148,7 +148,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e87a08d93abd507785ac5c79f97c02236aa6f43d..65f44c7747eea49fffff678fcbfdc32195a4db5d 100644
index 7257c8fedb6937d925dea592a69fd56ddd05c50d..2b24575e19cd1b24c259711bfd4e6cae6492f927 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -539,6 +539,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen