aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch
diff options
context:
space:
mode:
authorJakub Zacek <[email protected]>2024-07-15 23:35:51 +0200
committerGitHub <[email protected]>2024-07-15 17:35:51 -0400
commit2cd8c461af74f0a524878dcdffba86cd105c48c6 (patch)
treeac107a76fe3d6cdd2e6ef5804ef3cba152957e4c /patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch
parentb57b24d549c65ddc5eb3edcc1ecc6aad2826dbd8 (diff)
downloadPaper-2cd8c461af74f0a524878dcdffba86cd105c48c6.tar.gz
Paper-2cd8c461af74f0a524878dcdffba86cd105c48c6.zip
Add OMINOUS_ITEM_SPAWNER SpawnReason (#10897)
Diffstat (limited to 'patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch')
-rw-r--r--patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch b/patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch
new file mode 100644
index 0000000000..8cb5db78e2
--- /dev/null
+++ b/patches/server/0868-Configurable-entity-tracking-range-by-Y-coordinate.patch
@@ -0,0 +1,27 @@
+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 91ca37605bf7ba65875b588fe9764b30214f63b6..2943390c0ec7e542d2bb1996dbbd626445c3108e 100644
+--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
+@@ -1566,6 +1566,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+ 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
++ 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;
++ }
++ }
++ // Paper end - Configurable entity tracking range by Y
+
+ // CraftBukkit start - respect vanish API
+ if (!player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) {