Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Problem with registering an item.
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
FOGC123

Problem with registering an item.

By FOGC123, April 4, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

FOGC123    0

FOGC123

FOGC123    0

  • Tree Puncher
  • FOGC123
  • Members
  • 0
  • 18 posts
Posted April 4, 2020

I've been following a tutorial(https://cadiboo.github.io/tutorials/1.15.1/forge/) and i was having problems with registering items. The game launches fine, my mod gets loaded, but i can't get my item with the /give command. I see a one possible problem. The tutorial is using 1.15.1 and I am using 1.15.2(but i doubt that would make a big difference).

 

My main mod class:

package com.fogc123.randomadditions;
import net.minecraftforge.fml.common.Mod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


@Mod(Main.MODID)
public final class Main {
    public static final String MODID = "random_additions";
    public static final Logger LOGGER = LogManager.getLogger();

    public Main()
    {
        LOGGER.debug("HI!");
    }
}

 

My modeventsubscriber class:

package com.fogc123.randomadditions;

import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;

@Mod.EventBusSubscriber(modid = Main.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public final class ModEventSubscriber {

    @SubscribeEvent
    static void onRegisterItems(RegistryEvent.Register<Item> event)
    {
        //change this l8r
       event.getRegistry().registerAll(setup(new Item(new Item.Properties()), "first_item"));
    }
    public static <T extends IForgeRegistryEntry<T>> T setup(final T entry, final String name) {
        return setup(entry, new ResourceLocation(Main.MODID, name));
    }

    public static <T extends IForgeRegistryEntry<T>> T setup(final T entry, final ResourceLocation registryName) {
        entry.setRegistryName(registryName);
        return entry;
    }


}

And my mods.toml if that is needed

# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here:  https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="random_additions" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${version}" #mandatory
 # A display name for the mod
displayName="Random Additions" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
updateJSONURL="http://myurl.me/" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://example.com/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="icon.png" #optional
# A text field displayed in the mod UI
credits="Random stuff" #optional
# A text field displayed in the mod UI
authors="FOGC123" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
Random stuff i wanted to add.
'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.examplemod]] #optional
    # the modid of the dependency
    modId="forge" #mandatory
    # Does this dependency have to exist - if not, ordering below must be specified
    mandatory=true #mandatory
    # The version range of the dependency
    versionRange="[31,)" #mandatory
    # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
    ordering="NONE"
    # Side this dependency is applied on - BOTH, CLIENT or SERVER
    side="BOTH"
# Here's another dependency
[[dependencies.examplemod]]
    modId="minecraft"
    mandatory=true
    versionRange="[1.15.2]"
    ordering="NONE"
    side="BOTH"

Thanks!

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted April 4, 2020
7 minutes ago, FOGC123 said:

bus = Mod.EventBusSubscriber.Bus.FORGE

This line is your problem. It's supposed to be Bus.MOD

  • Quote

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Share this post


Link to post
Share on other sites

FOGC123    0

FOGC123

FOGC123    0

  • Tree Puncher
  • FOGC123
  • Members
  • 0
  • 18 posts
Posted April 4, 2020
4 minutes ago, Animefan8888 said:

This line is your problem. It's supposed to be Bus.MOD

Thanks so much! Are there any significant differences between 1.15.1 and 1.15.2?

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted April 4, 2020
3 minutes ago, FOGC123 said:

Thanks so much! Are there any significant differences between 1.15.1 and 1.15.2?

If there are it is a very small amount and you shouldn't run into any problems following that tutorial. However if you do you can always come back here or check out other tutorials. I'm currently working on video tutorials.

  • Quote

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Share this post


Link to post
Share on other sites

llamacorn1921    0

llamacorn1921

llamacorn1921    0

  • Tree Puncher
  • llamacorn1921
  • Members
  • 0
  • 12 posts
Posted November 25, 2020

 also having trouble with that same tutorial. the picture he has dose not help at all. do i need the example mod? because i moved it out of my project folder and changed all the "examplemod" stuff to my mod name

  • Quote

Share this post


Link to post
Share on other sites

llamacorn1921    0

llamacorn1921

llamacorn1921    0

  • Tree Puncher
  • llamacorn1921
  • Members
  • 0
  • 12 posts
Posted November 25, 2020

nvm. i added all that stuff back. it works now!

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • brok4d
      OBJ MODELS

      By brok4d · Posted 41 minutes ago

      Hello, this mod is the source, you have to get boredhttps://gitlab.com/Lycanite/LycanitesMobs
    • JayNeedsHelp
      Logger not working

      By JayNeedsHelp · Posted 1 hour ago

      So I'm currently creating a forge mod and I'm having an issue where the console stops logging after some errors. It seems to be connected to the access transformers that I'm using as before I added at's my console was working fine.   Here is my at file:  public-f net.minecraft.client.Minecraft session public net.minecraft.client.Minecraft timer public net.minecraft.client.gui.GuiScreen buttonList public net.minecraft.util.Timer tickLength public net.minecraft.network.play.client.CPacketPlayer onGround public net.minecraft.network.play.server.SPacketEntityVelocity motionX public net.minecraft.network.play.server.SPacketEntityVelocity motionY public net.minecraft.network.play.server.SPacketEntityVelocity motionZ public net.minecraft.network.play.server.SPacketExplosion motionX public net.minecraft.network.play.server.SPacketExplosion motionY public net.minecraft.network.play.server.SPacketExplosion motionZ public net.minecraft.client.renderer.entity.RenderManager renderPosX public net.minecraft.client.renderer.entity.RenderManager renderPosY public net.minecraft.client.renderer.entity.RenderManager renderPosZ   Any help is greatly appreciated thank you!
    • cadbane86140
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140 · Posted 2 hours ago

      Hello There! Today we are back on Hunger Games after a little break but we are finally back! In this episode we are on the good ol' map Survival Games 4 and it ACTUALLY went well for once. Also we have so many great battles on rooftops, small rooms and just out in the open! We also use shears to fight at one point and that was pretty crazy! There are so many hilarious moments in this episode that I know you guys are gonna love! I hope you all enjoy this video and if you did don't forget to like and sub for more Hunger Games in the future!  
    • Sad Whale
      Game crashes whenever I try to increase the RAM

      By Sad Whale · Posted 2 hours ago

      latest.log
    • diesieben07
      Game crashes whenever I try to increase the RAM

      By diesieben07 · Posted 3 hours ago

      In the logs folder of your game directory.
  • Topics

    • Milk_Shak3s
      1
      OBJ MODELS

      By Milk_Shak3s
      Started 16 hours ago

    • JayNeedsHelp
      0
      Logger not working

      By JayNeedsHelp
      Started 1 hour ago

    • cadbane86140
      0
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140
      Started 2 hours ago

    • Sad Whale
      6
      Game crashes whenever I try to increase the RAM

      By Sad Whale
      Started 4 hours ago

    • Unusualty
      0
      GUI'S and player editing

      By Unusualty
      Started 3 hours ago

  • Who's Online (See full list)

    • xcheetoezx
    • brok4d
    • Twu
    • dresacraft
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Problem with registering an item.
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community