mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
28 lines
1.7 KiB
Diff
28 lines
1.7 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 ca24463405f138deb882f319bf84696f52a1f606..aed4f4ac21b8ddc9c9ee7ce5151bbfc8bb6cf7f5 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -1741,6 +1741,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())) {
|