Search in sources :

Example 1 with GantryShaftBlock

use of com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock in project Create by Creators-of-Create.

the class GantryCarriageTileEntity method shouldAssemble.

private boolean shouldAssemble() {
    BlockState blockState = getBlockState();
    if (!(blockState.getBlock() instanceof GantryCarriageBlock))
        return false;
    Direction facing = blockState.getValue(GantryCarriageBlock.FACING).getOpposite();
    BlockState shaftState = level.getBlockState(worldPosition.relative(facing));
    if (!(shaftState.getBlock() instanceof GantryShaftBlock))
        return false;
    if (shaftState.getValue(GantryShaftBlock.POWERED))
        return false;
    BlockEntity te = level.getBlockEntity(worldPosition.relative(facing));
    return te instanceof GantryShaftTileEntity && ((GantryShaftTileEntity) te).canAssembleOn();
}
Also used : GantryShaftBlock(com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock) BlockState(net.minecraft.world.level.block.state.BlockState) GantryShaftTileEntity(com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity) Direction(net.minecraft.core.Direction) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Aggregations

GantryShaftBlock (com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock)1 GantryShaftTileEntity (com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity)1 Direction (net.minecraft.core.Direction)1 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)1 BlockState (net.minecraft.world.level.block.state.BlockState)1