Skip to content

Pause sorting in the storage terminal while shift is held - #207

Merged
rubensworks merged 2 commits into
master-1.20-ltsfrom
claude/integrated-terminals-154-pzxjf6
Aug 22, 2026
Merged

Pause sorting in the storage terminal while shift is held#207
rubensworks merged 2 commits into
master-1.20-ltsfrom
claude/integrated-terminals-154-pzxjf6

Conversation

@rubensworks

Copy link
Copy Markdown
Member

Closes #154

What

While the shift key is held down, ingredients in the storage terminal keep the position they had, so shift-clicking stacks in or out no longer moves them around. As soon as shift is released, the regular sorting is applied again.

How

Instead of skipping the view refresh entirely (which would freeze quantities and hide newly inserted ingredients), TerminalStorageTabIngredientComponentClient keeps rebuilding its filtered view while sorting is paused, but orders it by the previously shown view instead of by the active sorters:

  • Ingredients that were already visible keep their position, independent of their quantity.
  • New ingredients are appended at the end, ordered by the active sorters.
  • Quantities keep updating live.

The pause state is checked in getSlots/getSlotCount (so once per render frame). When sorting resumes, all views are re-sorted and the currently selected slot is re-located via the existing updateActiveInstance logic.

Explicit user actions that change the way ingredients are shown always apply immediately, even with shift held (e.g. when typing capitals in the search field): the sort buttons, the crafting filter button and setInstanceFilter forget the paused order.

The behaviour can be disabled with the new guiStoragePauseSortingWhileShifting client config option (enabled by default).

Notes

  • An ingredient that becomes fully depleted while shift is held does disappear from the list, so the ingredients after it shift up by one. Refined Storage keeps a zeroed placeholder in that case; doing the same here would require rendering zero-quantity slots through IIngredientComponentTerminalStorageHandler, which seemed out of scope for this change. Happy to add it if you'd like that behaviour too.
  • ./gradlew build passes (the repo has no unit tests, and this MC version has no game tests). The GUI behaviour itself has not been verified in-game.

Generated by Claude Code

While the shift key is held down, ingredients keep the position they had
in the storage terminal, so that quantity changes caused by shift-clicking
items in or out don't move them around anymore.
Ingredients that are new since sorting was paused are appended at the end.
As soon as shift is released, the regular sorting is applied again.

This can be disabled with the new guiStoragePauseSortingWhileShifting
client config option.

Closes #154

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GuGBvU7WNr6XhwVxbGdLmY
@CLAassistant

CLAassistant commented Aug 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

* @param previousView A previously shown ingredients view.
* @param sorter An optional sorter that is used for ordering the new ingredients.
*/
protected void sortByPreviousOrder(List<InstanceWithMetadata<T>> ingredientsView,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems to be going wrong when I test this out.
It looks like the crafting options can jump around when holding shift.
For example, I had a crafting option with 4 x planks, which first was shown after a 32 x stone stack, but then jumped before it, even though I was sorting by itemstack quantity.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, that was a real bug, fixed in 43c628e.

The positions of the previously shown ingredients were keyed by ingredient only (with the quantity ignored), so a crafting option and the stored stack of that same item shared one position. As soon as the view was rebuilt while shift was held, the crafting option was given the position of the stored stack, and jumped right next to it. In your case there must have been a stored planks stack before the stone, which the planks crafting option then jumped to.

Positions are now keyed by ingredient and crafting option (via InstanceWithMetadata.createComparator, so a stored ingredient and a crafting option for the same item are distinct keys), which keeps them in place.


Generated by Claude Code

Crafting options shared their position with the stored ingredient of the
same item, causing them to jump next to that stored ingredient as soon as
the view was rebuilt while sorting was paused.
Positions are now determined based on the ingredient and its crafting
option.

Furthermore, the paused sorting order is now reset from within
resetFilteredIngredientsViews, and the paused state is checked from within
getFilteredIngredientsView.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GuGBvU7WNr6XhwVxbGdLmY
@rubensworks
rubensworks merged commit f9f0b25 into master-1.20-lts Aug 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants