use of com.google.cloud.vision.v1p3beta1.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 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
PathType localPathType2 = localPathType1;
while (localPathType2 == PathType.OPEN && (--paramInt2 >= 1)) {
localPathType2 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
}
localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
}
if (localPathType1 == PathType.WALKABLE) {
for (int i = paramInt1 - 1; i <= paramInt1 + 1; i++) {
for (int k = paramInt3 - 1; k <= paramInt3 + 1; k++) {
if ((i != paramInt1) || (k != paramInt3)) {
Block localBlock2 = paramIBlockAccess.getType(new BlockPosition(i, paramInt2, k)).getBlock();
if (localBlock2 == Blocks.CACTUS) {
localPathType1 = PathType.DANGER_CACTUS;
} else if (localBlock2 == Blocks.FIRE) {
localPathType1 = PathType.DANGER_FIRE;
}
}
}
}
}
return localPathType1;
}
use of com.google.cloud.vision.v1p3beta1.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) {
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();
} else {
i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
}
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 = new HashSet<BlockPosition>();
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());
}
use of com.google.cloud.vision.v1p3beta1.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method superD_.
protected void superD_() {
if (this.c != null) {
for (int var0 = 0; var0 < this.c.e(); ++var0) {
PathPoint var1 = this.c.a(var0);
PathPoint var2 = var0 + 1 < this.c.e() ? this.c.a(var0 + 1) : null;
IBlockData var3 = this.b.getType(new BlockPosition(var1.a, var1.b, var1.c));
Block var4 = var3.getBlock();
if (var4 == Blocks.CAULDRON) {
this.c.a(var0, var1.a(var1.a, var1.b + 1, var1.c));
if (var2 != null && var1.b >= var2.b) {
this.c.a(var0 + 1, var2.a(var2.a, var1.b + 1, var2.c));
}
}
}
}
}
use of com.google.cloud.vision.v1p3beta1.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public PathType a(IBlockAccess var0, int var1, int var2, int var3, PathType var4) {
if (var4 == PathType.WALKABLE) {
PooledBlockPosition var5 = PooledBlockPosition.r();
Throwable tt = null;
try {
for (int var7 = -1; var7 <= 1; ++var7) {
for (int var8 = -1; var8 <= 1; ++var8) {
if (var7 != 0 || var8 != 0) {
Block var9 = var0.getType(var5.d(var7 + var1, var2, var8 + var3)).getBlock();
if (var9 == Blocks.CACTUS) {
var4 = PathType.DANGER_CACTUS;
} else if (var9 == Blocks.FIRE) {
var4 = PathType.DANGER_FIRE;
} else if (var9 == Blocks.SWEET_BERRY_BUSH) {
var4 = PathType.DANGER_OTHER;
}
}
}
}
} catch (Throwable var18) {
tt = var18;
throw var18;
} finally {
if (var5 != null) {
if (tt != null) {
try {
var5.close();
} catch (Throwable var17) {
tt.addSuppressed(var17);
}
} else {
var5.close();
}
}
}
}
return var4;
}
use of com.google.cloud.vision.v1p3beta1.Block in project Citizens2 by CitizensDev.
the class FallingBlockController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
Block id = Blocks.STONE;
int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
// TODO: how to incorporate this - probably delete?
if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
}
final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.getBlockData());
return handle.getBukkitEntity();
}
Aggregations