src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java
/**
	 * Attached blocks will move if blocks they are attached to are moved
	 */
Attached blocks will move if blocks they are attached to are moved
Attached blocks will move if blocks they are attached to are moved
public static boolean isBlockAttachedTowards(IBlockReader world, BlockPos pos, BlockState state,
		Direction direction) {
		Block block = state.getBlock();
		if (block instanceof LadderBlock)
			return state.get(LadderBlock.FACING) == direction.getOpposite();
		if (block instanceof WallTorchBlock)
			return state.get(WallTorchBlock.HORIZONTAL_FACING) == direction.getOpposite();
		if (block instanceof AbstractPressurePlateBlock)
			return direction == Direction.DOWN;
		if (block instanceof DoorBlock)
			return direction == Direction.DOWN;
		if (block instanceof RedstoneLinkBlock)
			return direction.getOpposite() == state.get(RedstoneLinkBlock.FACING);
		if (block instanceof FlowerPotBlock)
			return direction == Direction.DOWN;
		if (block instanceof RedstoneDiodeBlock)
			return direction == Direction.DOWN;
		if (block instanceof RedstoneWireBlock)
			return direction == Direction.DOWN;
		if (block instanceof CarpetBlock)
			return direction == Direction.DOWN;
		if (block instanceof RedstoneWallTorchBlock)
			return state.get(RedstoneWallTorchBlock.FACING) == direction.getOpposite();
		if (block instanceof TorchBlock)
			return direction == Direction.DOWN;
		if (block instanceof HorizontalFaceBlock) {
			AttachFace attachFace = state.get(HorizontalFaceBlock.FACE);
			if (attachFace == AttachFace.CEILING)
				return direction == Direction.UP;
			if (attachFace == AttachFace.FLOOR)
				return direction == Direction.DOWN;
			if (attachFace == AttachFace.WALL)
				return direction.getOpposite() == state.get(HorizontalFaceBlock.HORIZONTAL_FACING);
		}
		if (state.contains(BlockStateProperties.HANGING))
			return direction == (state.get(BlockStateProperties.HANGING) ? Direction.UP : Direction.DOWN);
		if (block instanceof AbstractRailBlock)
			return direction == Direction.DOWN;
		if (block instanceof AttachedActorBlock)
			return direction == state.get(HarvesterBlock.HORIZONTAL_FACING)
				.getOpposite();
		if (block instanceof HandCrankBlock)
			return direction == state.get(HandCrankBlock.FACING)
				.getOpposite();
		if (block instanceof NozzleBlock)
			return direction == state.get(NozzleBlock.FACING)
				.getOpposite();
		if (block instanceof EngineBlock)
			return direction == state.get(EngineBlock.HORIZONTAL_FACING)
				.getOpposite();
		if (block instanceof BellBlock) {
			BellAttachment attachment = state.get(BlockStateProperties.BELL_ATTACHMENT);
			if (attachment == BellAttachment.FLOOR)
				return direction == Direction.DOWN;
			if (attachment == BellAttachment.CEILING)
				return direction == Direction.UP;
			return direction == state.get(HorizontalBlock.HORIZONTAL_FACING);
		}
		if (state.getBlock() instanceof SailBlock)
			return direction.getAxis() != state.get(SailBlock.FACING)
				.getAxis();
		if (state.getBlock() instanceof FluidTankBlock)
			return FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(direction));
		if (AllBlocks.STICKER.has(state) && state.get(StickerBlock.EXTENDED)) {
			return direction == state.get(StickerBlock.FACING)
				&& !notSupportive(world.getBlockState(pos.offset(direction)), direction.getOpposite());
		}
		return false;
	}
public static boolean isBlockAttachedTowards ( IBlockReader world , BlockPos pos , BlockState state , Direction direction ) { Block block = state . getBlock ( ) ; if ( block instanceof LadderBlock ) return state . get ( LadderBlock . FACING ) == direction . getOpposite ( ) ; if ( block instanceof WallTorchBlock ) return state . get ( WallTorchBlock . HORIZONTAL_FACING ) == direction . getOpposite ( ) ; if ( block instanceof AbstractPressurePlateBlock ) return direction == Direction . DOWN ; if ( block instanceof DoorBlock ) return direction == Direction . DOWN ; if ( block instanceof RedstoneLinkBlock ) return direction . getOpposite ( ) == state . get ( RedstoneLinkBlock . FACING ) ; if ( block instanceof FlowerPotBlock ) return direction == Direction . DOWN ; if ( block instanceof RedstoneDiodeBlock ) return direction == Direction . DOWN ; if ( block instanceof RedstoneWireBlock ) return direction == Direction . DOWN ; if ( block instanceof CarpetBlock ) return direction == Direction . DOWN ; if ( block instanceof RedstoneWallTorchBlock ) return state . get ( RedstoneWallTorchBlock . FACING ) == direction . getOpposite ( ) ; if ( block instanceof TorchBlock ) return direction == Direction . DOWN ; if ( block instanceof HorizontalFaceBlock ) { AttachFace attachFace = state . get ( HorizontalFaceBlock . FACE ) ; if ( attachFace == AttachFace . CEILING ) return direction == Direction . UP ; if ( attachFace == AttachFace . FLOOR ) return direction == Direction . DOWN ; if ( attachFace == AttachFace . WALL ) return direction . getOpposite ( ) == state . get ( HorizontalFaceBlock . HORIZONTAL_FACING ) ; } if ( state . contains ( BlockStateProperties . HANGING ) ) return direction == ( state . get ( BlockStateProperties . HANGING ) ? Direction . UP : Direction . DOWN ) ; if ( block instanceof AbstractRailBlock ) return direction == Direction . DOWN ; if ( block instanceof AttachedActorBlock ) return direction == state . get ( HarvesterBlock . HORIZONTAL_FACING ) . getOpposite ( ) ; if ( block instanceof HandCrankBlock ) return direction == state . get ( HandCrankBlock . FACING ) . getOpposite ( ) ; if ( block instanceof NozzleBlock ) return direction == state . get ( NozzleBlock . FACING ) . getOpposite ( ) ; if ( block instanceof EngineBlock ) return direction == state . get ( EngineBlock . HORIZONTAL_FACING ) . getOpposite ( ) ; if ( block instanceof BellBlock ) { BellAttachment attachment = state . get ( BlockStateProperties . BELL_ATTACHMENT ) ; if ( attachment == BellAttachment . FLOOR ) return direction == Direction . DOWN ; if ( attachment == BellAttachment . CEILING ) return direction == Direction . UP ; return direction == state . get ( HorizontalBlock . HORIZONTAL_FACING ) ; } if ( state . getBlock ( ) instanceof SailBlock ) return direction . getAxis ( ) != state . get ( SailBlock . FACING ) . getAxis ( ) ; if ( state . getBlock ( ) instanceof FluidTankBlock ) return FluidTankConnectivityHandler . isConnected ( world , pos , pos . offset ( direction ) ) ; if ( AllBlocks . STICKER . has ( state ) && state . get ( StickerBlock . EXTENDED ) ) { return direction == state . get ( StickerBlock . FACING ) && ! notSupportive ( world . getBlockState ( pos . offset ( direction ) ) , direction . getOpposite ( ) ) ; } return false ; }
Attached blocks will move if blocks they are attached to are moved
Attached blocks will move if blocks they are attached to are moved