/** * Adds a path from start to end and returns the whole path (args: unused, start, end, unused, * maxDistance) */ private PathEntity addToPath( Entity par1Entity, PathPoint par2PathPoint, PathPoint par3PathPoint, PathPoint par4PathPoint, float par5) { par2PathPoint.totalPathDistance = 0.0F; par2PathPoint.distanceToNext = par2PathPoint.func_75832_b(par3PathPoint); par2PathPoint.distanceToTarget = par2PathPoint.distanceToNext; this.path.clearPath(); this.path.addPoint(par2PathPoint); PathPoint var6 = par2PathPoint; while (!this.path.isPathEmpty()) { PathPoint var7 = this.path.dequeue(); if (var7.equals(par3PathPoint)) { return this.createEntityPath(par2PathPoint, par3PathPoint); } if (var7.func_75832_b(par3PathPoint) < var6.func_75832_b(par3PathPoint)) { var6 = var7; } var7.isFirst = true; int var8 = this.findPathOptions(par1Entity, var7, par4PathPoint, par3PathPoint, par5); for (int var9 = 0; var9 < var8; ++var9) { PathPoint var10 = this.pathOptions[var9]; float var11 = var7.totalPathDistance + var7.func_75832_b(var10); if (!var10.isAssigned() || var11 < var10.totalPathDistance) { var10.previous = var7; var10.totalPathDistance = var11; var10.distanceToNext = var10.func_75832_b(par3PathPoint); if (var10.isAssigned()) { this.path.changeDistance(var10, var10.totalPathDistance + var10.distanceToNext); } else { var10.distanceToTarget = var10.totalPathDistance + var10.distanceToNext; this.path.addPoint(var10); } } } } if (var6 == par2PathPoint) { return null; } else { return this.createEntityPath(par2PathPoint, var6); } }
/** Adds a path from start to end and returns the whole path */ private PathEntity addToPath( Entity entityIn, PathPoint pathpointStart, PathPoint pathpointEnd, float maxDistance) { pathpointStart.totalPathDistance = 0.0F; pathpointStart.distanceToNext = pathpointStart.distanceToSquared(pathpointEnd); pathpointStart.distanceToTarget = pathpointStart.distanceToNext; this.path.clearPath(); this.path.addPoint(pathpointStart); PathPoint pathpoint = pathpointStart; while (!this.path.isPathEmpty()) { PathPoint pathpoint1 = this.path.dequeue(); if (pathpoint1.equals(pathpointEnd)) { return this.createEntityPath(pathpointStart, pathpointEnd); } if (pathpoint1.distanceToSquared(pathpointEnd) < pathpoint.distanceToSquared(pathpointEnd)) { pathpoint = pathpoint1; } pathpoint1.visited = true; int i = this.nodeProcessor.findPathOptions( this.pathOptions, entityIn, pathpoint1, pathpointEnd, maxDistance); for (int j = 0; j < i; ++j) { PathPoint pathpoint2 = this.pathOptions[j]; float f = pathpoint1.totalPathDistance + pathpoint1.distanceToSquared(pathpoint2); if (f < maxDistance * 2.0F && (!pathpoint2.isAssigned() || f < pathpoint2.totalPathDistance)) { pathpoint2.previous = pathpoint1; pathpoint2.totalPathDistance = f; pathpoint2.distanceToNext = pathpoint2.distanceToSquared(pathpointEnd); if (pathpoint2.isAssigned()) { this.path.changeDistance( pathpoint2, pathpoint2.totalPathDistance + pathpoint2.distanceToNext); } else { pathpoint2.distanceToTarget = pathpoint2.totalPathDistance + pathpoint2.distanceToNext; this.path.addPoint(pathpoint2); } } } } if (pathpoint == pathpointStart) { return null; } else { return this.createEntityPath(pathpointStart, pathpoint); } }
private PathEntity a( Entity entity, PathPoint pathpoint, PathPoint pathpoint1, PathPoint pathpoint2, float f) { pathpoint.e = 0.0F; pathpoint.f = pathpoint.b(pathpoint1); pathpoint.g = pathpoint.f; this.b.a(); this.b.a(pathpoint); PathPoint pathpoint3 = pathpoint; while (!this.b.e()) { PathPoint pathpoint4 = this.b.c(); if (pathpoint4.equals(pathpoint1)) { return this.a(pathpoint, pathpoint1); } if (pathpoint4.b(pathpoint1) < pathpoint3.b(pathpoint1)) { pathpoint3 = pathpoint4; } pathpoint4.i = true; int i = this.b(entity, pathpoint4, pathpoint2, pathpoint1, f); for (int j = 0; j < i; ++j) { PathPoint pathpoint5 = this.d[j]; float f1 = pathpoint4.e + pathpoint4.b(pathpoint5); if (!pathpoint5.a() || f1 < pathpoint5.e) { pathpoint5.h = pathpoint4; pathpoint5.e = f1; pathpoint5.f = pathpoint5.b(pathpoint1); if (pathpoint5.a()) { this.b.a(pathpoint5, pathpoint5.e + pathpoint5.f); } else { pathpoint5.g = pathpoint5.e + pathpoint5.f; this.b.a(pathpoint5); } } } } if (pathpoint3 == pathpoint) { return null; } else { return this.a(pathpoint, pathpoint3); } }