Posted June 28, 20178 yr 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); } }
June 28, 20178 yr You shouldn't use ID's... Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
June 28, 20178 yr 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.
June 29, 20178 yr 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.