use of net.minecraft.server.v1_11_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
int i;
BlockPosition localObject1;
if ((e()) && (this.b.isInWater())) {
i = (int) this.b.getBoundingBox().b;
localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
Block localObject2 = this.a.getType(localObject1).getBlock();
while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
i++;
((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
localObject2 = this.a.getType(localObject1).getBlock();
}
} else if (this.b.onGround) {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
} else {
localObject1 = new BlockPosition(this.b);
while (((this.a.getType(localObject1).getMaterial() == Material.AIR) || (this.a.getType(localObject1).getBlock().b(this.a, localObject1))) && (localObject1.getY() > 0)) {
localObject1 = localObject1.down();
}
i = localObject1.up().getY();
}
localObject1 = new BlockPosition(this.b);
Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
if (this.b.a((PathType) localObject2) < 0.0F) {
HashSet<BlockPosition> localHashSet = Sets.newHashSet();
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
for (BlockPosition localBlockPosition : localHashSet) {
PathType localPathType = a(this.b, localBlockPosition);
if (this.b.a(localPathType) >= 0.0F) {
return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
}
}
}
return a(localObject1.getX(), i, localObject1.getZ());
}
use of net.minecraft.server.v1_11_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private PathPoint a(Entity paramEntity, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
PathPoint localPathPoint = null;
int k = a(paramEntity, paramInt1, paramInt2, paramInt3);
if (k == 2) {
return a(paramInt1, paramInt2, paramInt3);
}
if (k == 1) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
}
if ((localPathPoint == null) && (paramInt4 > 0) && (k != -3) && (k != -4) && (a(paramEntity, paramInt1, paramInt2 + paramInt4, paramInt3) == 1)) {
localPathPoint = a(paramInt1, paramInt2 + paramInt4, paramInt3);
paramInt2 += paramInt4;
}
if (localPathPoint != null) {
int m = 0;
int n = 0;
while (paramInt2 > 0) {
n = a(paramEntity, paramInt1, paramInt2 - 1, paramInt3);
if ((this.h) && (n == -1)) {
return null;
}
if (n == 1) {
if (m++ >= paramEntity.aE()) {
return null;
}
paramInt2--;
if (paramInt2 > 0) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
} else {
return null;
}
}
}
if (n == -2) {
return null;
}
}
return localPathPoint;
}
use of net.minecraft.server.v1_11_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathPoint a(Entity paramEntity) {
int k;
if ((this.i) && (paramEntity.V())) {
k = (int) paramEntity.getBoundingBox().b;
BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
Block localBlock = this.a.getType(localMutableBlockPosition).getBlock();
while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
k++;
localMutableBlockPosition.c(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
localBlock = this.a.getType(localMutableBlockPosition).getBlock();
}
this.h = false;
} else {
k = MathHelper.floor(paramEntity.getBoundingBox().b + 0.5D);
}
return a(MathHelper.floor(paramEntity.getBoundingBox().a), k, MathHelper.floor(paramEntity.getBoundingBox().c));
}
use of net.minecraft.server.v1_11_R1.PathPoint in project Citizens2 by CitizensDev.
the class PlayerPathfinder method a.
private PathEntity a(PathPoint paramPathPoint1, PathPoint paramPathPoint2) {
int i = 1;
PathPoint localPathPoint = paramPathPoint2;
while (localPathPoint.h != null) {
i++;
localPathPoint = localPathPoint.h;
}
PathPoint[] arrayOfPathPoint = new PathPoint[i];
localPathPoint = paramPathPoint2;
arrayOfPathPoint[(--i)] = localPathPoint;
while (localPathPoint.h != null) {
localPathPoint = localPathPoint.h;
arrayOfPathPoint[(--i)] = localPathPoint;
}
return new PathEntity(arrayOfPathPoint);
}
use of net.minecraft.server.v1_11_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;
}
Aggregations