mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 03:47:27 +00:00
More fixes to flight pathing.
This commit is contained in:
1 parent
115b66d0c6
commit
f9f73a75d2
2 files changed
+35
-12
No files matched your search
@@ -76,10 +76,6 @@ public class FlyPathFinder extends PathFinder
|
||||
flag = this.isPathingInWater;
|
||||
this.isPathingInWater = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = MathHelper.floor_double(p_75857_1_.boundingBox.minY + 0.5D);
|
||||
}
|
||||
|
||||
FlyPathPoint pathpoint2 = this.openPoint(MathHelper.floor_double(p_75857_1_.boundingBox.minX), i, MathHelper.floor_double(p_75857_1_.boundingBox.minZ));
|
||||
FlyPathPoint pathpoint = this.openPoint(MathHelper.floor_double(p_75857_2_ - (double)(p_75857_1_.width / 2.0F)), MathHelper.floor_double(p_75857_4_), MathHelper.floor_double(p_75857_6_ - (double)(p_75857_1_.width / 2.0F)));
|
||||
@@ -172,6 +168,13 @@ public class FlyPathFinder extends PathFinder
|
||||
FlyPathPoint pathpoint5 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint6 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + y, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
|
||||
FlyPathPoint pathpoint7 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + y, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
|
||||
FlyPathPoint pathpoint8 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord + 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint9 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint10 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint11 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord + 1, p_75860_3_, b0);
|
||||
|
||||
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint3;
|
||||
}
|
||||
@@ -187,6 +190,26 @@ public class FlyPathFinder extends PathFinder
|
||||
if (pathpoint6 != null && !pathpoint6.isFirst && pathpoint6.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint6;
|
||||
}
|
||||
|
||||
if (pathpoint7 != null && !pathpoint7.isFirst && pathpoint7.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint7;
|
||||
}
|
||||
|
||||
if (pathpoint8 != null && !pathpoint8.isFirst && pathpoint8.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint8;
|
||||
}
|
||||
|
||||
if (pathpoint9 != null && !pathpoint9.isFirst && pathpoint9.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint9;
|
||||
}
|
||||
|
||||
if (pathpoint10 != null && !pathpoint10.isFirst && pathpoint10.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint10;
|
||||
}
|
||||
|
||||
if (pathpoint11 != null && !pathpoint11.isFirst && pathpoint11.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint11;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
@@ -226,7 +226,7 @@ public class PathNavigateFlying extends PathNavigate {
|
||||
|
||||
if (vec3 != null)
|
||||
{
|
||||
this.theEntity.getMoveHelper().setMoveTo(vec3.xCoord, vec3.yCoord, vec3.zCoord, this.speed);
|
||||
this.theEntity.getMoveHelper().setMoveTo(vec3.xCoord, vec3.yCoord + 0.5D, vec3.zCoord, this.speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +328,7 @@ public class PathNavigateFlying extends PathNavigate {
|
||||
* Returns true when an entity of specified size could safely walk in a straight line between the two points. Args:
|
||||
* pos1, pos2, entityXSize, entityYSize, entityZSize
|
||||
*/
|
||||
private boolean isDirectPathBetweenPoints(Vec3 p_75493_1_, Vec3 p_75493_2_, int p_75493_3_, int p_75493_4_, int p_75493_5_)
|
||||
private boolean isDirectPathBetweenPoints(Vec3 p_75493_1_, Vec3 p_75493_2_, int entityXSize, int entityYSize, int entityZSize)
|
||||
{
|
||||
int l = MathHelper.floor_double(p_75493_1_.xCoord);
|
||||
int i1 = MathHelper.floor_double(p_75493_1_.zCoord);
|
||||
@@ -345,17 +345,17 @@ public class PathNavigateFlying extends PathNavigate {
|
||||
double d3 = 1.0D / Math.sqrt(d2);
|
||||
d0 *= d3;
|
||||
d1 *= d3;
|
||||
p_75493_3_ += 2;
|
||||
p_75493_5_ += 2;
|
||||
entityXSize += 2;
|
||||
entityZSize += 2;
|
||||
|
||||
if (!this.isSafeToStandAt(l, (int)p_75493_1_.yCoord, i1, p_75493_3_, p_75493_4_, p_75493_5_, p_75493_1_, d0, d1))
|
||||
if (!this.isSafeToStandAt(l, (int)p_75493_1_.yCoord, i1, entityXSize, entityYSize, entityZSize, p_75493_1_, d0, d1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_75493_3_ -= 2;
|
||||
p_75493_5_ -= 2;
|
||||
entityXSize -= 2;
|
||||
entityZSize -= 2;
|
||||
double d4 = 1.0D / Math.abs(d0);
|
||||
double d5 = 1.0D / Math.abs(d1);
|
||||
double d6 = (double)(l * 1) - p_75493_1_.xCoord;
|
||||
@@ -400,7 +400,7 @@ public class PathNavigateFlying extends PathNavigate {
|
||||
k2 = i2 - i1;
|
||||
}
|
||||
}
|
||||
while (this.isSafeToStandAt(l, (int)p_75493_1_.yCoord, i1, p_75493_3_, p_75493_4_, p_75493_5_, p_75493_1_, d0, d1));
|
||||
while (this.isSafeToStandAt(l, (int)p_75493_1_.yCoord, i1, entityXSize, entityYSize, entityZSize, p_75493_1_, d0, d1));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user