mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Added a config option for ticking markers (#9034)
This commit is contained in:
parent
f73eefd668
commit
b46708d565
2 changed files with 14 additions and 6 deletions
|
@ -3,10 +3,11 @@ From: Noah van der Aa <ndvdaa@gmail.com>
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
@ -17,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
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);
|
||||
}
|
||||
});
|
||||
|
@ -29,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
// Paper start
|
||||
- java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, null);
|
||||
+ java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, (e) -> !(e instanceof net.minecraft.world.entity.Marker)); // Don't tick markers
|
||||
+ java.util.function.Predicate<Entity> entityPredicate = world.paperConfig().entities.markers.tick ? null : (e) -> !(e instanceof net.minecraft.world.entity.Marker); // Configurable marker ticking
|
||||
+ java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, entityPredicate);
|
||||
for (int i = 0; i < entities.size(); i++) {
|
||||
Entity entity = entities.get(i);
|
||||
ActivationRange.activateEntity(entity);
|
||||
|
|
|
@ -1574,6 +1574,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public boolean tick = true;
|
||||
+ }
|
||||
+
|
||||
+ public Markers markers;
|
||||
+
|
||||
+ public class Markers extends ConfigurationPart {
|
||||
+ public boolean tick = true;
|
||||
+ }
|
||||
+
|
||||
+ public Spawning spawning;
|
||||
+
|
||||
+ public class Spawning extends ConfigurationPart {
|
||||
|
|
Loading…
Reference in a new issue