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 = b(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
Block localObject = paramIBlockAccess.getType(new BlockPosition(paramInt1, paramInt2 - 1, paramInt3)).getBlock();
PathType localPathType2 = b(paramIBlockAccess, paramInt1, paramInt2 - 1, paramInt3);
localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
if ((localPathType2 == PathType.DAMAGE_FIRE) || (localObject == Blocks.df)) {
localPathType1 = PathType.DAMAGE_FIRE;
}
if (localPathType2 == PathType.DAMAGE_CACTUS) {
localPathType1 = PathType.DAMAGE_CACTUS;
}
}
Object localObject = BlockPosition.PooledBlockPosition.s();
if (localPathType1 == PathType.WALKABLE) {
for (int i = -1; i <= 1; i++) {
for (int k = -1; k <= 1; k++) {
if ((i != 0) || (k != 0)) {
Block localBlock = paramIBlockAccess.getType(((BlockPosition.PooledBlockPosition) localObject).f(i + paramInt1, paramInt2, k + paramInt3)).getBlock();
if (localBlock == Blocks.CACTUS) {
localPathType1 = PathType.DANGER_CACTUS;
} else if (localBlock == Blocks.FIRE) {
localPathType1 = PathType.DANGER_FIRE;
}
}
}
}
}
((BlockPosition.PooledBlockPosition) localObject).t();
return localPathType1;
}
use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
private boolean a(int var0, int var1, int var2, int var3, int var4, int var5, Vec3D var6, double var7, double var9) {
int var11 = var0 - var3 / 2;
int var12 = var2 - var5 / 2;
if (!b(var11, var1, var12, var3, var4, var5, var6, var7, var9))
return false;
for (int var13 = var11; var13 < var11 + var3; var13++) {
for (int var14 = var12; var14 < var12 + var5; var14++) {
double var15 = var13 + 0.5D - var6.x;
double var17 = var14 + 0.5D - var6.z;
if (var15 * var7 + var17 * var9 >= 0.0D) {
PathType var19 = this.o.a(this.b, var13, var1 - 1, var14, this.a, var3, var4, var5, true, true);
if (!a(var19))
return false;
var19 = this.o.a(this.b, var13, var1, var14, this.a, var3, var4, var5, true, true);
float var20 = this.a.a(var19);
if (var20 < 0.0F || var20 >= 8.0F)
return false;
if (var19 == PathType.DAMAGE_FIRE || var19 == PathType.DANGER_FIRE || var19 == 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.
private PathPoint a(int var0, int var1, int var2, int var3, double var4, EnumDirection var6, PathType var7) {
PathPoint var8 = null;
BlockPosition.MutableBlockPosition var9 = new BlockPosition.MutableBlockPosition();
double var10 = aa(this.a, var9.d(var0, var1, var2));
if (var10 - var4 > 1.125D)
return null;
PathType var12 = a(this.b, var0, var1, var2);
float var13 = this.b.a(var12);
double var14 = this.b.getWidth() / 2.0D;
if (var13 >= 0.0F) {
var8 = a(var0, var1, var2);
var8.l = var12;
var8.k = Math.max(var8.k, var13);
}
if (var7 == PathType.FENCE && var8 != null && var8.k >= 0.0F && !a(var8))
var8 = null;
if (var12 == PathType.WALKABLE)
return var8;
if ((var8 == null || var8.k < 0.0F) && var3 > 0 && var12 != PathType.FENCE && var12 != PathType.UNPASSABLE_RAIL && var12 != PathType.TRAPDOOR) {
var8 = a(var0, var1 + 1, var2, var3 - 1, var4, var6, var7);
if (var8 != null && (var8.l == PathType.OPEN || var8.l == PathType.WALKABLE) && this.b.getWidth() < 1.0F) {
double var16 = (var0 - var6.getAdjacentX()) + 0.5D;
double var18 = (var2 - var6.getAdjacentZ()) + 0.5D;
AxisAlignedBB var20 = new AxisAlignedBB(var16 - var14, aa(this.a, var9.c(var16, (var1 + 1), var18)) + 0.001D, var18 - var14, var16 + var14, this.b.getHeight() + aa(this.a, var9.c(var8.a, var8.b, var8.c)) - 0.002D, var18 + var14);
if (a(var20))
var8 = null;
}
}
if (var12 == PathType.WATER && !e()) {
if (a(this.b, var0, var1 - 1, var2) != PathType.WATER)
return var8;
while (var1 > 0) {
var1--;
var12 = a(this.b, var0, var1, var2);
if (var12 == PathType.WATER) {
var8 = a(var0, var1, var2);
var8.l = var12;
var8.k = Math.max(var8.k, this.b.a(var12));
continue;
}
return var8;
}
}
if (var12 == PathType.OPEN) {
int var16 = 0;
int var17 = var1;
while (var12 == PathType.OPEN) {
var1--;
if (var1 < 0) {
PathPoint var18 = a(var0, var17, var2);
var18.l = PathType.BLOCKED;
var18.k = -1.0F;
return var18;
}
if (var16++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
PathPoint var18 = a(var0, var1, var2);
var18.l = PathType.BLOCKED;
var18.k = -1.0F;
return var18;
}
var12 = a(this.b, var0, var1, var2);
var13 = this.b.a(var12);
if (var12 != PathType.OPEN && var13 >= 0.0F) {
var8 = a(var0, var1, var2);
var8.l = var12;
var8.k = Math.max(var8.k, var13);
break;
}
if (var13 < 0.0F) {
PathPoint var18 = a(var0, var1, var2);
var18.l = PathType.BLOCKED;
var18.k = -1.0F;
return var18;
}
}
}
if (var12 == PathType.FENCE) {
var8 = a(var0, var1, var2);
var8.i = true;
var8.l = var12;
var8.k = var12.a();
}
return var8;
}
use of net.minecraft.server.v1_15_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 = a(this.b, var1.a, var1.b + 1, var1.c);
PathType var5 = a(this.b, var1.a, var1.b, var1.c);
if (this.b.a(var4) >= 0.0F && var5 != PathType.STICKY_HONEY)
var3 = MathHelper.d(Math.max(1.0F, this.b.G));
double var6 = aa(this.a, new BlockPosition(var1.a, var1.b, var1.c));
PathPoint var8 = a(var1.a, var1.b, var1.c + 1, var3, var6, EnumDirection.SOUTH, var5);
if (a(var8, var1))
var0[var2++] = var8;
PathPoint var9 = a(var1.a - 1, var1.b, var1.c, var3, var6, EnumDirection.WEST, var5);
if (a(var9, var1))
var0[var2++] = var9;
PathPoint var10 = a(var1.a + 1, var1.b, var1.c, var3, var6, EnumDirection.EAST, var5);
if (a(var10, var1))
var0[var2++] = var10;
PathPoint var11 = a(var1.a, var1.b, var1.c - 1, var3, var6, EnumDirection.NORTH, var5);
if (a(var11, var1))
var0[var2++] = var11;
PathPoint var12 = a(var1.a - 1, var1.b, var1.c - 1, var3, var6, EnumDirection.NORTH, var5);
if (a(var1, var9, var11, var12))
var0[var2++] = var12;
PathPoint var13 = a(var1.a + 1, var1.b, var1.c - 1, var3, var6, EnumDirection.NORTH, var5);
if (a(var1, var10, var11, var13))
var0[var2++] = var13;
PathPoint var14 = a(var1.a - 1, var1.b, var1.c + 1, var3, var6, EnumDirection.SOUTH, var5);
if (a(var1, var9, var8, var14))
var0[var2++] = var14;
PathPoint var15 = a(var1.a + 1, var1.b, var1.c + 1, var3, var6, EnumDirection.SOUTH, var5);
if (a(var1, var10, var8, var15))
var0[var2++] = var15;
return var2;
}
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, EntityHumanNPC var4, int var5, int var6, int var7, boolean var8, boolean var9) {
EnumSet<PathType> var10 = EnumSet.noneOf(PathType.class);
PathType var11 = PathType.BLOCKED;
BlockPosition var12 = var4.getChunkCoordinates();
var11 = a(var0, var1, var2, var3, var5, var6, var7, var8, var9, var10, var11, var12);
if (var10.contains(PathType.FENCE))
return PathType.FENCE;
if (var10.contains(PathType.UNPASSABLE_RAIL))
return PathType.UNPASSABLE_RAIL;
PathType var13 = PathType.BLOCKED;
for (PathType var15 : var10) {
if (var4.a(var15) < 0.0F)
return var15;
if (var4.a(var15) >= var4.a(var13))
var13 = var15;
}
if (var11 == PathType.OPEN && var4.a(var13) == 0.0F && var5 <= 1)
return PathType.OPEN;
return var13;
}
Aggregations