Skip to content

Conversation

@itzTheMeow
Copy link

This PR adds a third sorting mode to sort items by how they are ordered in the creative menu.
Since creative tabs are client-side now, I had to write a Fabric mod to dump them to a text file to use for ordering. This has the side-effect of allowing users to customize the order by modifying the text file in their plugin directory.

This also adds a gitignore for the files in target and a CONTRIBUTING.md file.
Mod: https://github.com/itzTheMeow/creative-tab-dumper

Preview:
IMG_2512

Copy link
Owner

@James-P-Bennett James-P-Bennett left a comment

Choose a reason for hiding this comment

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

Overall good work. I've reviewed the changes and have some some issues needed to be addressed before we can merge the PR:

Null Safety in getCreativeMenuOrder

To prevent potential NPE issues, I'd recommend either adding a null check guard in getCreativeMenuOrder or initializing creativeSortOrder at the point of declaration (e.g., new HashMap<>()). This would ensure the map is never null when accessed.

Enhanced Parsing Robustness in loadCreativeMenuOrder

The current implementation treats every non-empty trimmed line as a material name. I'd suggest improving this by:

  • Ignoring comment lines (those starting with #)
  • Properly handling blank lines beyond just trimming
  • Logging warnings when invalid material names are encountered, rather than silently ignoring them. This would help server admins troubleshoot configuration issues
  • The matchMaterial method can be strict about exact naming/casing, and the current replace("minecraft:", "") approach may not cover all edge cases (other prefixes, modded items, case variations). Consider more flexible name matching or validation.

Sorting Logic Enhancement

The ascending sort by creative order index with Integer.MAX_VALUE as default is sound for pushing unknown items to the end. However, you might consider adding a secondary alphabetical tiebreaker for items with identical creative indices to make the sort behavior more deterministic and explicit.

Minor Improvements in TerminalGUI

  • In the refresh() method, since sortMode is an enum, using != for comparison (if (savedSortMode != sortMode)) would be clearer and more idiomatic than .equals().
  • I noticed the visual glow cue was removed from the sorting button. Was this intentional? If not, restoring the glow effect for the active sort mode would provide helpful visual feedback to players.

Localization Completeness

Great work adding the creative mode language keys. A few items to verify:

  • Ensure all new message keys are present in other language files beyond en_US.yml (if applicable)
  • Some debug strings still reference older message keys. These should be updated for consistency
  • I noticed null is being passed for the player parameter in message manager API calls. Please confirm this is intentional and won't cause issues

Code Cleanup

There appear to be some unused or redundant imports in ConfigManager (possibly InputStreamReader, InputStream, FileConfiguration, etc.). A quick cleanup pass is needed.

@itzTheMeow
Copy link
Author

I removed the enchant glow from the sorting icon since it has 3 different states and 3 different items now instead of 1 item in either a glowing/non-glowing state.

I'll make the other changes when I have time.

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.

2 participants