Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/15/17 in all areas

  1. I've been creating my creative tab right in my mod class near the top: public static final CreativeTabs TEST_TAB = new CreativeTabs("test") { @SideOnly(Side.CLIENT) public ItemStack getTabIconItem() { return new ItemStack(Items.REDSTONE); } }; I haven't messed with it much, but I do recall it wouldn't use my test item for the tab icon because my items hadn't registered yet, and I haven't as of yet bothered to try and fix/change/figure it out. But besides that works fine as far as I can see.
    2 points
  2. This link has a great example of using registry events to register stuff.
    2 points
  3. So, I am trying to get an ItemBlock to register alongside my Block when it gets registered. I have come up with this so far. Is there a better way to be doing this? If so, please show me some example code! I'm not really happy with the itemBlock.setRegistryName part inside registerBlock() ! public class ModBlocks { public static Block tinBlock; public static void init(){ tinBlock = new BlockTinBlock("tin_block", "tin_block"); } public static void register(){ registerBlock(tinBlock); } public static void registerRenders(){ registerRender(tinBlock); } public static void registerBlock(Block block){ GameRegistry.register(block); ItemBlock itemBlock = new ItemBlock(block); itemBlock.setRegistryName(Reference.MODID, block.getUnlocalizedName().substring(5)); GameRegistry.register(itemBlock); } public static void registerRender(Block block){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID, block.getUnlocalizedName().substring(5)), "inventory")); } } Solution by Ugdhar: [Register Items and Blocks like in the post below! Super neat and up to date!]
    1 point
  4. I have done that, yeah. But same as you, the items register before the tab. I guess I'll leave it then. I have NEI to get my items. Thanks for all the help! EDIT: Wait, your method worked perfectly! Haha, my items have shown up in the tab and my modded item is the icon too. Awesome
    1 point
  5. I have one more question that relates to all this. How would I get my creative tab to register before the items and blocks? Because, they are not getting put into the creative tab at the moment because I register the creative tab in preInit in my main mod folder, whereas all the items and blocks are being registered using the Register events which run before everything
    1 point
  6. Alright, I have set up everything and I must say that I'm impressed with how neat this solution is. Kudos!
    1 point
  7. Thanks, it looks good so far! I'll try change up my mod's code and see if it works. This seems like a really clean way of doing things EDIT: Upon further reading, this method of doing it is suuuuper clean and nice. Thanks so much for the resource!
    1 point
  8. So, I have actually been reading up on these, and I have no idea how to implement this within my code. I'm quite confused as to how and when these events get called. I've tried this, but it crashes. public class ModItems { public static Item tinIngot; public static void preInit(){ tinIngot = new ItemTinIngot("tin_ingot", "tin_ingot"); } @SubscribeEvent private static void registerItems(RegistryEvent.Register<Item> event){ event.getRegistry().register(tinIngot); } public static void registerRenders(){ registerRender(tinIngot); } public static void registerRender(Item item){ ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(item.getRegistryName(), "inventory")); } } And here are the first couple lines of the crash: net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Bit Of Everything (boe) Caused by: java.lang.NoClassDefFoundError: io/github/mspacedev/init/ModItems at io.github.mspacedev.BitOfEverything.preInit(BitOfEverything.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    1 point
  9. In ItemStraw, you are calling setRegistryName with null.
    1 point
  10. Post your entire fml-client-latest.log file in spoiler tags please
    1 point
  11. You should try contacting the author of the mod so he can register the ores to the OreDictionary himself. The mod is open-source, so you can also try to make an issue or PR to add it to the mod.
    1 point
×
×
  • Create New...

Important Information

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