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

[1.11.2] Creative Tab Icon


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")
		public ItemStack getTabIconItem()
			return new ItemStack(BSMBlocks.OAK_WOOD_ON_Y_AXIS, 1);
	    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);
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);
		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.

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.


  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I have been trying to download Forge but the Windows Installer isn't coming up, I can see the installer one would use for Linux but no Windows, I have downloaded Java and Jarfix but nothing is working, can someone help?  
    • So I thought that when a capability is attached to an item/entity/etc... the capability will stay until whatever it's attached to is gone. But this doesn't seem to be the case, as when I printed to console whenever a capability is attached, it seems as though a new version of the capability is attached to an item every time I select it in my hotbar, hover over it in inventory, etc. Is this how it's supposed to work? If so, why?
    • Hi, I'm trying to set up a simple forge server just to play with a couple of my friends, but no matter what I do or try I cannot seem to get a Mods folder and for the actual forge part of the server to actually launch. Every time I try to launch the forge.jar via a .bat file I just get a bunch of errors [Errors below] I'm not sure what I'm doing wrong. If I can get some help that would be awesome, thanks C:\Users\User\Desktop\Server>java -Xms2G -Xmx6G -jar forge-1.12.2- nogui A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.base/java.lang.reflect.Method.invoke(Method.java:567)         at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70)         at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34) Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')         at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34)         at net.minecraft.launchwrapper.Launch.main(Launch.java:28)         ... 6 more C:\Users\User\Desktop\Server>pause Press any key to continue . . .  
    • Is it ok if i ask what that is?
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

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