Jump to content

Recommended Posts

Posted

Hi. I'm having trouble with my mod's creative tab.

 

My mod's creative tab does work, but it only works if I replace a tab. The code below is in my main mod file. I have set it to 0, so it replaces the "Building Blocks" tab. It works with numbers 0 to 11 (11 being the inventory), but if I set it to 12, the game crashes before the mojang screen comes up

public static final CrystalTab tabCrystal = new CrystalTab(0, "tabCrystal");

 

Am I doing something wrong?

 

Here's the class file for my mod's tab.

package com.testing.crystals;

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

public class CrystalTab extends CreativeTabs {

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

@Override
public Item getTabIconItem() {
	return CrystalItems.crystal_red;
}

}

Posted

Wrong constructor m8.

 

public CrystalTab(String label) {
	super(label);
	this.setBackgroundImageName("crystal.png");
}

1.7.10 is no longer supported by forge, you are on your own.

Posted

Not. Possible.

 

public CreativeTabs(String label)
    {
        this(getNextID(), label);
    }

    public CreativeTabs(int index, String label)
    {
        if (index >= creativeTabArray.length)
        {
            CreativeTabs[] tmp = new CreativeTabs[index + 1];
            for (int x = 0; x < creativeTabArray.length; x++)
            {
                tmp[x] = creativeTabArray[x];
            }
            creativeTabArray = tmp;
        }
        this.tabIndex = index;
        this.tabLabel = label;
        creativeTabArray[index] = this;
    }

 

1st one is used to add next CT, 2nd allows you to override tab with index.

 

public class MyTab extends CreativeTabs
{
public MyTab(String label)
{
	super(label);
}

...
}

1.7.10 is no longer supported by forge, you are on your own.

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.