1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-04-02 04:27:19 +02:00

Port improve chunk status transition speed

This commit is contained in:
KennyTV 2021-06-16 15:47:07 +02:00
parent 2b3c483a98
commit 05623c47ec
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
222 changed files with 28 additions and 50 deletions
patches/server
0489-Improve-Chunk-Status-Transition-Speed.patch0490-Optimize-NetworkManager-Exception-Handling.patch0491-Optimize-the-advancement-data-player-iteration-to-be.patch0492-Fix-arrows-never-despawning-MC-125757.patch0493-Thread-Safe-Vanilla-Command-permission-checking.patch0494-Move-range-check-for-block-placing-up.patch0495-Fix-SPIGOT-5989.patch0496-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch0497-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch0498-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch0499-Add-missing-strikeLighting-call-to-World-spigot-stri.patch0500-Fix-some-rails-connecting-improperly.patch0501-Fix-MC-187716-Use-configured-height.patch0502-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch0503-Do-not-let-the-server-load-chunks-from-newer-version.patch0504-Brand-support.patch0505-Add-setMaxPlayers-API.patch0506-Add-playPickupItemAnimation-to-LivingEntity.patch0507-Don-t-require-FACING-data.patch0508-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch0509-Add-moon-phase-API.patch0510-Prevent-headless-pistons-from-being-created.patch0511-Add-BellRingEvent.patch0512-Add-zombie-targets-turtle-egg-config.patch0513-Buffer-joins-to-world.patch0514-Optimize-redstone-algorithm.patch0515-Fix-hex-colors-not-working-in-some-kick-messages.patch0516-PortalCreateEvent-needs-to-know-its-entity.patch0517-Fix-CraftTeam-null-check.patch0518-Add-more-Evoker-API.patch0519-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch0520-Create-HoverEvent-from-ItemStack-Entity.patch0521-Cache-block-data-strings.patch0522-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch0523-Add-additional-open-container-api-to-HumanEntity.patch0524-Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch0525-Extend-block-drop-capture-to-capture-all-items-added.patch0526-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch0527-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch0528-Lazily-track-plugin-scoreboards-by-default.patch0529-Entity-isTicking.patch0530-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch0531-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch0532-Fix-Concurrency-issue-in-WeightedList.patch0533-Reset-Ender-Crystals-on-Dragon-Spawn.patch0534-Fix-for-large-move-vectors-crashing-server.patch0535-Optimise-getType-calls.patch0536-Villager-resetOffers.patch0537-Improve-inlinig-for-some-hot-IBlockData-methods.patch0538-Retain-block-place-order-when-capturing-blockstates.patch0539-Reduce-blockpos-allocation-from-pathfinding.patch0540-Fix-item-locations-dropped-from-campfires.patch0541-Player-elytra-boost-API.patch0542-Fixed-TileEntityBell-memory-leak.patch0543-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch0544-Add-getOfflinePlayerIfCached-String.patch0545-Add-ignore-discounts-API.patch0546-Toggle-for-removing-existing-dragon.patch0547-Fix-client-lag-on-advancement-loading.patch0548-Item-no-age-no-player-pickup.patch0549-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch0550-Beacon-API-custom-effect-ranges.patch0551-Add-API-for-quit-reason.patch0552-Seed-based-feature-search.patch0553-Add-Wandering-Trader-spawn-rate-config-options.patch0554-Significantly-improve-performance-of-the-end-generat.patch0555-Expose-world-spawn-angle.patch0556-Add-Destroy-Speed-API.patch0557-Fix-Player-spawnParticle-x-y-z-precision-loss.patch0558-Add-LivingEntity-clearActiveItem.patch0559-Add-PlayerItemCooldownEvent.patch0560-More-lightning-API.patch0561-Climbing-should-not-bypass-cramming-gamerule.patch0562-Added-missing-default-perms-for-commands.patch0563-Add-PlayerShearBlockEvent.patch0564-Set-spigots-verbose-world-setting-to-false-by-def.patch0565-Fix-curing-zombie-villager-discount-exploit.patch0566-Limit-recipe-packets.patch0567-Fix-CraftSound-backwards-compatibility.patch0568-MC-4-Fix-item-position-desync.patch0569-Player-Chunk-Load-Unload-Events.patch0570-Optimize-Dynamic-get-Missing-Keys.patch0571-Expose-LivingEntity-hurt-direction.patch0572-Add-OBSTRUCTED-reason-to-BedEnterResult.patch0573-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch0574-added-PlayerTradeEvent.patch0575-Implement-TargetHitEvent.patch0576-Additional-Block-Material-API-s.patch0577-Fix-harming-potion-dupe.patch0578-Implement-API-to-get-Material-from-Boats-and-Minecar.patch0579-Cache-burn-durations.patch0580-Allow-disabling-mob-spawner-spawn-egg-transformation.patch0581-Fix-Not-a-string-Map-Conversion-spam.patch0582-Implement-PlayerFlowerPotManipulateEvent.patch0583-Fix-interact-event-not-being-called-in-adventure.patch0584-Zombie-API-breaking-doors.patch0585-Fix-nerfed-slime-when-splitting.patch0586-Add-EntityLoadCrossbowEvent.patch0587-Guardian-beam-workaround.patch0588-Added-WorldGameRuleChangeEvent.patch

View file

@ -3,10 +3,6 @@ From: Aikar <aikar@aikar.co>
Date: Fri, 29 May 2020 23:32:14 -0400
Subject: [PATCH] Improve Chunk Status Transition Speed
1.17 Update note: Depends on not yet applied patch: Implement Chunk Priority / Urgency System for Chunks
When a chunk is loaded from disk that has already been generated,
the server has to promote the chunk through the system to reach
it's current desired status level.
@ -40,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 ce320672d7602c94dd75ad857435dca6ac3bab56..8260636da673ef095728c208db2d6237bab2db19 100644
index 377993f325400a9bc77f5fbc77d9ec50f5d76638..c28f693bf7da42570d95ab97ccb0ec2bf06f53ee 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -83,6 +83,13 @@ public class ChunkHolder {
@@ -240,6 +240,13 @@ public class ChunkHolder {
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
}
// Paper end - optimise isOutsideOfRange
@ -51,17 +47,17 @@ index ce320672d7602c94dd75ad857435dca6ac3bab56..8260636da673ef095728c208db2d6237
+ public boolean canAdvanceStatus() {
+ ChunkStatus status = getChunkHolderStatus();
+ ChunkAccess chunk = getAvailableChunkNow();
+ return chunk != null && (status == null || chunk.getStatus().isAtLeastStatus(getNextStatus(status)));
+ return chunk != null && (status == null || chunk.getStatus().isOrAfter(getNextStatus(status)));
+ }
+ // Paper end
// Paper start - no-tick view distance
public final LevelChunk getSendingChunk() {
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 7a1f6d1807757a43a7aa471db651404c06720820..acc566d14926dcf9e88f3e0837884e4c823d777c 100644
index c544529908dd5af63a829f54985eefc236e290db..4c8e5e3e69c629485b7118dfcc1eb04ac3c5f6c9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -792,7 +792,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -838,7 +838,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return either.mapLeft((list) -> {
return (LevelChunk) list.get(list.size() / 2);
});
@ -70,28 +66,10 @@ index 7a1f6d1807757a43a7aa471db651404c06720820..acc566d14926dcf9e88f3e0837884e4c
}
@Nullable
@@ -1142,7 +1142,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkAccess ichunkaccess = (ChunkAccess) optional.get();
if (ichunkaccess.getStatus().isOrAfter(requiredStatus)) {
- CompletableFuture completablefuture1;
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture1; // Paper
if (requiredStatus == ChunkStatus.LIGHT) {
completablefuture1 = this.scheduleChunkGeneration(holder, requiredStatus);
@@ -1158,7 +1158,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.scheduleChunkGeneration(holder, requiredStatus);
}
}
- }, this.mainThreadExecutor);
+ }, this.mainInvokingExecutor).thenComposeAsync(CompletableFuture::completedFuture, this.mainInvokingExecutor); // Paper - optimize chunk status progression without jumping through thread pool - ensure main
}
}
@@ -1279,6 +1279,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
});
}, (runnable) -> {
@@ -1222,6 +1222,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return "chunkGenerate " + requiredStatus.getName();
});
Executor executor = (runnable) -> {
+ // Paper start - optimize chunk status progression without jumping through thread pool
+ if (holder.canAdvanceStatus()) {
+ this.mainInvokingExecutor.execute(runnable);
@ -99,5 +77,5 @@ index 7a1f6d1807757a43a7aa471db651404c06720820..acc566d14926dcf9e88f3e0837884e4c
+ }
+ // Paper end
this.worldgenMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable));
});
}
};

View file

@ -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 2216fc05ef5f1c2f7e4dcab7bb20b9944838c5f4..f3d98b40b5adb5b6aa76371e9d3eb974b551d4f3 100644
index 9e5810eb0085ad956f0bd1cd69fa88909d9d638a..fbd433f7d48282365c73e2a76f14c2755b49d930 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 {

View file

@ -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 f3d98b40b5adb5b6aa76371e9d3eb974b551d4f3..b1ae749b2178dc8c49a7adf4a3e93339d8b99dfb 100644
index fbd433f7d48282365c73e2a76f14c2755b49d930..1ecf4ba21f0e7dd620804d952e11140ffd5af30b 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 {

View file

@ -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 377993f325400a9bc77f5fbc77d9ec50f5d76638..6be677e618ca5b5d5a969a02e77457dd6e3d2e11 100644
index c28f693bf7da42570d95ab97ccb0ec2bf06f53ee..bcb2750a1b3a8cef6eb4e22c6409f77614390f7b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -373,6 +373,7 @@ public class ChunkHolder {
@@ -380,6 +380,7 @@ public class ChunkHolder {
}
public void blockChanged(BlockPos pos) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Toggle for removing existing dragon
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b1ae749b2178dc8c49a7adf4a3e93339d8b99dfb..c484da4558e918c1456588e540a3b34e78581f81 100644
index 1ecf4ba21f0e7dd620804d952e11140ffd5af30b..1f673932e329f7e713a37a8c06345a184650f0eb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -53,6 +53,14 @@ public class PaperWorldConfig {

View file

@ -21,7 +21,7 @@ changes but this should usually not happen. A config option to disable
this completely is added though in case that should ever be necessary.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c484da4558e918c1456588e540a3b34e78581f81..cac404e1c7ede7b1076532555d35e6c18f158b16 100644
index 1f673932e329f7e713a37a8c06345a184650f0eb..a3c76e0515ee38cb5dc55e7dbf3f91cac5ef4c28 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -361,6 +361,14 @@ public class PaperWorldConfig {

View file

@ -11,7 +11,7 @@ in IWorldServerData are removed as they were only used in certain places, with h
values used in other places.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index cac404e1c7ede7b1076532555d35e6c18f158b16..f4b533b8e8b6c4bb59d032e91a94353f4b201b69 100644
index a3c76e0515ee38cb5dc55e7dbf3f91cac5ef4c28..5f25edb32b3e1194cf03c19574fc2ebd07b9a15e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -61,6 +61,19 @@ public class PaperWorldConfig {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index f4b533b8e8b6c4bb59d032e91a94353f4b201b69..5344d25e7bef34954aa058ec019b4ba8ab4de515 100644
index 5f25edb32b3e1194cf03c19574fc2ebd07b9a15e..edf82e84c2938ed70d51eb1199a4e92504c8c604 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -74,6 +74,11 @@ public class PaperWorldConfig {

View file

@ -8,7 +8,7 @@ and curing a villager on repeat by simply resetting the relevant part of
the reputation when it is cured.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5344d25e7bef34954aa058ec019b4ba8ab4de515..cf8bc5432de023968ecdae6e48045c93021ad243 100644
index edf82e84c2938ed70d51eb1199a4e92504c8c604..89bab0807b568cd19e3c84cc1314bdbb6463fb7e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -79,6 +79,11 @@ public class PaperWorldConfig {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index cf8bc5432de023968ecdae6e48045c93021ad243..f1cc0579654877fde716a3f99e4ea28044941b4b 100644
index 89bab0807b568cd19e3c84cc1314bdbb6463fb7e..592717db9c9e8efda88c6a464c51a5d76f9694dc 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -84,6 +84,11 @@ public class PaperWorldConfig {

Some files were not shown because too many files have changed in this diff Show more