Jump to content

MSpace-Dev

Members
  • Posts

    180
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MSpace-Dev

  1. Alright, I have set up everything and I must say that I'm impressed with how neat this solution is. Kudos!
  2. 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!
  3. 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)
  4. This is all you need. Just skip ahead a little bit to find the part where he runs 'genIntelliJRuns' Forge MDK Setup in IntelliJ 2017 - djsmeguk
  5. 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!]
×
×
  • Create New...

Important Information

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