Limit hopper to valid directions. Fixes BUKKIT-3940

Remapped by Srg2Source from Bukkit/CraftBukkit@317e6b6e2bd5a025e8347d2405df8bae50a3413c