3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0405-limit-the-range-at-which-we-ll-consider-an-attackabl.patch
Zach Brown 1e38743b1d
Update upstream B/CB/S
Also fixes build as a result of an upstream force push

--- work/Bukkit
Submodule work/Bukkit 217dc08d..d13fdf8c:
  > SPIGOT-4637: Add source block to BlockPhysicsEvent.

--- work/CraftBukkit
Submodule work/CraftBukkit acbba8ba..cb98c6ea:
  > Fix line endings in CraftDefaultPermissions
  > SPIGOT-4637: Add source block to BlockPhysicsEvent.

--- work/Spigot
Submodule work/Spigot 75ee78a0c...4165cd8f4 (commits not present)
  > (Manually Added) - Appears to be a result of an upstream force push
  > (Manually Added) - Changed: SPIGOT-4636: Add creative mode NBT permissions
2019-02-25 04:39:24 -05:00

36 Zeilen
1.7 KiB
Diff

From be7214eca617bb458824f6fc67ef1e264bd5a024 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 13 Nov 2018 14:01:00 +0000
Subject: [PATCH] limit the range at which we'll consider an attackable target
This patch aims to ensure that MCP World#getNearestAttackablePlayer
will not trigger chunk loads due to PathfinderGoalNearestAttackableTarget
performing a ray trace operation by pre-checking the maximum limit;
Given that the implementation shows that the limit should only ever
decrease when set, allowing us to skip further checks earlier on
when looking for an attackable entity
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9338618f8..0c9fad1c8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2729,8 +2729,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
+ // Paper start
+ // move distance check up, if set, check distance^2 is less than XZlimit^2, continue
+ // 4th method param is XZlimit (at least at the time of commit)
+ double d6 = entityhuman1.d(d0, entityhuman1.locY, d2);
+ if (d3 < 0.0D || d6 < d3 * d3)
if (!entityhuman1.abilities.isInvulnerable && entityhuman1.isAlive() && !entityhuman1.isSpectator() && (predicate == null || predicate.test(entityhuman1))) {
- double d6 = entityhuman1.d(d0, entityhuman1.locY, d2);
+ // Paper end
double d7 = d3;
if (entityhuman1.isSneaking()) {
--
2.20.1