Metamaterials and photonic/phononic crystals have been successfully developed in recent years to achieve advanced wave manipulation and control, both in electromagnetism and mechanics. However, the underlying concepts are yet to be fully applied to the field of fluid dynamics and water waves. Here, we present an example of the interaction of surface gravity waves with a mechanical metamaterial, i.e. periodic underwater oscillating resonators. In particular, we study a device composed by an array of periodic submerged harmonic oscillators whose objective is to absorb wave energy and dissipate it inside the fluid in the form of heat. The study is performed using a state of the art direct numerical simulation of the Navier-Stokes equation in its two-dimensional form with free boundary and moving bodies. We use a Volume of Fluid interface technique for tracking the surface and an Immersed Boundary method for the fluid-structure interaction. We first study the interaction of a monochromatic wave with a single oscillator and then add up to four resonators coupled only fluid-mechanically. We study the efficiency of the device in terms of the total energy dissipation and find that by adding resonators, the dissipation increases in a non trivial way. As expected, a large energy attenuation is achieved when the wave and resonators are characterised by similar frequencies. As the number of resonators is increased, the range of attenuated frequencies also increases. The concept and results presented herein are of relevance for applications in coastal protection.