Jump to content

Recommended Posts

Posted

So I've finally been getting around to updating my mod from 1.5 to 1.7.  A lot of things are going well, but for the life of me I can't get the items in my tab to sort.  I've read many times that items are added to the creative tab as they're registered in the GameRegistry, but no amount of rearranging in the code changes any order in the tab.  Here's my mod file:

 

http://pastebin.com/XFdj4B4L

 

And here's a couple screenshots of the tab:

 

http://gyazo.com/38a1d65dc9af1ecc897df1092bb84ccd

http://gyazo.com/02a4e4413e5df75bdfb80bda07497280

 

As you can see, the items are all jumbled up, despite being registered in a particular order.  So I decided to try to sort the tab myself, but I don't know how to do a multisort with the Comparator (specifically sorting by block first, then by name or type or whatever.  Right now they're not even sorted alphabetically).  Is there something I'm missing that would make this easier, or do I need to custom sort it, and how would I go about doing it?

Posted

OK, so I see the getItemFromBlock method, but are you saying I'm supposed to keep a custom list that is fed to the tab instead of using the one from displayReleventItems?

 

And besides, that still doesn't explain why they're not being sorted in the order they were added.

 

EDIT: Ohhhhhhhh, I think I get it now.  The list fed to the comparator is the order you want the displayReleventItems list to be sorted by, that's why it's an explicit order.  I should know better than to look at tutorials when I'm tired...

 

Still would like to know why any of this is necessary, though, instead of it being handled automatically the way it should through the registration order...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.