Kukipett Posted January 13, 2014 Posted January 13, 2014 When i tried to register my blocks and item as we used to do it for 1.6... version i encountered various problems. I spent the evening in finding how to solve it, maybe i'm a moron and i just missed something, but maybe this will help. In creative mod i could see my blocks but textures did not show up. In survival, my ores did not show, i could just see holes where they should have been. When crafting one of my blocks i got crashes. So i examined how the vanilla blocks were registered and i did the same for mines. It worked fine, except the fact that i could not harvest my blocks and crafting one of my block lead to a crash. In fact the reason is that since there are no more ID used when harvesting and crafting, blocks also need to be registered as ItemBlock in the Item Registry. Here is an example how i did it , i have tested it during 3 houres without a bug. In main mod class : public static final RegistryNamespaced registryBlockNamespaced = GameData.blockRegistry; public static final RegistryNamespaced registryItemNamespaced = GameData.itemRegistry; public static Block testBlock; public static Item testItem; @EventHandler public void load(FMLPreInitializationEvent event) { // registering the blocks in the blockRegistry with the vanilla method (made with Forge ...997 many fields are still not remapped) registryBlockNamespaced.func_148756_a(220, "testblock", (new BlockteleportBlock(Material.field_151578_c)).func_149715_a(1.0F).func_149711_c(1.2F).func_149663_c("testblock").func_149658_d("testblock")); //registering the items in the itemRegistery registryItemNamespaced.func_148756_a(5000, "testitem", (new Item()).setUnlocalizedName("testitem").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("testitem")); //retrieving a block from registry, you need to specify your mod ID testBlock = (Block)Block.field_149771_c.getObject("modid:testblock"); //retrieving an item from registry, you need to specify your mod ID testItem = (Item)Item.field_150901_e.getObject("modid:testitem"); //registering your blocks as ItemBlock in the itemRegistry registryItemNamespaced.func_148756_a(220, "testblock", new ItemBlock(testBlock)); } Quote
Draco18s Posted January 13, 2014 Posted January 13, 2014 It appears that you are trying to specify block and item IDs. You don't need those. You should not even be aware that they exist. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Recommended Posts
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.