use of net.minecraft.server.v1_13_R2.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_13_R2.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
protected PathType b(IBlockAccess var1, int var2, int var3, int var4) {
BlockPosition var5 = new BlockPosition(var2, var3, var4);
IBlockData var6 = var1.getType(var5);
Block var7 = var6.getBlock();
Material var8 = var6.getMaterial();
if (var6.isAir()) {
return PathType.OPEN;
} else if (var7 != Blocks.OAK_TRAPDOOR && var7 != Blocks.IRON_TRAPDOOR && var7 != Blocks.LILY_PAD) {
if (var7 == Blocks.FIRE) {
return PathType.DAMAGE_FIRE;
} else if (var7 == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS;
} else if (var7 instanceof BlockDoor && var8 == Material.WOOD && !var6.get(BlockDoor.OPEN).booleanValue()) {
return PathType.DOOR_WOOD_CLOSED;
} else if (var7 instanceof BlockDoor && var8 == Material.ORE && !var6.get(BlockDoor.OPEN).booleanValue()) {
return PathType.DOOR_IRON_CLOSED;
} else if (var7 instanceof BlockDoor && var6.get(BlockDoor.OPEN).booleanValue()) {
return PathType.DOOR_OPEN;
} else if (var7 instanceof BlockMinecartTrackAbstract) {
return PathType.RAIL;
} else if (var7 instanceof BlockFence || var7 instanceof BlockCobbleWall || var7 instanceof BlockFenceGate && !var6.get(BlockFenceGate.OPEN).booleanValue()) {
return PathType.FENCE;
} else {
Fluid var9;
try {
var9 = var1.getFluid(var5);
} catch (NoSuchMethodError ex) {
try {
var9 = (Fluid) GET_FLUID.invoke(var1, var5);
} catch (Throwable ex2) {
ex2.printStackTrace();
return PathType.BLOCKED;
}
}
if (var9.a(TagsFluid.WATER)) {
return PathType.WATER;
} else if (var9.a(TagsFluid.LAVA)) {
return PathType.LAVA;
} else {
return var6.a(var1, var5, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
}
}
} else {
return PathType.TRAPDOOR;
}
}
use of net.minecraft.server.v1_13_R2.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_13_R2.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_13_R2.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public static PathType a(IBlockAccess var0, BlockPosition.MutableBlockPosition var1) {
int var2 = var1.getX();
int var3 = var1.getY();
int var4 = var1.getZ();
PathType var5 = b(var0, var1);
if (var5 == PathType.OPEN && var3 >= 1) {
PathType var6 = b(var0, var1.d(var2, var3 - 1, var4));
var5 = (var6 == PathType.WALKABLE || var6 == PathType.OPEN || var6 == PathType.WATER || var6 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
if (var6 == PathType.DAMAGE_FIRE)
var5 = PathType.DAMAGE_FIRE;
if (var6 == PathType.DAMAGE_CACTUS)
var5 = PathType.DAMAGE_CACTUS;
if (var6 == PathType.DAMAGE_OTHER)
var5 = PathType.DAMAGE_OTHER;
if (var6 == PathType.STICKY_HONEY)
var5 = PathType.STICKY_HONEY;
}
if (var5 == PathType.WALKABLE)
var5 = a(var0, var1.d(var2, var3, var4), var5);
return var5;
}
Aggregations