refactor clamping items outside inventory bounds