use of net.minecraft.block.state.BlockFaceShape in project Charset by CharsetMC.
the class LaserBeam method isBlocker.
private final boolean isBlocker(Chunk chunk, BlockPos pos) {
IBlockState state = chunk.getBlockState(pos);
// Quickies: air always lets through, opaque cubes never let through. Simple!
if (state.getBlock().isAir(state, world, pos)) {
return false;
}
if (state.isOpaqueCube()) {
return true;
}
// Check the blacklist
if (CharsetLaser.BLOCKING_BLOCKS.contains(state.getBlock())) {
return true;
}
// If block is opaque...
if (state.getLightOpacity(world, pos) >= 192) /* out of 255 */
{
// ...and a full cube, nope out
if (state.isFullCube()) {
return true;
}
// ...and has a blocking shape, nope out
BlockFaceShape shapeA = state.getBlockFaceShape(world, pos, direction);
BlockFaceShape shapeB = state.getBlockFaceShape(world, pos, direction.getOpposite());
if ((shapeA != BlockFaceShape.BOWL && shapeA != BlockFaceShape.UNDEFINED) || (shapeB != BlockFaceShape.BOWL && shapeB != BlockFaceShape.UNDEFINED)) {
return true;
}
return true;
}
if (state.getBlock().hasTileEntity(state)) {
TileEntity tile = chunk.getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE);
if (tile != null && tile.hasCapability(CharsetLaser.LASER_RECEIVER, direction.getOpposite())) {
return true;
}
}
return false;
}
use of net.minecraft.block.state.BlockFaceShape in project Bewitchment by Um-Mitternacht.
the class BlockScornedBrickFence method canConnectTo.
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos, EnumFacing p_176524_3_) {
IBlockState iblockstate = worldIn.getBlockState(pos);
BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, pos, p_176524_3_);
Block block = iblockstate.getBlock();
boolean flag = blockfaceshape == BlockFaceShape.MIDDLE_POLE && (iblockstate.getMaterial() == this.blockMaterial || block instanceof BlockFenceGate);
return !isExcepBlockForAttachWithPiston(block) && blockfaceshape == BlockFaceShape.SOLID || flag;
}
use of net.minecraft.block.state.BlockFaceShape in project Lands-of-Icaria by Axanthic-Game-Studios.
the class BlockGem method canPlaceBlockOnSide.
@Override
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing facing) {
BlockPos blockpos = pos.offset(facing.getOpposite());
IBlockState iblockstate = worldIn.getBlockState(blockpos);
Block block = iblockstate.getBlock();
BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, blockpos, facing);
return !isExceptBlockForAttachWithPiston(block) && blockfaceshape == BlockFaceShape.SOLID;
}
Aggregations