• 0

    posted a message on Problems with Item Registry in Modding with Forge

    Yes, I did. It's registerItems now.

    Posted in: General Discussion
  • 0

    posted a message on Problems with Item Registry in Modding with Forge

    Where's the uppercase method name?

    Posted in: General Discussion
  • 0

    posted a message on Problems with Item Registry in Modding with Forge

    Okay, I found out.

    For other new mod authors, you have to do something like this:

    public class ItemBase extends Item {
             public ItemBase(String name) {
                    setUnlocalizedName(name);
                    setRegistryName(name);
                    ModItems.ITEMS.add(this);
    }

     ModItems would be a class which looks like this:

    public class ModItems { <br />          public static final List&lt;Item&gt; ITEMS = new ArrayList&lt;Item&gt;; <br />          Item OBSIDIAN_INGOT = new ItemBase("obsidian_ingot");<br />}

     and finally, in an other class you would write this:

    @EventBusSubscriber
    public class RegistryHandler {
              @SubscribeEvent
              public static void register(RegistryEvent.Register<Item> event) {
                        event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]))
             }
    }

     

    Posted in: General Discussion
  • 0

    posted a message on Best Minecraft Mods (Not modern)

    Bewitchment is a Witchery spiritual successor.

     

    Posted in: General Discussion
  • 0

    posted a message on Problems with Item Registry in Modding with Forge

    Dear Modding Community!

    I'm making an example mod to learn modding with Forge. I already hava Java knowledge, but this seems to be a question that isn't answered in the Forge documentation: Where shall I put the item registry code, you know, this:

    @SubscribeEvent
    public void Registry(RegistryEvent.Register<Item> event) {
            ForgeRegistries.ITEMS.register(item_name);
    }

     I have put it into the "item initialization method" like this:

    @SubscribeEvent
    public static void Register(RegistryEvent.Register<Item> event) {
            Item obsidian_ingot = new Item();
            obsidian_ingot.setUnlocalizedName("obsidian_ingot");
            obsidian_ingot.setRegistryName("obsidian_ingot");
            obsidian_ingot.setCreativeTab(CreativeTabs.MISC);
            ForgeRegistries.ITEMS.register(obsidian_ingot);
    }

     , but when I run the main class of the mod and get into the misc creative tab, there's nothing. I tried /give @p examplemod: and pressing TAB, but there was no item in the mod.

    I hope somebody knows where to put this registry stuff and helps me.

    ~~wunst42

    Posted in: General Discussion
  • To post a comment, please or register a new account.