Fix gitignore + better hit reg
This commit is contained in:
parent
506bf650d5
commit
dbce84bcf8
|
@ -69,3 +69,7 @@ hs_err_pid*
|
|||
>>>>>>> 354c5c7d98801e512c3da0913cd1824a9cf4b2cf
|
||||
|
||||
/run
|
||||
|
||||
# gradle
|
||||
.gradle/
|
||||
build/
|
|
@ -134,6 +134,11 @@ public class eSpigotConfig
|
|||
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;
|
||||
private static void cannonTracker()
|
||||
|
|
|
@ -1811,7 +1811,32 @@ public abstract class EntityLiving extends 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() {
|
||||
|
|
Loading…
Reference in New Issue