Jump to content

Recommended Posts

Posted

[move][glow=red,2,300]Question:[/glow] Does anyone know how to organize items 'n stuff in a CreativeTab?[/move]

 

Hey guys!

 

I have added a few items to my Creative Tab in my mod, but they are all not organized; I want swords with swords, items with items and so on. How do I do that? I searched all over the internet, looking at many websites and tutorials, but I cannot find it.

Creator of the Extended Items Mod:

 

Download v0.05

Posted

Okay, I haven't tried this but I think it might work.  First of all, the order they appear is the order they are added to the tab.  The mistake most people make is thinking they have to set the creative tab at same time as they create or register the item and so end up with a order they don't like, but actually setting the creative tab is just a method that can be called at any time.

 

So all you need to do set all the creative tabs in the order you want them.

 

Note you can also delete items from the creative tabs, including (I think) the vanilla items and re-add them in different order like:

Item.getItemByID(400).setCreativeTab(null); // should remove pumpkin_pie from the food creative tab

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Override

displayAllReleventItems

. In there first call the super method to let it fill the list, then sort it with a Comparator.

 

I am a new to coding, I have done plugins before, but this is obviously different, so I do not know what many things are. I only know the 'basics'.

 

I have tried to add this.displayAllReleventItems(arg0), but then I get errors with the String in the displayAllReleventItems.

 

This is my code from the CreativeTab class

 

package com.Greenadine.ExtendedItemsMod.CreativeTabs;

import com.Greenadine.ExtendedItemsMod.ExtendedItemsMod;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class TabExtendedItemsModItems extends CreativeTabs {

public TabExtendedItemsModItems(int arg0, String arg1) {
	super(arg0, arg1);
	this.displayAllReleventItems(arg0);
}

@Override
public Item getTabIconItem() {
	return ExtendedItemsMod.SuperiteGem;
}

}

 

It gives the error "The method displayAllReleventItems(List) in the type CreativeTabs is not applicable for the arguments (int)" at this.displayAllReleventItems.

 

I do not know what to do next. And how do I organize it with a Comperator, because I do not know what it is.

 

But thanks already for the help! :)

Creator of the Extended Items Mod:

 

Download v0.05

Posted

LTPIJ: Learn to program in Java!

You didn't override anything as Diesieben07 told you. Calling a method with some random parameter is just plain wrong.

Use you IDE to add the override - then you can get the proper argument types. If you don't know how, then you are going to seriously fail at modding Minecraft.

 

Nothing personal.

Posted

Override displayAllReleventItems. In there first call the super method to let it fill the list, then sort it with a Comparator.

 

This means that you create a method in your class with the same modifier (public/protected), return (probably void in this case), and parameters.(the things that are inputs in this case a list)

This means that in this new method you create, add super.displayAllReleventItems(list), where list is the list in the parameters.

This means to use some sort of comparator to change the order of the list. Take a look at this http://www.tutorialspoint.com/java/java_using_comparator.htm and apply that to your item base class.

 

Alternatively you could use jabelar's suggestion.

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.