Koulis2000 / MCScripts

1 stars 0 forks source link

Group items more alphabetically..? #14

Closed Bjonnfesk closed 1 year ago

Bjonnfesk commented 1 year ago

I conjecture that if we sort the items alphabetically before grouping them, the resulting list will be closer to being in alphabetical order.

https://github.com/Koulis2000/MCScripts/blob/f682a08bf2f0c039b9f13d492a0bfd3304e13dcc/CCTweaked/janus-dossier.lua#L148-L169

Koulis2000 commented 1 year ago

We now first sort the items alphabetically, then keep adding them one by one on a sorted list. Single-word items are added regardless, while multi-word items are first compared against the addedItems list. The first multi-word item should be added regardless as well, then a loop checks for other items in the list with matching last words and adds them to both the sortedList and addedItems list. This ensures that items with matching last words are added together, but not readded to the list. Only time will tell if this sorting method is nice to use.

https://github.com/Koulis2000/MCScripts/blob/c830e9cf6bc1b3504c4312dab0953c498881e71a/CCTweaked/janus-dossier.lua#L76-L117