diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index 1d48fae202..54aa551c2a 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -1448,10 +1448,10 @@ index 0000000000000000000000000000000000000000..1bb16fc7598cd53e822d84b69d6a9727 +} diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..56e9155ebe850bcf759f5ae08e838f1a5aa593e5 +index 0000000000000000000000000000000000000000..6b7795451036f5867e2ddbe2013d83256bc83076 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -0,0 +1,475 @@ +@@ -0,0 +1,481 @@ +package io.papermc.paper.configuration; + +import com.google.common.collect.HashBasedTable; @@ -1574,6 +1574,12 @@ index 0000000000000000000000000000000000000000..56e9155ebe850bcf759f5ae08e838f1a + public boolean tick = true; + } + ++ public Markers markers; ++ ++ public class Markers extends ConfigurationPart { ++ public boolean tick = true; ++ } ++ + public Spawning spawning; + + public class Spawning extends ConfigurationPart { diff --git a/patches/server/0839-Don-t-tick-markers.patch b/patches/server/0839-Don-t-tick-markers.patch index a16e9e19e9..b485fadd53 100644 --- a/patches/server/0839-Don-t-tick-markers.patch +++ b/patches/server/0839-Don-t-tick-markers.patch @@ -3,13 +3,14 @@ From: Noah van der Aa Date: Fri, 7 Jan 2022 11:58:26 +0100 Subject: [PATCH] Don't tick markers -Fixes https://github.com/PaperMC/Paper/issues/7276 by not adding markers to the entity -tick list at all and ignoring them in Spigot's activation range checks. The entity tick +Fixes https://github.com/PaperMC/Paper/issues/7276 and https://github.com/PaperMC/Paper/issues/8118 +by using a config option that, when set to false, does not add markers to the entity +tick list at all and ignores them in Spigot's activation range checks. The entity tick list is only used in the tick and tickPassenger methods, so we can safely not add the -markers to it. +markers to it. When the config option is set to true, markers are ticked as normal. diff --git a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java -index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..4ec1e8ded06c60d81446c67bba2aa8a04111fa9b 100644 +index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..5f43aedc6596e2b1ac7af9711515714752c262e3 100644 --- a/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java +++ b/src/main/java/io/papermc/paper/command/subcommands/EntityCommand.java @@ -109,7 +109,7 @@ public final class EntityCommand implements PaperSubcommand { @@ -17,32 +18,33 @@ index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..4ec1e8ded06c60d81446c67bba2aa8a0 info.left++; info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); - if (!chunkProviderServer.isPositionTicking(e)) { -+ if (!chunkProviderServer.isPositionTicking(e) || e instanceof net.minecraft.world.entity.Marker) { // Markers aren't ticked. ++ if (!chunkProviderServer.isPositionTicking(e) || (e instanceof net.minecraft.world.entity.Marker && !world.paperConfig().entities.markers.tick)) { // Configurable marker ticking nonEntityTicking.merge(key, 1, Integer::sum); } }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 66b1ef69fe48340b5ccebd845b39f898515ff117..7ae780c4a38eb088f876e5bd03a0dba5836787fb 100644 +index 66b1ef69fe48340b5ccebd845b39f898515ff117..5180516d53030602c4516248703144b3f4047614 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2497,6 +2497,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void onTickingStart(Entity entity) { -+ if (entity instanceof net.minecraft.world.entity.Marker) return; // Paper - Don't tick markers ++ if (entity instanceof net.minecraft.world.entity.Marker && !paperConfig().entities.markers.tick) return; // Paper - Configurable marker ticking ServerLevel.this.entityTickList.add(entity); } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index f158fc8a151272428a33dc5f6e1742876edc80d5..e881584d38dc354204479863f004e974a0ac6c07 100644 +index f158fc8a151272428a33dc5f6e1742876edc80d5..52780192d6417f8085566e4cdf3a895a83638520 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -212,7 +212,7 @@ public class ActivationRange +@@ -212,7 +212,8 @@ public class ActivationRange // Paper end // Paper start - java.util.List entities = world.getEntities((Entity)null, maxBB, null); -+ java.util.List entities = world.getEntities((Entity)null, maxBB, (e) -> !(e instanceof net.minecraft.world.entity.Marker)); // Don't tick markers ++ java.util.function.Predicate entityPredicate = world.paperConfig().entities.markers.tick ? null : (e) -> !(e instanceof net.minecraft.world.entity.Marker); // Configurable marker ticking ++ java.util.List entities = world.getEntities((Entity)null, maxBB, entityPredicate); for (int i = 0; i < entities.size(); i++) { Entity entity = entities.get(i); ActivationRange.activateEntity(entity);