Skip to content

Commit

Permalink
Merge branch 'PaperMC:dev/1.20.2' into dev/1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LangZongz authored Nov 22, 2023
2 parents 0d20973 + 3843340 commit c95444c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions patches/server/0003-Threaded-Regions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12717,7 +12717,7 @@ index 55f96545d6db95e3e657502a7910d96fded1113e..b39dd5a11a34407244666d8b9c1e775d

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 8c33a12ca879c46893150d6adfb8aa4d397c6b4c..a97c0a86d7a07041d1f8e9c6ea59eb4cce1243e6 100644
index 8c33a12ca879c46893150d6adfb8aa4d397c6b4c..4ed40924942bc3252fb1a533190765fbfdb2ba72 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -60,73 +60,42 @@ public class ServerChunkCache extends ChunkSource {
Expand Down Expand Up @@ -12875,6 +12875,15 @@ index 8c33a12ca879c46893150d6adfb8aa4d397c6b4c..a97c0a86d7a07041d1f8e9c6ea59eb4c

gameprofilerfiller.push("naturalSpawnCount");
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
@@ -531,7 +482,7 @@ public class ServerChunkCache extends ChunkSource {
NaturalSpawner.SpawnState spawnercreature_d; // moved down
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
// re-set mob counts
- for (ServerPlayer player : this.level.players) {
+ for (ServerPlayer player : regionizedWorldData.getLocalPlayers()) { // Folia - region threading
// Paper start - per player mob spawning backoff
for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
player.mobCounts[ii] = 0;
@@ -544,14 +495,14 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - per player mob spawning backoff
Expand Down Expand Up @@ -21657,7 +21666,7 @@ index 1d7c663fa0e550bd0cfb9a4b83ccd7e2968666f0..f3df9c9b6cff85565514f990597f3fe5
LevelChunkTicks<T> levelChunkTicks = this.allContainers.get(l);
if (levelChunkTicks == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bbc51ebf0dc0801ace9d5e7875fb2fe100b286bc..7ced957b11deb6643bff6547257f449c56038d74 100644
index bbc51ebf0dc0801ace9d5e7875fb2fe100b286bc..541915675dd3ad832992360283e3ba1b3cc62e27 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -311,7 +311,7 @@ public final class CraftServer implements Server {
Expand Down Expand Up @@ -21706,7 +21715,7 @@ index bbc51ebf0dc0801ace9d5e7875fb2fe100b286bc..7ced957b11deb6643bff6547257f449c
+ null,
+ 1L
+ );
+ } else if (sender instanceof ConsoleCommandSender console) {
+ } else if (sender instanceof ConsoleCommandSender || sender instanceof io.papermc.paper.commands.FeedbackForwardingSender) {
+ io.papermc.paper.threadedregions.RegionizedServer.getInstance().addTask(() -> {
+ CraftServer.this.dispatchCommand(sender, commandLine);
+ });
Expand All @@ -21726,7 +21735,7 @@ index bbc51ebf0dc0801ace9d5e7875fb2fe100b286bc..7ced957b11deb6643bff6547257f449c
+ // Folia start - region threading
+ if ((sender instanceof Entity entity)) {
+ io.papermc.paper.util.TickThread.ensureTickThread(((org.bukkit.craftbukkit.entity.CraftEntity)entity).getHandle(), "Dispatching command async");
+ } else if (sender instanceof ConsoleCommandSender console) {
+ } else if (sender instanceof ConsoleCommandSender || sender instanceof io.papermc.paper.commands.FeedbackForwardingSender) {
+ io.papermc.paper.threadedregions.RegionizedServer.ensureGlobalTickThread("Dispatching command async");
+ } else {
+ // huh?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs


diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7ced957b11deb6643bff6547257f449c56038d74..4b43134f38ba203a309a412055461b57934da8f9 100644
index 541915675dd3ad832992360283e3ba1b3cc62e27..bc778637c7d4371cafa9bcda67f8965f57cc66d6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1268,6 +1268,7 @@ public final class CraftServer implements Server {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0018-Region-profiler.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ index f640a0b8742a8362401f91a9a0f8fbb31885dca0..50597a8b45bbd7dcc40b361da78358d9
// Folia end - region threading - replace entity tracking ticking

diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index a97c0a86d7a07041d1f8e9c6ea59eb4cce1243e6..4484063433a3dbf87e244a7857d85cc732f6ccd2 100644
index 4ed40924942bc3252fb1a533190765fbfdb2ba72..b9b1dfe04eda8498f0ceff0aee66489d2a02b814 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -436,16 +436,23 @@ public class ServerChunkCache extends ChunkSource {
Expand Down Expand Up @@ -1560,7 +1560,7 @@ index a97c0a86d7a07041d1f8e9c6ea59eb4cce1243e6..4484063433a3dbf87e244a7857d85cc7
+ profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); try { // Folia - profiler
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
// re-set mob counts
for (ServerPlayer player : this.level.players) {
for (ServerPlayer player : regionizedWorldData.getLocalPlayers()) { // Folia - region threading
@@ -499,6 +508,7 @@ public class ServerChunkCache extends ChunkSource {
} else {
spawnercreature_d = NaturalSpawner.createState(l, regionizedWorldData.getLoadedEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); // Folia - region threading
Expand Down

0 comments on commit c95444c

Please sign in to comment.