29 if (!ghost.
getEntity().isInCurrentLocation()) {
33 super.advance(amount, ghost);
35 float [] coords =
plugin.getLengthAndWidthFractionWithinStream(ghost.
getEntity().getLocation());
40 float distAlong = coords[0];
41 float yOff = coords[1];
44 boolean closeToPreferred = Math.abs(yOff -
preferredYOff) < 0.25f;
45 boolean veryCloseToPreferred = Math.abs(yOff -
preferredYOff) < 0.05f;
46 if (!closeToPreferred) {
49 if (veryCloseToPreferred) {
55 Vector2f p1 =
plugin.getPointAt(distAlong, yOff);
59 float dist = Float.MAX_VALUE;
61 dist = Misc.getDistance(ghost.
getEntity(), pf);
63 if (pf !=
null && dist < 500f) {
64 float angleDiff = Misc.getAngleDiff(Misc.getAngleInDegrees(ghost.
getEntity().getVelocity()),
65 Misc.getAngleInDegrees(ghost.
getEntity().getLocation(), pf.getLocation()));
66 coords =
plugin.getLengthAndWidthFractionWithinStream(pf.getLocation());
67 if (coords !=
null && angleDiff < 90f) {
68 float yOffPlayer = coords[1];
69 float test1 = yOffPlayer - 0.4f;
70 float test2 = yOffPlayer + 0.4f;
71 if (Math.abs(test1) > 0.67f) test1 = Math.signum(test1) * 0.67f;
72 if (Math.abs(test2) > 0.67f) test2 = Math.signum(test2) * 0.67f;
73 float diff1 = Math.abs(test1 - yOff);
74 float diff2 = Math.abs(test2 - yOff);
77 float diff3 = Math.abs(yOff - yOffPlayer);
88 Vector2f p2 =
plugin.getPointAt(distAlong + 200f, yOffDest);
89 if (p1 ==
null || p2 ==
null) {
93 Vector2f dest = Misc.getUnitVectorAtDegreeAngle(Misc.getAngleInDegrees(p1, p2));
96 Vector2f.add(dest, ghost.
getEntity().getLocation(), dest);