Posted February 3, 201510 yr Hey Folks, I'm pretty new to all of this, so please bear with me. I'm trying to make a simple mod that adds more different types of wall to the game. My walls seem to work, but the problem I'm having is that for each new type of wall I add, I get two items in the creative tab - one displaying the correct model and one not. Here's my code: I'm declaring the block variables as type Block, and instantiating them by creating an instance of BlockWall. Declaration: public static Block wallBrick; My preInit method: @EventHandler public void preInit(FMLPreInitializationEvent event) { wallBrick = new BlockWall(Blocks.brick_block).setUnlocalizedName("brick_wall").setCreativeTab(wallsTab); GameRegistry.registerBlock(wallBrick, wallBrick.getUnlocalizedName().substring(5)); } The blocks are being rendered using a client side proxy from the initialization method: @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(wallBrick); } public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(WallsMod.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } And this is what my creative tab looks like: Can anybody tell me what I'm doing wrong, and how to remove the duplicates from the creative tab? Thanks
February 3, 201510 yr Hi Do you see any error messages about missing texture or missing model in the console? If you cursor over the models with missing texture, what name does it say? -TGG
February 3, 201510 yr Could we get more than that small chunk of code? Also, try giving the block a texture like ^that person said. That might be the issue.
February 3, 201510 yr Author Hi, Thanks for the replies @TheGreyGhost: No I have no warnings in the console regarding missing models. When I cursor over the models, both say "tile.brick_wall.name". I can place either version in the world and they both work the same. @deadrecon98 Sure - should I post the full classes? I'm not sure what you mean when you say "give that block a texture" as I don't want that block to show up at all - I just want the one that looks like a wall Thanks
February 3, 201510 yr Some ideas: Do you still get two duplicates if you search for your item on the search tab? What if you set the tab to a vanilla creative tab instead of your custom? Do your blocks have multiple metadata? What does your getSubItems() (or Block.getSubBlocks() ) look like? You could try adding a breakpoint into ItemModelMesher.getItemModel() if (ibakedmodel == null) { ibakedmodel = this.modelManager.getMissingModel(); } - this is where it silently substitutes the missing model if it can't find the one it's looking for. This will tell you what stack it's looking for, and with any luck why it's not finding it. -TGG
February 3, 201510 yr Author It was the sub blocks! BlockWall.getSubBlocks() adds a sub block for the mossy variant, which is why my instance of BlockWall was displaying two items. I've now subclassed BlockWall and overriden the getSubBlocks() method to return a single item like Block does, and no more duplicates. Thanks for your help TGG
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.