use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
int i = 1;
PathPoint localPathPoint = paramPathPoint2;
while (localPathPoint.h != null) {
i++;
localPathPoint = localPathPoint.h;
}
PathPoint[] arrayOfPathPoint = new PathPoint[i];
localPathPoint = paramPathPoint2;
arrayOfPathPoint[(--i)] = localPathPoint;
while (localPathPoint.h != null) {
localPathPoint = localPathPoint.h;
arrayOfPathPoint[(--i)] = localPathPoint;
}
return new PathEntity(arrayOfPathPoint);
}
use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerNavigation method supera.
public PathEntity supera(BlockPosition paramBlockPosition) {
if (!b()) {
return null;
}
if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
return this.c;
}
this.r = paramBlockPosition;
float f1 = h();
BlockPosition localBlockPosition = new BlockPosition(this.a);
int i1 = (int) (f1 + 8.0F);
ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
PathEntity localPathEntity = this.s.a(localChunkCache, this.a, this.r, f1);
return localPathEntity;
}
use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
int i = 1;
PathPoint localPathPoint = paramPathPoint2;
while (localPathPoint.h != null) {
i++;
localPathPoint = localPathPoint.h;
}
PathPoint[] arrayOfPathPoint = new PathPoint[i];
localPathPoint = paramPathPoint2;
arrayOfPathPoint[(--i)] = localPathPoint;
while (localPathPoint.h != null) {
localPathPoint = localPathPoint.h;
arrayOfPathPoint[(--i)] = localPathPoint;
}
return new PathEntity(arrayOfPathPoint);
}
use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private PathEntity a(PathPoint var0, Map var1, float var2, int var3, float var4) {
Set<PathDestination> var5 = var1.keySet();
var0.e = 0.0F;
var0.f = a(var0, var5);
var0.g = var0.f;
this.d.a();
this.d.a(var0);
ImmutableSet immutableSet = ImmutableSet.of();
int var7 = 0;
Set<PathDestination> var8 = Sets.newHashSetWithExpectedSize(var5.size());
int var9 = (int) (this.b * var4);
while (!this.d.e() && ++var7 < var9) {
PathPoint pathPoint = this.d.c();
pathPoint.i = true;
for (PathDestination pathDestination : var5) {
if (pathPoint.c(pathDestination) <= var3) {
pathDestination.e();
var8.add(pathDestination);
}
}
if (!var8.isEmpty())
break;
if (pathPoint.a(var0) >= var2)
continue;
int i = this.c.a(this.a, pathPoint);
for (int var12 = 0; var12 < i; var12++) {
PathPoint var13 = this.a[var12];
float var14 = pathPoint.a(var13);
pathPoint.j += var14;
float var15 = pathPoint.e + var14 + var13.k;
if (var13.j < var2 && (!var13.c() || var15 < var13.e)) {
var13.h = pathPoint;
var13.e = var15;
var13.f = a(var13, var5) * 1.5F;
if (var13.c()) {
this.d.a(var13, var13.e + var13.f);
} else {
var13.g = var13.e + var13.f;
this.d.a(var13);
}
}
}
}
Optional var10 = !var8.isEmpty() ? var8.stream().map((var1x) -> {
return this.a(var1x.d(), (BlockPosition) var1.get(var1x), true);
}).min(Comparator.comparingInt(PathEntity::e)) : getFallbackDestinations(var1, var5).findFirst();
if (!var10.isPresent()) {
return null;
} else {
PathEntity var11 = (PathEntity) var10.get();
return var11;
}
}
use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerNavigation method b2.
private PathEntity b2(BlockPosition paramBlockPosition) {
if (!b()) {
return null;
}
if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.q))) {
return this.c;
}
this.q = paramBlockPosition;
float f1 = i();
this.b.methodProfiler.a("pathfind");
BlockPosition localBlockPosition = new BlockPosition(this.a);
int i1 = (int) (f1 + 8.0F);
ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
PathEntity localPathEntity = this.r.a(localChunkCache, this.a, this.q, f1);
this.b.methodProfiler.b();
return localPathEntity;
}
Aggregations