Posted March 9, 201510 yr 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; } }
March 9, 201510 yr 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.
March 9, 201510 yr Author Just gave it a try, "super(label);" has a red underline. It says "The constructor CreativeTabs(String) is undefined".
March 9, 201510 yr 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.
March 10, 201510 yr Author Can't seem to get it to work. So I setup a new workspace and moved my mod to it. Managed to get it working. Don't think I set the workspace up correctly or something.
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.