use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class NMSImpl method getTargetNavigator.
@Override
public MCNavigator getTargetNavigator(org.bukkit.entity.Entity entity, Iterable<Vector> dest, final NavigatorParameters params) {
List<PathPoint> list = Lists.<PathPoint>newArrayList(Iterables.<Vector, PathPoint>transform(dest, new Function<Vector, PathPoint>() {
@Override
public PathPoint apply(Vector input) {
return new PathPoint(input.getBlockX(), input.getBlockY(), input.getBlockZ());
}
}));
PathPoint last = list.size() > 0 ? list.get(list.size() - 1) : null;
final PathEntity path = new PathEntity(list, last != null ? new BlockPosition(last.a, last.b, last.c) : null, true);
return getTargetNavigator(entity, params, new Function<NavigationAbstract, Boolean>() {
@Override
public Boolean apply(NavigationAbstract input) {
return input.a(path, params.speed());
}
});
}
use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
protected PathEntity a(Set<BlockPosition> var0, int var1, boolean var2, int var3) {
if (var0.isEmpty())
return null;
if (this.a.locY() < 0.0D)
return null;
if (!a())
return null;
if (this.c != null && !this.c.c() && var0.contains(this.p))
return this.c;
this.b.getMethodProfiler().enter("pathfind");
float var4 = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
BlockPosition var5 = var2 ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
int var6 = (int) (var4 + var1);
ChunkCache var7 = new ChunkCache(this.b, var5.b(-var6, -var6, -var6), var5.b(var6, var6, var6));
PathEntity var8 = this.s.a(var7, this.a, var0, var4, var3, this.r);
this.b.getMethodProfiler().exit();
if (var8 != null && var8.m() != null) {
this.p = var8.m();
this.q = var3;
e();
}
return var8;
}
use of net.minecraft.server.v1_16_R3.PathEntity in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
public PathEntity a(BlockPosition var0, int var1) {
if (this.b.getType(var0).isAir()) {
BlockPosition var2 = var0.down();
while (var2.getY() > 0 && this.b.getType(var2).isAir()) var2 = var2.down();
if (var2.getY() > 0)
return supera(var2.up(), var1);
while (var2.getY() < this.b.getBuildHeight() && this.b.getType(var2).isAir()) var2 = var2.up();
var0 = var2;
}
if (this.b.getType(var0).getMaterial().isBuildable()) {
BlockPosition var2 = var0.up();
while (var2.getY() < this.b.getBuildHeight() && this.b.getType(var2).getMaterial().isBuildable()) var2 = var2.up();
return supera(var2, var1);
}
return supera(var0, var1);
}
use of net.minecraft.server.v1_16_R3.PathEntity 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_16_R3.PathEntity 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