use of net.minecraft.server.v1_10_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private PathEntity a(IBlockAccess paramIBlockAccess, EntityHumanNPC paramEntityInsentient, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat) {
this.a.a();
this.d.a(paramIBlockAccess, paramEntityInsentient);
PathPoint localPathPoint1 = this.d.b();
PathPoint localPathPoint2 = this.d.a(paramDouble1, paramDouble2, paramDouble3);
PathEntity localPathEntity = a(localPathPoint1, localPathPoint2, paramFloat);
this.d.a();
return localPathEntity;
}
use of net.minecraft.server.v1_10_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2, float paramFloat) {
paramPathPoint1.e = 0.0F;
paramPathPoint1.f = paramPathPoint1.c(paramPathPoint2);
paramPathPoint1.g = paramPathPoint1.f;
this.a.a();
this.b.clear();
this.a.a(paramPathPoint1);
Object localObject1 = paramPathPoint1;
int i = 0;
while (!this.a.e()) {
i++;
if (i >= 200) {
break;
}
PathPoint localObject2 = this.a.c();
if (localObject2.equals(paramPathPoint2)) {
localObject1 = paramPathPoint2;
break;
}
if (localObject2.c(paramPathPoint2) < ((PathPoint) localObject1).c(paramPathPoint2)) {
localObject1 = localObject2;
}
localObject2.i = true;
int j = this.d.a(this.c, localObject2, paramPathPoint2, paramFloat);
for (int k = 0; k < j; k++) {
PathPoint localPathPoint = this.c[k];
float f1 = localObject2.c(localPathPoint);
localPathPoint.j = (localObject2.j + f1);
localPathPoint.k = (f1 + localPathPoint.l);
float f2 = localObject2.e + localPathPoint.k;
if ((localPathPoint.j < paramFloat) && ((!localPathPoint.a()) || (f2 < localPathPoint.e))) {
localPathPoint.h = (localObject2);
localPathPoint.e = f2;
localPathPoint.f = (localPathPoint.c(paramPathPoint2) + localPathPoint.l);
if (localPathPoint.a()) {
this.a.a(localPathPoint, localPathPoint.e + localPathPoint.f);
} else {
localPathPoint.g = (localPathPoint.e + localPathPoint.f);
this.a.a(localPathPoint);
}
}
}
}
if (localObject1 == paramPathPoint1) {
return null;
}
Object localObject2 = a(paramPathPoint1, (PathPoint) localObject1);
return (PathEntity) localObject2;
}
use of net.minecraft.server.v1_10_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinderAbstract method a.
@Override
protected PathPoint a(int paramInt1, int paramInt2, int paramInt3) {
int j = PathPoint.b(paramInt1, paramInt2, paramInt3);
PathPoint localPathPoint = this.c.get(j);
if (localPathPoint == null) {
localPathPoint = new PathPoint(paramInt1, paramInt2, paramInt3);
this.c.a(j, localPathPoint);
}
return localPathPoint;
}
use of net.minecraft.server.v1_10_R1.PathPoint 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).e(this.a, localBlockPosition2).e);
if (d1 - paramDouble > 1.125D) {
return null;
}
PathType localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
float f = this.b.a(localPathType1);
double d2 = this.b.width / 2.0D;
if (f >= 0.0F) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType1;
localPathPoint.l = Math.max(localPathPoint.l, f);
}
if (localPathType1 == PathType.WALKABLE) {
return localPathPoint;
}
if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType1 != PathType.FENCE) && (localPathType1 != PathType.TRAPDOOR)) {
localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE)) && (this.b.width < 1.0F)) {
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).e(this.a, localBlockPosition1);
AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.b(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
if (this.b.world.a(localAxisAlignedBB3)) {
localPathPoint = null;
}
}
}
if (localPathType1 == 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.a(localAxisAlignedBB4)) {
return null;
}
if (this.b.width >= 1.0F) {
PathType localPathType2 = a(this.b, paramInt1, paramInt2 - 1, paramInt3);
if (localPathType2 == PathType.BLOCKED) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = PathType.WALKABLE;
localPathPoint.l = Math.max(localPathPoint.l, f);
return localPathPoint;
}
}
int i = 0;
while ((paramInt2 > 0) && (localPathType1 == PathType.OPEN)) {
paramInt2--;
if (i++ >= this.b.bg()) {
return null;
}
localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
f = this.b.a(localPathType1);
if ((localPathType1 != PathType.OPEN) && (f >= 0.0F)) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType1;
localPathPoint.l = Math.max(localPathPoint.l, f);
} else if (f < 0.0F) {
return null;
}
}
}
return localPathPoint;
}
use of net.minecraft.server.v1_10_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public int a(PathPoint[] paramArrayOfPathPoint, PathPoint paramPathPoint1, PathPoint paramPathPoint2, float paramFloat) {
int i = 0;
int k = 0;
PathType localPathType = a(this.b, paramPathPoint1.a, paramPathPoint1.b + 1, paramPathPoint1.c);
if (this.b.a(localPathType) >= 0.0F) {
k = MathHelper.d(Math.max(1.0F, this.b.P));
}
BlockPosition localBlockPosition = new BlockPosition(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c).down();
double d = paramPathPoint1.b - (1.0D - this.a.getType(localBlockPosition).e(this.a, localBlockPosition).e);
PathPoint localPathPoint1 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
PathPoint localPathPoint2 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c, k, d, EnumDirection.WEST);
PathPoint localPathPoint3 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c, k, d, EnumDirection.EAST);
PathPoint localPathPoint4 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
if ((localPathPoint1 != null) && (!localPathPoint1.i) && (localPathPoint1.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint1;
}
if ((localPathPoint2 != null) && (!localPathPoint2.i) && (localPathPoint2.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint2;
}
if ((localPathPoint3 != null) && (!localPathPoint3.i) && (localPathPoint3.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint3;
}
if ((localPathPoint4 != null) && (!localPathPoint4.i) && (localPathPoint4.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint4;
}
int m = (localPathPoint4 == null) || (localPathPoint4.m == PathType.OPEN) || (localPathPoint4.l != 0.0F) ? 1 : 0;
int n = (localPathPoint1 == null) || (localPathPoint1.m == PathType.OPEN) || (localPathPoint1.l != 0.0F) ? 1 : 0;
int i1 = (localPathPoint3 == null) || (localPathPoint3.m == PathType.OPEN) || (localPathPoint3.l != 0.0F) ? 1 : 0;
int i2 = (localPathPoint2 == null) || (localPathPoint2.m == PathType.OPEN) || (localPathPoint2.l != 0.0F) ? 1 : 0;
PathPoint localPathPoint5;
if ((m != 0) && (i2 != 0)) {
localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint5;
}
}
if ((m != 0) && (i1 != 0)) {
localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint5;
}
}
if ((n != 0) && (i2 != 0)) {
localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint5;
}
}
if ((n != 0) && (i1 != 0)) {
localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
paramArrayOfPathPoint[(i++)] = localPathPoint5;
}
}
return i;
}
Aggregations