use of net.minecraft.server.v1_16_R3.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private PathPoint a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, double paramDouble, EnumDirection paramEnumDirection) {
PathPoint localPathPoint = null;
BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
BlockPosition localBlockPosition2 = localBlockPosition1.down();
double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).c(this.a, localBlockPosition2).e);
if (d1 - paramDouble > 1.0D) {
return null;
}
PathType localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
float f = this.b.a(localPathType);
double d2 = this.b.width / 2.0D;
if (f >= 0.0F) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType;
localPathPoint.l = Math.max(localPathPoint.l, f);
}
if (localPathType == PathType.WALKABLE) {
return localPathPoint;
}
if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType != PathType.FENCE) && (localPathType != PathType.TRAPDOOR)) {
localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE))) {
double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2, paramInt2 + this.b.length, d4 + d2);
AxisAlignedBB localAxisAlignedBB2 = this.a.getType(localBlockPosition1).c(this.a, localBlockPosition1);
AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.a(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
if (this.b.world.b(localAxisAlignedBB3)) {
localPathPoint = null;
}
}
}
if (localPathType == PathType.OPEN) {
AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D, paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
if (this.b.world.b(localAxisAlignedBB4)) {
return null;
}
int i = 0;
while ((paramInt2 > 0) && (localPathType == PathType.OPEN)) {
paramInt2--;
if (i++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
return null;
}
localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
f = this.b.a(localPathType);
if ((localPathType != PathType.OPEN) && (f >= 0.0F)) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType;
localPathPoint.l = Math.max(localPathPoint.l, f);
} else if (f < 0.0F) {
return null;
}
}
}
return localPathPoint;
}
use of net.minecraft.server.v1_16_R3.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private PathPoint a(int var1, int var2, int var3, int var4, double var5, EnumDirection var7) {
PathPoint var8 = null;
BlockPosition var9 = new BlockPosition(var1, var2, var3);
double var10 = a(this.a, var9);
if (var10 - var5 > 1.125D) {
return null;
} else {
PathType var12 = this.a(this.b, var1, var2, var3);
float var13 = this.b.a(var12);
double var14 = this.b.width / 2.0D;
if (var13 >= 0.0F) {
var8 = this.a(var1, var2, var3);
var8.m = var12;
var8.l = Math.max(var8.l, var13);
}
if (var12 == PathType.WALKABLE) {
return var8;
} else {
if (var8 == null && var4 > 0 && var12 != PathType.FENCE && var12 != PathType.TRAPDOOR) {
var8 = this.a(var1, var2 + 1, var3, var4 - 1, var5, var7);
if (var8 != null && (var8.m == PathType.OPEN || var8.m == PathType.WALKABLE) && this.b.width < 1.0F) {
double var16 = var1 - var7.getAdjacentX() + 0.5D;
double var18 = var3 - var7.getAdjacentZ() + 0.5D;
AxisAlignedBB var20 = new AxisAlignedBB(var16 - var14, var2 + 0.001D, var18 - var14, var16 + var14, this.b.length + a(this.a, var9.up()) - 0.002D, var18 + var14);
if (!this.b.world.getCubes((Entity) null, var20)) {
var8 = null;
}
}
}
if (var12 == PathType.WATER && !this.e()) {
if (this.a(this.b, var1, var2 - 1, var3) != PathType.WATER) {
return var8;
}
while (var2 > 0) {
--var2;
var12 = this.a(this.b, var1, var2, var3);
if (var12 != PathType.WATER) {
return var8;
}
var8 = this.a(var1, var2, var3);
var8.m = var12;
var8.l = Math.max(var8.l, this.b.a(var12));
}
}
if (var12 == PathType.OPEN) {
AxisAlignedBB var21 = new AxisAlignedBB(var1 - var14 + 0.5D, var2 + 0.001D, var3 - var14 + 0.5D, var1 + var14 + 0.5D, var2 + this.b.length, var3 + var14 + 0.5D);
if (!this.b.world.getCubes((Entity) null, var21)) {
return null;
}
if (this.b.width >= 1.0F) {
PathType var17 = this.a(this.b, var1, var2 - 1, var3);
if (var17 == PathType.BLOCKED) {
var8 = this.a(var1, var2, var3);
var8.m = PathType.WALKABLE;
var8.l = Math.max(var8.l, var13);
return var8;
}
}
int var22 = 0;
while (var2 > 0 && var12 == PathType.OPEN) {
--var2;
if (var22++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
return null;
}
var12 = this.a(this.b, var1, var2, var3);
var13 = this.b.a(var12);
if (var12 != PathType.OPEN && var13 >= 0.0F) {
var8 = this.a(var1, var2, var3);
var8.m = var12;
var8.l = Math.max(var8.l, var13);
break;
}
if (var13 < 0.0F) {
return null;
}
}
}
return var8;
}
}
}
use of net.minecraft.server.v1_16_R3.AxisAlignedBB 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.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private boolean a(PathPoint var0) {
Vec3D var1 = new Vec3D(var0.a - this.b.locX(), var0.b - this.b.locY(), var0.c - this.b.locZ());
AxisAlignedBB var2 = this.b.getBoundingBox();
int var3 = MathHelper.f(var1.f() / var2.a());
var1 = var1.a((1.0F / var3));
for (int var4 = 1; var4 <= var3; var4++) {
var2 = var2.c(var1);
if (a(var2))
return false;
}
return true;
}
use of net.minecraft.server.v1_16_R3.AxisAlignedBB in project Citizens2 by CitizensDev.
the class NMSImpl method getCollisionBox.
@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
AxisAlignedBB aabb = world.getType(pos).d(world, pos);
if (aabb == null) {
aabb = world.getType(pos).e(world, pos);
}
return new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
}
Aggregations