use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
int var1;
BlockPosition var2;
BoundingBox bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
if (this.e() && this.b.isInWater()) {
var1 = (int) bb.minY;
MutableBlockPosition var8 = new MutableBlockPosition(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
for (Block var3 = this.a.getType(var8).getBlock(); var3 == Blocks.WATER; var3 = this.a.getType(var8).getBlock()) {
++var1;
var8.c(MathHelper.floor(this.b.locX), var1, MathHelper.floor(this.b.locZ));
}
} else if (this.b.onGround) {
var1 = MathHelper.floor(bb.minY + 0.5D);
} else {
for (var2 = new BlockPosition(this.b); (this.a.getType(var2).isAir() || this.a.getType(var2).a(this.a, var2, PathMode.LAND)) && var2.getY() > 0; var2 = var2.down()) {
;
}
var1 = var2.up().getY();
}
var2 = new BlockPosition(this.b);
PathType var9 = this.a(this.b, var2.getX(), var1, var2.getZ());
if (this.b.a(var9) < 0.0F) {
HashSet var4 = Sets.newHashSet();
bb = NMSBoundingBox.wrap(this.b.getBoundingBox());
var4.add(new BlockPosition(bb.minX, var1, bb.minZ));
var4.add(new BlockPosition(bb.minX, var1, bb.maxZ));
var4.add(new BlockPosition(bb.maxX, var1, bb.minZ));
var4.add(new BlockPosition(bb.maxX, var1, bb.maxZ));
Iterator var5 = var4.iterator();
while (var5.hasNext()) {
BlockPosition var6 = (BlockPosition) var5.next();
PathType var7 = this.a(this.b, var6);
if (this.b.a(var7) >= 0.0F) {
return this.a(var6.getX(), var6.getY(), var6.getZ());
}
}
}
return this.a(var2.getX(), var1, var2.getZ());
}
use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
int i = paramInt1 - paramInt4 / 2;
int j = paramInt3 - paramInt6 / 2;
if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
return false;
}
for (int k = i; k < i + paramInt4; k++) {
for (int m = j; m < j + paramInt6; m++) {
double d1 = k + 0.5D - paramVec3D.x;
double d2 = m + 0.5D - paramVec3D.z;
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
PathType localPathType = this.e.a(this.b, k, paramInt2 - 1, m, this.a, paramInt4, paramInt5, paramInt6, true, true);
if (localPathType == PathType.WATER) {
return false;
}
if (localPathType == PathType.LAVA) {
return false;
}
if (localPathType == PathType.OPEN) {
return false;
}
localPathType = this.e.a(this.b, k, paramInt2, m, this.a, paramInt4, paramInt5, paramInt6, true, true);
float f1 = this.a.a(localPathType);
if ((f1 < 0.0F) || (f1 >= 8.0F)) {
return false;
}
if ((localPathType == PathType.DAMAGE_FIRE) || (localPathType == PathType.DANGER_FIRE) || (localPathType == PathType.DAMAGE_OTHER)) {
return false;
}
}
}
}
return true;
}
use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
PathType localPathType1 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
PathType localPathType2 = localPathType1;
while (localPathType2 == PathType.OPEN && (--paramInt2 >= 1)) {
localPathType2 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
}
localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
}
if (localPathType1 == PathType.WALKABLE) {
for (int i = paramInt1 - 1; i <= paramInt1 + 1; i++) {
for (int k = paramInt3 - 1; k <= paramInt3 + 1; k++) {
if ((i != paramInt1) || (k != paramInt3)) {
Block localBlock2 = paramIBlockAccess.getType(new BlockPosition(i, paramInt2, k)).getBlock();
if (localBlock2 == Blocks.CACTUS) {
localPathType1 = PathType.DANGER_CACTUS;
} else if (localBlock2 == Blocks.FIRE) {
localPathType1 = PathType.DANGER_FIRE;
}
}
}
}
}
return localPathType1;
}
use of net.minecraft.server.v1_15_R1.PathType 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) {
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();
} else {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
}
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 = new HashSet<BlockPosition>();
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_15_R1.PathType 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 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 = this.a(var0, var15, var16, var17);
var18 = this.a(var0, var7, var8, var11, var18);
if (var12 == 0 && var13 == 0 && var14 == 0) {
var10 = var18;
}
var9.add(var18);
}
}
}
return var10;
}
Aggregations