Skip to content

Commit

Permalink
Fix line of sight distance check
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Sep 11, 2023
1 parent fb06829 commit 517f8fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions patches/server/0626-Line-Of-Sight-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Line Of Sight Changes


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c0c864bcad6ba6466d7a6453ce920a3603f6066a..ad613b0d6c430a52ee706064c8638a643c2c5ffa 100644
index c0c864bcad6ba6466d7a6453ce920a3603f6066a..4246122a794018b526e1619dcd066c2c88f4786c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3548,7 +3548,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
Expand All @@ -14,7 +14,7 @@ index c0c864bcad6ba6466d7a6453ce920a3603f6066a..ad613b0d6c430a52ee706064c8638a64

- return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper
+ // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
+ return vec3d1.distanceToSqr(vec3d) > 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper
+ return vec3d1.distanceToSqr(vec3d) > 128.0D * 128.0D ? false : this.level().clipDirect(vec3d, vec3d1, net.minecraft.world.phys.shapes.CollisionContext.of(this)) == HitResult.Type.MISS; // Paper
}
}

Expand Down

0 comments on commit 517f8fb

Please sign in to comment.