Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.11.2] Creative Tab Icon


TheTrollguy_
 Share

Recommended Posts

Usually, I would go around this problem, but right now I can't.

 

Whenever I make a class with more creative tab objects, their icon would always show up as blank. No matter how I register my blocks or whether I "pre-load" my class, it's always blank. The reason why is that the class with creative tabs loads way before my class with blocks and so my block objects end up being null. I have no idea what to do, and as usual, I expect it to be a simple solution as I tend to get stuck on retarded things... Here's the code:

public class BSMCreativeTabs
{
	public static void initialize() {BSMSlab.initialize();} // a way to "pre-load" my block class
	
	public static final CreativeTabs tabWoodRelated = new CreativeTabs("tabWoodRelated")
	{
		@Override
		@SideOnly(Side.CLIENT)
		public ItemStack getTabIconItem()
		{
			return new ItemStack(BSMBlocks.OAK_WOOD_ON_Y_AXIS, 1);
		}
		
		@Override
		@SideOnly(Side.CLIENT)
	    public void displayAllRelevantItems(NonNullList<ItemStack> list)
	    {
			int[][] blockIDs =
			{
				{26, 29, 32, 35, 137, 140, -1, -1, -1}, // WOOD 
				{12, 13, 14, 15,  16,  17, -1, -1, -1}, // PLANKS
				{37, 38, 39, 40, 142, 143, -1, -1, -1}  // LEAVES
			};
			getItemsFor(list, blockIDs);
	    }
		
	}.setNoScrollbar();
}     
package tt.betterslabsmod.main;

import java.util.HashMap;

import net.minecraft.block.*;
import net.minecraft.init.Blocks;
import tt.betterslabsmod.blocks.*;
import tt.betterslabsmod.blocks.BSMSlabBasic.BasicVariant;
import tt.betterslabsmod.options.BSMOptions;

public class BSMBlocks
{
/**
All blocks are loaded this way
**/
	public static final BSMSlab STONE;
	
	private static BSMSlab getRegisteredBlock(int ID)
	{
		return BSMSlab.BLOCK_REGISTRY.get(ID);
	}
	
	static
	{
		STONE = getRegisteredBlock(0);
	}
}

 

Link to comment
Share on other sites

It's not about what you prefer. The IDs can and will change. You must not hardcode IDs. No, not even if you "prefer it that way". It's broken and it will break. Stop doing it.

 

Please post your BSMSlab and BSMBlocks class and also your main mod class.

 

Did I tell you to stop using IDs yet?

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.