use of net.minecraft.server.v1_14_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_14_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_14_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<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 = 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;
}
use of net.minecraft.server.v1_14_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public PathType a(IBlockAccess var0, int var1, int var2, int var3, EntityHumanNPC var4, int var5, int var6, int var7, boolean var8, boolean var9) {
EnumSet<PathType> var10 = EnumSet.noneOf(PathType.class);
PathType var11 = PathType.BLOCKED;
double var12 = var4.getWidth() / 2.0D;
BlockPosition var14 = new BlockPosition(var4);
var11 = this.a(var0, var1, var2, var3, var5, var6, var7, var8, var9, var10, var11, var14);
if (var10.contains(PathType.FENCE)) {
return PathType.FENCE;
} else {
PathType var15 = PathType.BLOCKED;
Iterator<PathType> var17 = var10.iterator();
while (var17.hasNext()) {
PathType var18 = var17.next();
if (var4.a(var18) < 0.0F) {
return var18;
}
if (var4.a(var18) >= var4.a(var15)) {
var15 = var18;
}
}
if (var11 == PathType.OPEN && var4.a(var15) == 0.0F) {
return PathType.OPEN;
} else {
return var15;
}
}
}
use of net.minecraft.server.v1_14_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public int a(PathPoint[] var0, PathPoint var1) {
int var2 = 0;
int var3 = 0;
PathType var4 = this.a(this.b, var1.a, var1.b + 1, var1.c);
if (this.b.a(var4) >= 0.0F) {
PathType var5 = this.a(this.b, var1.a, var1.b, var1.c);
if (var5 == PathType.STICKY_HONEY) {
var3 = 0;
} else {
var3 = MathHelper.d(Math.max(1.0F, this.b.H));
}
}
double var5 = a(this.a, (new BlockPosition(var1.a, var1.b, var1.c)));
PathPoint var7 = this.a(var1.a, var1.b, var1.c + 1, var3, var5, EnumDirection.SOUTH);
if (var7 != null && !var7.i && var7.k >= 0.0F) {
var0[var2++] = var7;
}
PathPoint var8 = this.a(var1.a - 1, var1.b, var1.c, var3, var5, EnumDirection.WEST);
if (var8 != null && !var8.i && var8.k >= 0.0F) {
var0[var2++] = var8;
}
PathPoint var9 = this.a(var1.a + 1, var1.b, var1.c, var3, var5, EnumDirection.EAST);
if (var9 != null && !var9.i && var9.k >= 0.0F) {
var0[var2++] = var9;
}
PathPoint var10 = this.a(var1.a, var1.b, var1.c - 1, var3, var5, EnumDirection.NORTH);
if (var10 != null && !var10.i && var10.k >= 0.0F) {
var0[var2++] = var10;
}
PathPoint var11 = this.a(var1.a - 1, var1.b, var1.c - 1, var3, var5, EnumDirection.NORTH);
if (this.a(var1, var8, var10, var11)) {
var0[var2++] = var11;
}
PathPoint var12 = this.a(var1.a + 1, var1.b, var1.c - 1, var3, var5, EnumDirection.NORTH);
if (this.a(var1, var9, var10, var12)) {
var0[var2++] = var12;
}
PathPoint var13 = this.a(var1.a - 1, var1.b, var1.c + 1, var3, var5, EnumDirection.SOUTH);
if (this.a(var1, var8, var7, var13)) {
var0[var2++] = var13;
}
PathPoint var14 = this.a(var1.a + 1, var1.b, var1.c + 1, var3, var5, EnumDirection.SOUTH);
if (this.a(var1, var9, var7, var14)) {
var0[var2++] = var14;
}
return var2;
}
Aggregations