-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entity tracker min Y distance config option (#9406)
- Loading branch information
1 parent
1b96c64
commit 7232506
Showing
2 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
patches/server/1013-Configurable-entity-tracking-range-by-Y-coordinate.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 a4bf4ed615653ce30d2416a62e680d74e87b53fa..65d947df910d60f478e7a449eb161e5105e2c0c9 100644 | ||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java | ||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java | ||
@@ -1554,6 +1554,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider | ||
double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper | ||
double d2 = d0 * d0; | ||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player); | ||
+ // Paper start - check 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 - check Y | ||
|
||
// CraftBukkit start - respect vanish API | ||
if (!player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { |