use of net.minecraft.server.v1_16_R3.BlockPosition 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.BlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
BlockPosition.MutableBlockPosition var1 = new BlockPosition.MutableBlockPosition();
int var0 = MathHelper.floor(this.b.locY());
IBlockData var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
if (this.b.a(var2.getFluid().getType())) {
while (this.b.a(var2.getFluid().getType())) {
var0++;
var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
}
var0--;
} else if (e() && this.b.isInWater()) {
while (var2.getBlock() == Blocks.WATER || var2.getFluid() == FluidTypes.WATER.a(false)) {
var0++;
var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
}
var0--;
} else if (this.b.isOnGround()) {
var0 = MathHelper.floor(this.b.locY() + 0.5D);
} else {
BlockPosition blockPosition = this.b.getChunkCoordinates();
while ((this.a.getType(blockPosition).isAir() || this.a.getType(blockPosition).a(this.a, blockPosition, PathMode.LAND)) && blockPosition.getY() > 0) blockPosition = blockPosition.down();
var0 = blockPosition.up().getY();
}
BlockPosition var3 = this.b.getChunkCoordinates();
PathType var4 = a(this.b, var3.getX(), var0, var3.getZ());
if (this.b.a(var4) < 0.0F) {
AxisAlignedBB axisAlignedBB = this.b.getBoundingBox();
if (b(var1.c(axisAlignedBB.minX, var0, axisAlignedBB.minZ)) || b(var1.c(axisAlignedBB.minX, var0, axisAlignedBB.maxZ)) || b(var1.c(axisAlignedBB.maxX, var0, axisAlignedBB.minZ)) || b(var1.c(axisAlignedBB.maxX, var0, axisAlignedBB.maxZ))) {
PathPoint var6 = a(var1);
var6.l = a(this.b, var6.a());
var6.k = this.b.a(var6.l);
return var6;
}
}
PathPoint var5 = a(var3.getX(), var0, var3.getZ());
var5.l = a(this.b, var5.a());
var5.k = this.b.a(var5.l);
return var5;
}
use of net.minecraft.server.v1_16_R3.BlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public PathType a(IBlockAccess var0, int var1, int var2, int var3, int var4, int var5, int var6, boolean var7, boolean var8, EnumSet<PathType> var9, PathType var10, BlockPosition var11) {
for (int var12 = 0; var12 < var4; var12++) {
for (int var13 = 0; var13 < var5; var13++) {
for (int var14 = 0; var14 < var6; var14++) {
int var15 = var12 + var1;
int var16 = var13 + var2;
int var17 = var14 + var3;
PathType var18 = a(var0, var15, var16, var17);
var18 = a(var0, var7, var8, var11, var18);
if (var12 == 0 && var13 == 0 && var14 == 0)
var10 = var18;
var9.add(var18);
}
}
}
return var10;
}
use of net.minecraft.server.v1_16_R3.BlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess var0, int var1, int var2, int var3, EntityInsentient var4, int var5, int var6, int var7, boolean var8, boolean var9) {
EnumSet<PathType> var10 = EnumSet.noneOf(PathType.class);
PathType var11 = PathType.BLOCKED;
BlockPosition var12 = var4.getChunkCoordinates();
var11 = a(var0, var1, var2, var3, var5, var6, var7, var8, var9, var10, var11, var12);
if (var10.contains(PathType.FENCE))
return PathType.FENCE;
if (var10.contains(PathType.UNPASSABLE_RAIL))
return PathType.UNPASSABLE_RAIL;
PathType var13 = PathType.BLOCKED;
for (PathType var15 : var10) {
if (var4.a(var15) < 0.0F)
return var15;
if (var4.a(var15) >= var4.a(var13))
var13 = var15;
}
if (var11 == PathType.OPEN && var4.a(var13) == 0.0F && var5 <= 1)
return PathType.OPEN;
return var13;
}
use of net.minecraft.server.v1_16_R3.BlockPosition in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
protected static PathType b(IBlockAccess var0, BlockPosition var1) {
IBlockData var2 = var0.getType(var1);
Block var3 = var2.getBlock();
Material var4 = var2.getMaterial();
if (var2.isAir())
return PathType.OPEN;
if (var2.a(TagsBlock.TRAPDOORS) || var2.a(Blocks.LILY_PAD))
return PathType.TRAPDOOR;
if (var2.a(Blocks.CACTUS))
return PathType.DAMAGE_CACTUS;
if (var2.a(Blocks.SWEET_BERRY_BUSH))
return PathType.DAMAGE_OTHER;
if (var2.a(Blocks.HONEY_BLOCK))
return PathType.STICKY_HONEY;
if (var2.a(Blocks.COCOA))
return PathType.COCOA;
Fluid var5 = var0.getFluid(var1);
if (var5.a(TagsFluid.WATER))
return PathType.WATER;
if (var5.a(TagsFluid.LAVA))
return PathType.LAVA;
if (a(var2))
return PathType.DAMAGE_FIRE;
if (BlockDoor.l(var2) && !var2.get(BlockDoor.OPEN).booleanValue())
return PathType.DOOR_WOOD_CLOSED;
if (var3 instanceof BlockDoor && var4 == Material.ORE && !var2.get(BlockDoor.OPEN).booleanValue())
return PathType.DOOR_IRON_CLOSED;
if (var3 instanceof BlockDoor && var2.get(BlockDoor.OPEN).booleanValue())
return PathType.DOOR_OPEN;
if (var3 instanceof BlockMinecartTrackAbstract)
return PathType.RAIL;
if (var3 instanceof BlockLeaves)
return PathType.LEAVES;
if (var3.a(TagsBlock.FENCES) || var3.a(TagsBlock.WALLS) || (var3 instanceof BlockFenceGate && !var2.get(BlockFenceGate.OPEN).booleanValue()))
return PathType.FENCE;
if (!var2.a(var0, var1, PathMode.LAND))
return PathType.BLOCKED;
return PathType.OPEN;
}
Aggregations