use of net.minecraft.server.v1_7_R3.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, PathType paramPathType) {
BlockPosition.PooledBlockPosition localPooledBlockPosition = BlockPosition.PooledBlockPosition.s();
if (paramPathType == PathType.WALKABLE) {
for (int i = -1; i <= 1; i++) {
for (int k = -1; k <= 1; k++) {
if ((i != 0) || (k != 0)) {
Block localBlock = paramIBlockAccess.getType(localPooledBlockPosition.f(i + paramInt1, paramInt2, k + paramInt3)).getBlock();
if (localBlock == Blocks.CACTUS) {
paramPathType = PathType.DANGER_CACTUS;
} else if (localBlock == Blocks.FIRE) {
paramPathType = PathType.DANGER_FIRE;
}
}
}
}
}
localPooledBlockPosition.t();
return paramPathType;
}
use of net.minecraft.server.v1_7_R3.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());
}
use of net.minecraft.server.v1_7_R3.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathPoint a(Entity paramEntity) {
int k;
if ((this.i) && (paramEntity.V())) {
k = (int) paramEntity.getBoundingBox().b;
BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
Block localBlock = this.a.getType(localMutableBlockPosition).getBlock();
while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
k++;
localMutableBlockPosition.c(MathHelper.floor(paramEntity.locX), k, MathHelper.floor(paramEntity.locZ));
localBlock = this.a.getType(localMutableBlockPosition).getBlock();
}
this.h = false;
} else {
k = MathHelper.floor(paramEntity.getBoundingBox().b + 0.5D);
}
return a(MathHelper.floor(paramEntity.getBoundingBox().a), k, MathHelper.floor(paramEntity.getBoundingBox().c));
}
use of net.minecraft.server.v1_7_R3.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public static int a(IBlockAccess paramIBlockAccess, Entity paramEntity, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3) {
int k = 0;
BlockPosition localBlockPosition = new BlockPosition(paramEntity);
BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition();
for (int m = paramInt1; m < paramInt1 + paramInt4; m++) {
for (int n = paramInt2; n < paramInt2 + paramInt5; n++) {
for (int i1 = paramInt3; i1 < paramInt3 + paramInt6; i1++) {
localMutableBlockPosition.c(m, n, i1);
Block localBlock = paramIBlockAccess.getType(localMutableBlockPosition).getBlock();
if (localBlock.getMaterial() != Material.AIR) {
if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR)) {
k = 1;
} else if ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
if (paramBoolean1) {
return -1;
}
k = 1;
} else if ((!paramBoolean3) && ((localBlock instanceof BlockDoor)) && (localBlock.getMaterial() == Material.WOOD)) {
return 0;
}
if ((paramEntity.world.getType(localMutableBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) {
if ((!(paramEntity.world.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramEntity.world.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
return -3;
}
} else if (!localBlock.b(paramIBlockAccess, localMutableBlockPosition)) {
if ((!paramBoolean2) || (!(localBlock instanceof BlockDoor)) || (localBlock.getMaterial() != Material.WOOD)) {
if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockFenceGate)) || ((localBlock instanceof BlockCobbleWall))) {
return -3;
}
if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR)) {
return -4;
}
Material localMaterial = localBlock.getMaterial();
if (localMaterial == Material.LAVA) {
if (!paramEntity.ab()) {
return -2;
}
} else {
return 0;
}
}
}
}
}
}
}
return k != 0 ? 2 : 1;
}
use of net.minecraft.server.v1_7_R3.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB3100 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
return null;
}
// getData from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
Aggregations