Jump to content

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


Recommended Posts

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

Posted

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).

Posted

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.

Posted

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).

Posted

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

Posted

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.

Posted

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.

Announcements



×
×
  • Create New...

Important Information

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