2023-08-21 10:05:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: ruViolence <78062896+ruViolence@users.noreply.github.com>
|
|
|
|
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
|
2024-06-15 02:19:25 +02:00
|
|
|
index e2521e1a56df8dcb1de815e5973de952408d3b8b..6c5557aad2455b79bb2adf8939eb9a6127ccc3c3 100644
|
2023-08-21 10:05:49 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
2024-06-14 10:17:11 +02:00
|
|
|
@@ -1593,6 +1593,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
2023-09-22 18:59:52 +02:00
|
|
|
double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z;
|
2023-08-21 10:05:49 +02:00
|
|
|
double d2 = d0 * d0;
|
2023-09-22 18:59:52 +02:00
|
|
|
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
|
2024-01-14 16:31:39 +01:00
|
|
|
+ // Paper start - Configurable entity tracking range by Y
|
2023-08-21 10:05:49 +02:00
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ }
|
2024-01-14 16:31:39 +01:00
|
|
|
+ // Paper end - Configurable entity tracking range by Y
|
2023-08-21 10:05:49 +02:00
|
|
|
|
|
|
|
// CraftBukkit start - respect vanish API
|
|
|
|
if (!player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) {
|