Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-14 20:10:05 +01:00
31 Zeilen
2.0 KiB
Diff
31 Zeilen
2.0 KiB
Diff
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
|
|
index 8b5d11aceb77135c917c3581f4db792ef4b647ec..5b993cb8a99c6a0257b9d3d93162f9b2fff552b0 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())) {
|