aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-10-27 18:11:15 +0100
committerNassim Jahnke <[email protected]>2024-10-27 18:39:30 +0100
commit02bca1e6558bf4ac0cbf928d48e90f497b10b0a3 (patch)
tree1144072e447f4c0b7e80b278fd769106227f016a /patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch
parent12ed02105177f54906a7d4422b235929426bc264 (diff)
downloadPaper-02bca1e6558bf4ac0cbf928d48e90f497b10b0a3.tar.gz
Paper-02bca1e6558bf4ac0cbf928d48e90f497b10b0a3.zip
Remove timings impl
Diffstat (limited to 'patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch')
-rw-r--r--patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch b/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch
new file mode 100644
index 0000000000..a8f7a157ae
--- /dev/null
+++ b/patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: ruViolence <[email protected]>
+Date: Tue, 27 Jun 2023 15:38:18 +0800
+Subject: [PATCH] Configurable entity tracking range by Y coordinate
+
+Options to configure entity tracking by Y coordinate, also for each entity category.
+
+diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
+index 53e180e230d5a1652f3e19193243c37095d6b39e..5da3eee41ba0cbec5932cf9a7dac53777a2463fb 100644
+--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
+@@ -1577,7 +1577,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+ double d0 = (double) Math.min(this.getEffectiveRange(), i * 16);
+ double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z;
+ double d2 = d0 * d0;
+- boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
++ // Paper start - Configurable entity tracking range by Y
++ boolean flag = d1 <= d2;
++ if (flag && level.paperConfig().entities.trackingRangeY.enabled) {
++ double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
++ if (rangeY != -1) {
++ double vec3d_dy = player.getY() - this.entity.getY();
++ flag = vec3d_dy * vec3d_dy <= rangeY * rangeY;
++ }
++ }
++ flag = flag && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
++ // Paper end - Configurable entity tracking range by Y
+
+ // CraftBukkit start - respect vanish API
+ if (!player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) {