This small mod adds two barrier type blocks. They block all entities that are not the player.
There are two kinds, One for above the water and one for below the water.
There is a small knockback effect to try to prevent mobs from clumping along border.