Cache Y value for switches

This should improve performance in switchpalace1