Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
	}
}

 

  • Author
2 hours ago, Kokkie said:

You shouldn't use ID's...

Those IDs are used to reduce complexity of my code and improve its flexibility - I prefer it that way.

  • Author

IDs have nothing to do with past Minecraft IDs and they are completely invisible to end-users and they can't change in any way unless I change them since they are only used for stuff that I created, not Forge. Anyway, the problem has been solved....

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.