Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.10.2] Is there a way to order your creative tabs after initializing them?

Featured Replies

Posted

I have multiple creative tabs that I initialize before I create items/blocks. Now, my question is how I can reorder said blocks and items after I've created both the creative tabs and items/blocks (because the List<> that organizes the creative tabs gets fleshed out during the registration process, I'll leave a link to the item registry as an example)?

 

Here's my code if your wondering.

 

Main class: https://github.com/SanaRinomi/More_Things_Mod_Minecraft_Forge/blob/master/main/java/com/holydevils/main/MainRegistry.java

 

Creative Tabs folder: https://github.com/SanaRinomi/More_Things_Mod_Minecraft_Forge/tree/master/main/java/com/holydevils/creativetabs

 

Item registry: https://github.com/SanaRinomi/More_Things_Mod_Minecraft_Forge/blob/master/main/java/com/holydevils/items/ModItems.java

public void displayAllReleventItems(List items) {
        super.displayAllRelevantItems(items);
        Collections.sort(items, tabSorter);
        
	tabSorter = Ordering.explicit(order).onResultOf(new Function<ItemStack, Item>() {
		@Override
    		public Item apply(ItemStack input) {
        		return input.getItem();
    		}
	});
}

 

arent you already sorting them ?

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

  • Author

At the beginning, yes, but I need a function that I can call after it because the list will only contain the things I want after they've been registered and I can't move the Creative Tabs function after registering the items/blocks because sid items/blocks won't show up in the tabs. Thus I need to have a function I can use after registering the items/blocks to resort the creative tabs.

then you should save the list in a faild in the Tab and then modifify the list.

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

At the beginning, yes, but I need a function that I can call after it because the list will only contain the things I want after they've been registered and I can't move the Creative Tabs function after registering the items/blocks because sid items/blocks won't show up in the tabs. Thus I need to have a function I can use after registering the items/blocks to resort the creative tabs.

Thats not how ANY of this works.

The list you are passed in is empty, you're supposed to fill it with items...

Go look at the default implementation of that function it's pretty freaking obvious.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

At the beginning, yes, but I need a function that I can call after it because the list will only contain the things I want after they've been registered and I can't move the Creative Tabs function after registering the items/blocks because sid items/blocks won't show up in the tabs. Thus I need to have a function I can use after registering the items/blocks to resort the creative tabs.

Thats not how ANY of this works.

The list you are passed in is empty, you're supposed to fill it with items...

Go look at the default implementation of that function it's pretty freaking obvious.

 

I went thought minecraft whole Creative Tab registry already.

  • Author

Well, maybe initialize the tab sorter (the ordering) before you use it?

I suggest you read my tutorial again.

 

Thx again. But now I have a different problem... When adding elements to the List they add null and not the item.

 

The code between adding items and adding blocks are very similar so I'll just give you the block one because it's the first one called: https://github.com/SanaRinomi/More_Things_Mod_Minecraft_Forge/blob/master/main/java/com/holydevils/blocks/ModBlocks.java

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.