How Do You Make an Invisible Border?

I made a beach farm, but my character can walk on water. Is there a way to make it impassable? Thanks!

Hmm, are you making a Stardew Valley mod? In that case it would be better to ask in their modding community. Also maybe Modding:Maps - Stardew Valley Wiki contains some information regarding this?