Conversation
- Add preferredSortMaterial field to VirtualInventory to persist sort preference - Update getDisplayInventory() to apply preferred sort when rebuilding cache - Initialize default sort (first item) when opening storage for the first time - Apply sort to VirtualInventory when storage is opened with existing preference - Make sort button colors configurable via gui.yml (selected_color, unselected_color, none_color) - Update language files (en_US and vi_VN) with color configuration Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Copilot
AI
changed the title
at the function handleSortItemsClick(), when reopen the storage the sort display is gone, this also apply to when user use the action in the SpawnerStorage the short will return to the default display, you need to make it consistent maybe modify the V...
Fix storage sort persistence and add configurable colors for sort button
Oct 1, 2025
Contributor
|
@copilot sort_items_button: |
Changed from color-only configuration to full format strings with placeholders: - selected_item: Full format string with %item_name% placeholder for selected items - unselected_item: Full format string with %item_name% placeholder for unselected items - none_text: Full format string for when no items are available This allows users to customize not just colors but also the bullet style, text, and layout of sort items in the button lore. Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Contributor
Author
... Done! Changed the configuration from just colors to full format strings with placeholders. You can now customize the entire format: sort_items_button:
selected_item: '�F986• %item_name%'
unselected_item: '&#f8f8ff• %item_name%'
none_text: '&#bdc3c7• None'The |
Copilot
AI
changed the title
Fix storage sort persistence and add configurable colors for sort button
Fix storage sort persistence and add configurable format for sort button
Oct 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The storage sort functionality had several UX issues:
Root Cause
The issue was that
VirtualInventory.getDisplayInventory()would rebuild the display cache without considering the preferred sort material stored inSpawnerData. When the cache was invalidated (by actions or reopening), it defaulted to alphabetical sorting.Solution
1. Store sort preference in VirtualInventory
Added a
preferredSortMaterialfield toVirtualInventorythat persists the sort preference at runtime:When
sortItems()is called, this preference is stored and automatically applied whenever the display cache needs to be rebuilt.2. Initialize default sort on first open
Modified
SpawnerStorageAction.openLootPage()to:preferredSortItemis null when opening storageThis ensures users always see a consistent sort from the first time they open storage.
3. Make item format fully configurable
Replaced hardcoded formatting in
SpawnerStorageUI.createSortButton()with configuration-based format strings:Added these configuration keys to
gui.yml(en_US and vi_VN):The
%item_name%placeholder gets replaced with the actual item name, allowing complete customization of colors, bullet styles, prefixes, suffixes, and overall layout.Result
gui.yml, consistent with filter/sort buttons in list GUITechnical Details
The fix works by storing the sort preference in two places:
When
VirtualInventory.getDisplayInventory()rebuilds the cache (which happens after any inventory modification), it now checkspreferredSortMaterialand applies the appropriate sorting logic automatically.Backward Compatibility
All changes are backward compatible:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.