Jump to content

Recommended Posts

Posted

I'm trying to create a creative tab.

Also, I'd like to disclaim that I don't have a great amount of experience with Java, let alone modding with FML.

And that this is my first post, so please punish me gently.

 

Problem:

Unfortunately, I've come across an argument I am not familiar with. This is located within the main class. The only errors state that the arguments by TutorialTab is incorrect.

 

public static final TutorialTab tabTutorial = new TutorialTab(0, "tabTutorial");

 

Inside the argument, it requires me to put in an integer. ("0") When I do, run Minecraft, and attempt to open up my creative inventory, the client just crashes. I have already set up a CreativeTabs class:

package Epauchus.test;

import Epauchus.test.init.TutorialItems;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class TutorialTab extends CreativeTabs {

public TutorialTab(int index, String label) {
	super(index, label);
	this.setBackgroundImageName("tab_tutorial.png");
}

@Override
public Item getTabIconItem() {
	return TutorialItems.test_item;
}
}

If you see anything wrong and is capable of helping me fix it, please notify me. Your feedback will be greatly appreciated. c:

Posted

To further explain, each creative tab is supposed to have a unique id number (just a sequential int). That is what the first parameter means. If you use an id that is already used that will create trouble, so you need to find the next available one, which is what lars' recommendation does.

 

You'll find a similar thing in networking where each packet type needs to be registered with a unique id.

 

"Underneath the hood" of Minecraft the blocks, items and entities have unique ID numbers as well, but in recent versions of Forge that has been mostly hidden from any need to interact directly with them.

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

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.