Fix gitignore + better hit reg

This commit is contained in:
beaness 2022-06-26 12:35:55 +02:00
parent 506bf650d5
commit dbce84bcf8
3 changed files with 36 additions and 2 deletions

4
.gitignore vendored
View File

@ -69,3 +69,7 @@ hs_err_pid*
>>>>>>> 354c5c7d98801e512c3da0913cd1824a9cf4b2cf >>>>>>> 354c5c7d98801e512c3da0913cd1824a9cf4b2cf
/run /run
# gradle
.gradle/
build/

View File

@ -134,6 +134,11 @@ public class eSpigotConfig
lagCompensatedPearls = getBoolean("settings.lag-compensated.pearls", true); lagCompensatedPearls = getBoolean("settings.lag-compensated.pearls", true);
} }
public static boolean improvedHitReg;
private static void improvedHitReg() {
improvedHitReg = getBoolean("settings.improved-hit-reg", true);
}
public static boolean cannonTracker; public static boolean cannonTracker;
private static void cannonTracker() private static void cannonTracker()

View File

@ -1811,7 +1811,32 @@ public abstract class EntityLiving extends Entity {
} }
public boolean hasLineOfSight(Entity entity) { public boolean hasLineOfSight(Entity entity) {
return this.world.rayTrace(new Vec3D(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), new Vec3D(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null; Vec3D vec = new Vec3D(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
if (entity instanceof EntityPlayer && eSpigotConfig.improvedHitReg) {
// Head height is 1,5725
// Split it into three to get a more accurate line of sight -> 0.52416667
double parts = entity.getHeadHeight() / 3;
Vec3D vec3 = new Vec3D(entity.locX, entity.locY, entity.locZ);
return this.world.rayTrace(
vec,
vec3.add(0.0D, (parts * 3), 0.0D)
) == null || this.world.rayTrace(
vec,
vec3.add(0.0D, (parts * 2), 0.0D)
) == null || this.world.rayTrace(
vec,
vec3.add(0.0D, (parts * 1), 0.0D)
) == null;
} else {
return this.world.rayTrace(
vec,
new Vec3D(entity.locX, entity.locY + (double) this.getHeadHeight(), entity.locZ)
) == null;
}
} }
public Vec3D ap() { public Vec3D ap() {