use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method b.
private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
for (BlockPosition localBlockPosition : BlockPosition.a(new BlockPosition(paramInt1, paramInt2, paramInt3), new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1, paramInt3 + paramInt6 - 1))) {
double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.x;
double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.z;
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
Block localBlock = this.b.getType(localBlockPosition).getBlock();
if (!localBlock.b(this.b, localBlockPosition)) {
return false;
}
}
}
return true;
}
use of net.minecraft.server.v1_14_R1.Block 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 localBlock = 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) || (localBlock == Blocks.df)) {
localPathType1 = PathType.DAMAGE_FIRE;
}
if (localPathType2 == PathType.DAMAGE_CACTUS) {
localPathType1 = PathType.DAMAGE_CACTUS;
}
}
localPathType1 = a(paramIBlockAccess, paramInt1, paramInt2, paramInt3, localPathType1);
return localPathType1;
}
use of net.minecraft.server.v1_14_R1.Block 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_14_R1.Block 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_14_R1.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method r.
private int r() {
if ((!this.a.isInWater()) || (!g())) {
return (int) (this.a.getBoundingBox().b + 0.5D);
}
int i = (int) this.a.getBoundingBox().b;
Block localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
int j = 0;
while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
i++;
localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
j++;
if (j > 16) {
return (int) this.a.getBoundingBox().b;
}
}
return i;
}
Aggregations