use of net.minecraft.block.state.BlockFaceShape in project ImmersiveEngineering by BluSunrize.
the class Utils method canFenceConnectTo.
public static boolean canFenceConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing, Material material) {
BlockPos other = pos.offset(facing);
IBlockState state = world.getBlockState(other);
Block block = world.getBlockState(other).getBlock();
if (block.canBeConnectedTo(world, other, facing.getOpposite()))
return true;
BlockFaceShape blockfaceshape = state.getBlockFaceShape(world, other, facing.getOpposite());
boolean flag = blockfaceshape == BlockFaceShape.MIDDLE_POLE && (state.getMaterial() == material || block instanceof BlockFenceGate);
return !isExceptBlockForAttachWithFence(block) && blockfaceshape == BlockFaceShape.SOLID || flag;
}
use of net.minecraft.block.state.BlockFaceShape in project Almura by AlmuraDev.
the class BlockFaceShapeProcessor method processState.
@Override
public void processState(ConfigurationNode config, final ContentBlock.Builder<ContentBlock, BlockStateDefinition, BlockStateDefinition.Builder<BlockStateDefinition>> builder, final BlockStateDefinition.Builder<BlockStateDefinition> definition) {
final BlockFaceShape shape = BlockFaceShape.valueOf(config.getString("undefined").toUpperCase().replace(' ', '_'));
definition.blockFaceShape(shape);
}
use of net.minecraft.block.state.BlockFaceShape in project Bewitchment by Um-Mitternacht.
the class BlockFakeIceFence 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 takumicraft by TNTModders.
the class BlockTakumiFence method canConnectTo.
@Override
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 || block instanceof BlockWall;
}
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;
}
Aggregations