diff options
author | Spottedleaf <[email protected]> | 2024-12-01 14:07:46 -0800 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-12-01 14:07:46 -0800 |
commit | ae80a251fc75abee4082981ac1ee59ccb2c9d96b (patch) | |
tree | c6c92ab09e0c814a99329bf311d55528a91b61a4 | |
parent | 4bc80b8a44f3d7aa3bf44f265f0959b4e801790e (diff) | |
download | Paper-ae80a251fc75abee4082981ac1ee59ccb2c9d96b.tar.gz Paper-ae80a251fc75abee4082981ac1ee59ccb2c9d96b.zip |
Properly handle large values of spawnChunkRadius
The chunk system does not allow ticket levels below 0, so we need
to add tickets for each individual chunk instead.
4 files changed, 34 insertions, 6 deletions
diff --git a/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch b/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch index 452a3c6ba7..83ad17bfc0 100644 --- a/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch +++ b/patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch @@ -5,6 +5,34 @@ Subject: [PATCH] Add startup flag to disable gamerule limits -DPaper.DisableGameRuleLimits=true will disable gamerule limits +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 9928e14a5a42a2f0deba86e9dcb1f6f9f59412ef..c5eed86a8982466fd8302c678f0f041db1b24029 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -2071,13 +2071,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + if (this.lastSpawnChunkRadius > 1) { +- this.getChunkSource().removeRegionTicket(TicketType.START, new ChunkPos(blockposition1), this.lastSpawnChunkRadius, Unit.INSTANCE); ++ // Paper start - allow disabling gamerule limits ++ for (ChunkPos chunkPos : io.papermc.paper.util.MCUtil.getSpiralOutChunks(blockposition1, this.lastSpawnChunkRadius - 2)) { ++ this.getChunkSource().removeTicketAtLevel(TicketType.START, chunkPos, net.minecraft.server.level.ChunkLevel.ENTITY_TICKING_LEVEL, Unit.INSTANCE); ++ } ++ // Paper end - allow disabling gamerule limits + } + + int i = this.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS) + 1; + + if (i > 1) { +- this.getChunkSource().addRegionTicket(TicketType.START, new ChunkPos(pos), i, Unit.INSTANCE); ++ // Paper start - allow disabling gamerule limits ++ for (ChunkPos chunkPos : io.papermc.paper.util.MCUtil.getSpiralOutChunks(pos, i - 2)) { ++ this.getChunkSource().addTicketAtLevel(TicketType.START, chunkPos, net.minecraft.server.level.ChunkLevel.ENTITY_TICKING_LEVEL, Unit.INSTANCE); ++ } ++ // Paper end - allow disabling gamerule limits + } + + this.lastSpawnChunkRadius = i; diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java index 4ae47c2c5a6bcfbf932d000a80974463e2d3818d..7c363d59c6567cae8e6caf213be51804efa5a96d 100644 --- a/src/main/java/net/minecraft/world/level/GameRules.java diff --git a/patches/server/1057-Block-Enderpearl-Travel-Exploit.patch b/patches/server/1057-Block-Enderpearl-Travel-Exploit.patch index 1ce0fb851b..6c0ae6175b 100644 --- a/patches/server/1057-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/1057-Block-Enderpearl-Travel-Exploit.patch @@ -19,10 +19,10 @@ fully prevent enderpearl travel exploits. public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5979e8d25eaddf990ded79bcf6485cc0612faa63..0a46bf03f9a55c7453f042cba6f448d4d0bcd1e6 100644 +index 06ae6347d2c9666cb64aea2bea9ff946324015d9..7db77a36701e766c148e91d8313838d307855d8a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2664,6 +2664,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2672,6 +2672,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); diff --git a/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch b/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch index cb02caeb92..0e72daf994 100644 --- a/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch +++ b/patches/server/1060-Call-CraftPlayer-onEntityRemove-for-all-online-playe.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call CraftPlayer#onEntityRemove for all online players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0a46bf03f9a55c7453f042cba6f448d4d0bcd1e6..3d09c0c9ca3541c2b3b6feeb426eeffbdaeef69c 100644 +index 7db77a36701e766c148e91d8313838d307855d8a..657d8af7cc104962ee46ad1a7dc88b13c24262db 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2786,7 +2786,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2794,7 +2794,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // CraftBukkit start entity.valid = false; if (!(entity instanceof ServerPlayer)) { diff --git a/patches/server/1065-Add-Alternate-Current-redstone-implementation.patch b/patches/server/1065-Add-Alternate-Current-redstone-implementation.patch index 246643d457..6d9bd74276 100644 --- a/patches/server/1065-Add-Alternate-Current-redstone-implementation.patch +++ b/patches/server/1065-Add-Alternate-Current-redstone-implementation.patch @@ -2328,7 +2328,7 @@ index 0000000000000000000000000000000000000000..298076a0db4e6ee6e4775ac43bf749d9 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3d09c0c9ca3541c2b3b6feeb426eeffbdaeef69c..b4027f5cf90935a1fe3ab2c28b0bcbb55a7b541b 100644 +index 657d8af7cc104962ee46ad1a7dc88b13c24262db..585e2b43a0326f0b81597fa1234d3c67c76af550 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -230,6 +230,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -2339,7 +2339,7 @@ index 3d09c0c9ca3541c2b3b6feeb426eeffbdaeef69c..b4027f5cf90935a1fe3ab2c28b0bcbb5 public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately -@@ -2647,6 +2648,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2655,6 +2656,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return this.chunkSource.getGenerator().getSeaLevel(); } |