Jump to content

Recommended Posts

Posted

No one is going to download your zip file and explore it.

Post your code as a working github repository.

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.

Posted (edited)

And please make sure your git root is in the same directory as the .gitignore that Forge's MDK provides, this will make sure that the repository respects and ignores the proper files

Edited by DaemonUmbra

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

It depends what Forge version you're using, and how you've done it.

For creating items in 1.12, this is my method (not saying it's the best):

 

1) Create a registration class annotated with:

@Mod.EventBusSubscriber

 

2) Create an object holder annotation and constant for each item:

@GameRegistry.ObjectHolder(MOD_ID + ":your_item_name")
public static final YourItemClass YOUR_ITEM = new YourItemClass();

 

3) Create an array of items and store each item in it. I know this isn't ideal but it works:

private static final Item[] ITEMS =
  {
    YOUR_ITEM,
    ANOTHER_ITEM,
    ETC
  };

 

4) Subscribe to the item registration event and register your items:

@SubscribeEvent
protected static void registerItems(RegistryEvent.Register<Item> event)
{
   final IForgeRegistry<Item> registry = event.getRegistry();
   registry.registerAll(ITEMS);
}

 

3) Subscribe to the model registration event and register your item models:

@SubscribeEvent
protected static void registerItemRenderers(ModelRegistryEvent event)
{
   for (Item item : ITEMS)
   {
      ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
   }
}

 

And that's it!

For blocks it's a similar process, except you also need to create and register an ItemBlock for each block. Your blocks class should subscribe to the RegistryEvent.Register<Item> event to do this. Make sure for blocks you change the <Item> to <Block>.

 

I hope you find this helpful.

Posted (edited)

But he didn't use a stupid IHasModel interface! ?

Edited by Draco18s

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.

Posted (edited)

Because you can't control the order of static initializers.

If you created a new class called ModTabs and created CreativeTabs in a static initializer and those constructors reference an item in your ModItems class (what item it uses for an icon), and an item references ModTabs in its constructor (what tab it appears in)....

 

Which one gets created first and has a null value?

 

i.e. do you have a tab with a null icon?

or do you have an item with a null creative tab?

Edited by Draco18s

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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