Posted March 23, 201411 yr Hey guys, I'm seem to be having a problem when I run my obfuscated mod in Minecraft. The blocks displays as items. When I am in Eclipse, the renders work correctly. Before you start replying, I am registering my blocks and items in preInit. @EventHandler public void preInit(FMLPreInitializationEvent event) { buildingBlock = new BlockBuilding(Material.wood).setBlockName("ccmBlockBuilding").setHardness(0.5F).setCreativeTab(this.tabConstruction); planningBlock = new BlockPlanner(Material.wood).setBlockName("ccmBlockPlanner").setHardness(0.5F).setCreativeTab(this.tabConstruction); itemBlueprint = new ItemBlueprint().setUnlocalizedName("ccmItemBlueprint").setTextureName("ccm:itemblueprint").setCreativeTab(this.tabConstruction); itemWoodHammer = new ItemHammer(1, Item.ToolMaterial.WOOD).setUnlocalizedName("ccmItemWoodHammer").setTextureName("ccm:itemwoodhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemStoneHammer = new ItemHammer(3, Item.ToolMaterial.STONE).setUnlocalizedName("ccmItemStoneHammer").setTextureName("ccm:itemstonehammer").setCreativeTab(this.tabConstruction).setFull3D(); itemIronHammer = new ItemHammer(6, Item.ToolMaterial.IRON).setUnlocalizedName("ccmItemIronHammer").setTextureName("ccm:itemironhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemGoldHammer = new ItemHammer(4, Item.ToolMaterial.GOLD).setUnlocalizedName("ccmItemGoldHammer").setTextureName("ccm:itemgoldhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemDiamondHammer = new ItemHammer(8, Item.ToolMaterial.EMERALD).setUnlocalizedName("ccmItemDiamondHammer").setTextureName("ccm:itemdiamondhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemCreationTool = new ItemCreationTool().setUnlocalizedName("ccmItemCreationTool").setTextureName("ccm:itempencil").setCreativeTab(this.tabConstruction); itemConstructionHelmet = new ItemConstructionHelmet(constructionArmour, 0, 0).setUnlocalizedName("ccmItemConstructionHelmet").setTextureName("ccm:itemconstructionhelmet").setCreativeTab(this.tabConstruction); GameRegistry.registerBlock(buildingBlock, "BlockBuilding"); GameRegistry.registerBlock(planningBlock, "BlockPlanner"); GameRegistry.registerItem(itemConstructionHelmet, "ItemConstructionHelmet"); GameRegistry.registerItem(itemBlueprint, "ItemBlueprint"); GameRegistry.registerItem(itemCreationTool, "ItemCreationTool"); GameRegistry.registerItem(itemWoodHammer, "ItemHammer"); GameRegistry.registerItem(itemStoneHammer, "ItemStoneHammer"); GameRegistry.registerItem(itemIronHammer, "ItemIronHammer"); GameRegistry.registerItem(itemGoldHammer, "ItemGoldHammer"); GameRegistry.registerItem(itemDiamondHammer, "ItemDiamondHammer"); GameRegistry.registerTileEntity(com.mrcrayfish.construction.tileentity.TileEntityBuildingBlock.class, "ccmBuildingBlock"); GameRegistry.registerTileEntity(com.mrcrayfish.construction.tileentity.TileEntityPlanningBlock.class, "ccmPlanningBlock"); proxy.registerRenderers(); NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler); } Eclipse Environment: https://dl.dropboxusercontent.com/s/oy6gugfua44c1eb/2014-03-23_10.15.06.png[/img] Obfuscated Environment: https://dl.dropboxusercontent.com/s/5ynjw1p26g3fprq/2014-03-23_10.32.40.png[/img] If you have any answers, I will appreciate it very much!
March 23, 201411 yr I've never seen that happen before Could you post one of your Block classes? http://i.imgur.com/NdrFdld.png[/img]
March 23, 201411 yr Author Here is the block class as seen in the picture. I've removed irrelevant code. package com.mrcrayfish.construction.block; public class BlockBuilding extends BlockContainer { private IIcon direction; private IIcon rest; public BlockBuilding(Material par2Material) { super(par2Material); } @Override public IIcon getIcon(int par1, int par2) { return (par1 != par2 ? this.rest : this.direction); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister par1IconRegister) { this.rest = par1IconRegister.registerIcon("ccm:buildingblock_rest"); this.direction = par1IconRegister.registerIcon("ccm:buildingblock_direction"); } } Edit: I seem to have fixed the problem by change the register method to this. GameRegistry.registerBlock(buildingBlock, buildingBlock.getUnlocalizedName().substring(5)); I think the registering name has to be the same as the string set in .setBlockName()
March 23, 201411 yr Yes, you should always register using the unlocalized name. Interesting side effect of not doing so that you found http://i.imgur.com/NdrFdld.png[/img]
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.