use of net.minecraft.server.v1_14_R1.Block 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;
}
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 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;
}
use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method d.
@Override
protected void d() {
PathPoint localPathPoint;
for (int i = 0; i < this.c.d(); i++) {
localPathPoint = this.c.a(i);
Object localObject = i + 1 < this.c.d() ? this.c.a(i + 1) : null;
IBlockData localIBlockData = this.b.getType(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c));
Block localBlock = localIBlockData.getBlock();
if (localBlock == Blocks.cauldron) {
this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1, ((PathPoint) localObject).c));
}
}
}
if (this.f2) {
if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D), MathHelper.floor(this.a.locZ)))) {
return;
}
for (int i = 0; i < this.c.d(); i++) {
localPathPoint = this.c.a(i);
if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
this.c.b(i - 1);
return;
}
}
}
}
use of net.minecraft.server.v1_14_R1.Block 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) {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
} else {
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();
}
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 = Sets.newHashSet();
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());
}
Aggregations