-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
From 0000000000000000000000000000000000000000 Mon Jan 9 00:00:00 2025 | ||
From: Michael <[email protected]> | ||
Date: Wed, 9 Jan 2025 12:34:56 +0500 | ||
Subject: [PATCH] Update line of sight method to use Vec3D.a(). | ||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java | ||
index abcdef1234567890abcdef1234567890abcdef12..fedcba0987654321fedcba9876543210fedcba98 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityLiving.java | ||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java | ||
@@ -150,7 +150,7 @@ public class EntityLiving extends Entity { | ||
public boolean hasLineOfSight(Entity entity) { | ||
- final Vec3D vec = new Vec3D(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); | ||
+ final Vec3D vec = Vec3D.a(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); | ||
final double entityHeadHeight = entity.getHeadHeight(); | ||
|
||
- return this.world.rayTrace(vec, new Vec3D(entity.locX, entity.locY + (double) this.getHeadHeight(), entity.locZ)) == null; | ||
+ return this.world.rayTrace(vec, Vec3D.a(entity.locX, entity.locY + (double) this.getHeadHeight(), entity.locZ)) == null; | ||
} | ||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java | ||
index abcdef1234567890abcdef1234567890abcdef12..fedcba0987654321fedcba9876543210fedcba98 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java | ||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java | ||
@@ -62,7 +62,7 @@ public class EntityPlayer extends EntityLiving { | ||
@Override | ||
public boolean hasLineOfSight(Entity entity) { | ||
- final Vec3D vec = new Vec3D(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); | ||
+ final Vec3D vec = Vec3D.a(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); | ||
final double entityHeadHeight = entity.getHeadHeight(); | ||
|
||
for (int i = 1; i <= 3; i++) { | ||
double targetY = entity.locY + (entityHeadHeight / 3) * i; | ||
- if (this.world.rayTrace(vec, new Vec3D(entity.locX, targetY, entity.locZ)) == null) { | ||
+ if (this.world.rayTrace(vec, Vec3D.a(entity.locX, targetY, entity.locZ)) == null) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} |