use of net.minecraft.server.v1_15_R1.PathDestination in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private float a(PathPoint var0, Set<PathDestination> var1) {
float var2 = Float.MAX_VALUE;
for (PathDestination var4 : var1) {
float var5 = var0.a(var4);
var4.a(var5, var0);
var2 = Math.min(var5, var2);
}
return var2;
}
use of net.minecraft.server.v1_15_R1.PathDestination 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_15_R1.PathDestination in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private float a(PathPoint var0, Set var1) {
float var2 = Float.MAX_VALUE;
float var5;
for (Iterator var4 = var1.iterator(); var4.hasNext(); var2 = Math.min(var5, var2)) {
PathDestination var6 = (PathDestination) var4.next();
var5 = var0.a(var6);
var6.a(var5, var0);
}
return var2;
}
use of net.minecraft.server.v1_15_R1.PathDestination in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
public PathEntity a(ChunkCache var0, EntityHumanNPC var1, Set<BlockPosition> var2, float var3, int var4, float var5) {
this.a.a();
this.e.a(var0, var1);
PathPoint var6 = this.e.b();
Map<PathDestination, BlockPosition> var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
}, Function.identity()));
PathEntity var8 = this.a(var6, var7, var3, var4, var5);
this.e.a();
return var8;
}
use of net.minecraft.server.v1_15_R1.PathDestination in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
@Override
public PathEntity a(ChunkCache var0, EntityInsentient var1, Set<BlockPosition> var2, float var3, int var4, float var5) {
this.a.a();
this.e.a(var0, var1);
PathPoint var6 = this.e.b();
Map<PathDestination, BlockPosition> var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
}, Function.identity()));
PathEntity var8 = this.a(var6, var7, var3, var4, var5);
this.e.a();
return var8;
}
Aggregations