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 (!this.b(var11, var1, var12, var3, var4, var5, var6, var7, var9)) {
return false;
} else {
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 (var19 == PathType.WATER) {
return false;
}
if (var19 == PathType.LAVA) {
return false;
}
if (var19 == PathType.OPEN) {
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 c.
protected static PathType c(IBlockAccess var0, int var1, int var2, int var3) {
BlockPosition var4 = new BlockPosition(var1, var2, var3);
IBlockData var5 = var0.getType(var4);
Block var6 = var5.getBlock();
Material var7 = var5.getMaterial();
if (var5.isAir()) {
return PathType.OPEN;
} else if (!var6.a(TagsBlock.TRAPDOORS) && var6 != Blocks.LILY_PAD) {
if (var6 == Blocks.FIRE) {
return PathType.DAMAGE_FIRE;
} else if (var6 == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS;
} else if (var6 == Blocks.SWEET_BERRY_BUSH) {
return PathType.DAMAGE_OTHER;
} else if (var6 == Blocks.HONEY_BLOCK) {
return PathType.STICKY_HONEY;
} else if (var6 == Blocks.COCOA) {
return PathType.COCOA;
} else if (var6 instanceof BlockDoor && var7 == Material.WOOD && !(Boolean) var5.get(BlockDoor.OPEN)) {
return PathType.DOOR_WOOD_CLOSED;
} else if (var6 instanceof BlockDoor && var7 == Material.ORE && !(Boolean) var5.get(BlockDoor.OPEN)) {
return PathType.DOOR_IRON_CLOSED;
} else if (var6 instanceof BlockDoor && var5.get(BlockDoor.OPEN)) {
return PathType.DOOR_OPEN;
} else if (var6 instanceof BlockMinecartTrackAbstract) {
return PathType.RAIL;
} else if (var6 instanceof BlockLeaves) {
return PathType.LEAVES;
} else if (var6.a(TagsBlock.FENCES) || var6.a(TagsBlock.WALLS) || var6 instanceof BlockFenceGate && !(Boolean) var5.get(BlockFenceGate.OPEN)) {
return PathType.FENCE;
} else {
Fluid var8 = var0.getFluid(var4);
if (var8.a(TagsFluid.WATER)) {
return PathType.WATER;
} else if (var8.a(TagsFluid.LAVA)) {
return PathType.LAVA;
} else {
return var5.a(var0, var4, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
}
}
} else {
return PathType.TRAPDOOR;
}
}
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;
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_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 = 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;
}
use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public static PathType a(IBlockAccess var0, int var1, int var2, int var3, PathType var4) {
PooledBlockPosition var5 = PooledBlockPosition.r();
Throwable var6 = null;
try {
for (int var7 = -1; var7 <= 1; ++var7) {
for (int var8 = -1; var8 <= 1; ++var8) {
for (int var9 = -1; var9 <= 1; ++var9) {
if (var7 != 0 || var9 != 0) {
Block var10 = var0.getType(var5.d(var7 + var1, var8 + var2, var9 + var3)).getBlock();
if (var10 == Blocks.CACTUS) {
var4 = PathType.DANGER_CACTUS;
} else if (var10 != Blocks.FIRE && var10 != Blocks.LAVA) {
if (var10 == Blocks.SWEET_BERRY_BUSH) {
var4 = PathType.DANGER_OTHER;
}
} else {
var4 = PathType.DANGER_FIRE;
}
}
}
}
}
} catch (Throwable var18) {
var6 = var18;
throw var18;
} finally {
if (var5 != null) {
if (var6 != null) {
try {
var5.close();
} catch (Throwable var17) {
var6.addSuppressed(var17);
}
} else {
var5.close();
}
}
}
return var4;
}
Aggregations