Search in sources :

Example 1 with BlockBasePressurePlate

use of net.minecraft.block.BlockBasePressurePlate in project Charset by CharsetMC.

the class RedstoneUtils method canConnectFace.

public static boolean canConnectFace(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side, EnumFacing face) {
    Block block = state.getBlock();
    if ((block instanceof BlockRedstoneDiode || block instanceof BlockRedstoneWire || block instanceof BlockDaylightDetector || block instanceof BlockBasePressurePlate) && face != EnumFacing.DOWN) {
        return false;
    }
    if (block instanceof BlockLever && face != state.getValue(BlockLever.FACING).getFacing().getOpposite()) {
        return false;
    }
    if (block instanceof BlockButton && face != state.getValue(BlockButton.FACING).getOpposite()) {
        return false;
    }
    IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
    if (container != null) {
        return MultipartRedstoneHelper.canConnectRedstone(container, side, face);
    } else {
        return block.canConnectRedstone(world, pos, side);
    }
}
Also used : BlockBasePressurePlate(net.minecraft.block.BlockBasePressurePlate) BlockDaylightDetector(net.minecraft.block.BlockDaylightDetector) BlockLever(net.minecraft.block.BlockLever) BlockRedstoneDiode(net.minecraft.block.BlockRedstoneDiode) IMultipartContainer(mcmultipart.multipart.IMultipartContainer) Block(net.minecraft.block.Block) BlockButton(net.minecraft.block.BlockButton) BlockRedstoneWire(net.minecraft.block.BlockRedstoneWire)

Aggregations

IMultipartContainer (mcmultipart.multipart.IMultipartContainer)1 Block (net.minecraft.block.Block)1 BlockBasePressurePlate (net.minecraft.block.BlockBasePressurePlate)1 BlockButton (net.minecraft.block.BlockButton)1 BlockDaylightDetector (net.minecraft.block.BlockDaylightDetector)1 BlockLever (net.minecraft.block.BlockLever)1 BlockRedstoneDiode (net.minecraft.block.BlockRedstoneDiode)1 BlockRedstoneWire (net.minecraft.block.BlockRedstoneWire)1