Jump to content

Problem with registering an item.


FOGC123

Recommended Posts

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!

Link to comment
Share on other sites

7 minutes ago, FOGC123 said:

bus = Mod.EventBusSubscriber.Bus.FORGE

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

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.

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

  • 7 months later...

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • On the web there are a lot of custom player totem resource-packs available. But they all require a copy of the player-skin-texture renamed as the totem-texture. This requires reinstalling the pack every time, when you change your player-skin. So i think about making a mod to reproduce how player-head-blocks get their texture. How can i do this while using a a custom json item-model, that i created in blockbench, that a player-skin fits on? I taught about having both arm sizes in the model and find a way to detect the model width (3-pix-arms or 4-pix-arms), that the given player uses to hide or shor each arms on the model.   Best regards Maxi
    • There is an issue with backpacked and framework Try other builds of these mods
    • so i don't really know how to fix this if some one know more about this pleas help thanks here's the log side note it doesn't give me a crash report for this.   [21Apr2024 15:46:52.647] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.8 by Microsoft; OS Windows 10 arch amd64 version 10.0 [21Apr2024 15:46:55.474] [main/INFO] [gg.essential.loader.stage1.EssentialLoaderBase/]: Starting Essential Loader (stage2) version 1.6.0 (8fe36b19522693d84f4de27ad4accf3f) [stable] [21Apr2024 15:46:55.526] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/Massimo/curseforge/minecraft/Install/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2397!/ Service=ModLauncher Env=CLIENT [21Apr2024 15:46:57.087] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Massimo\curseforge\minecraft\Install\libraries\net\minecraftforge\fmlcore\1.19.2-43.3.5\fmlcore-1.19.2-43.3.5.jar is missing mods.toml file [21Apr2024 15:46:57.091] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Massimo\curseforge\minecraft\Install\libraries\net\minecraftforge\javafmllanguage\1.19.2-43.3.5\javafmllanguage-1.19.2-43.3.5.jar is missing mods.toml file [21Apr2024 15:46:57.095] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Massimo\curseforge\minecraft\Install\libraries\net\minecraftforge\lowcodelanguage\1.19.2-43.3.5\lowcodelanguage-1.19.2-43.3.5.jar is missing mods.toml file [21Apr2024 15:46:57.099] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Massimo\curseforge\minecraft\Install\libraries\net\minecraftforge\mclanguage\1.19.2-43.3.5\mclanguage-1.19.2-43.3.5.jar is missing mods.toml file [21Apr2024 15:46:57.310] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File:  and Mod File: . Using Mod File: [21Apr2024 15:46:57.312] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 12 dependencies adding them to mods collection [21Apr2024 15:46:57.398] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found Kotlin-containing mod Jar[union:/C:/Users/Massimo/curseforge/minecraft/Instances/Five%20Nights%20at%20Freddy's/essential/libraries/forge_1.19.2/kotlin-for-forge-3.6.0-slim.jar%23394!/], checking whether we need to upgrade it.. [21Apr2024 15:46:57.400] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found outdated Kotlin core libs 0.0.0 (we ship 1.9.10) [21Apr2024 15:46:57.400] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found outdated Kotlin Coroutines libs 0.0.0 (we ship 1.7.3) [21Apr2024 15:46:57.400] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found outdated Kotlin Serialization libs 0.0.0 (we ship 1.6.0) [21Apr2024 15:46:57.401] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Generating jar with updated Kotlin at C:\Users\Massimo\AppData\Local\Temp\kff-updated-kotlin-10778581722359704112-3.6.0-slim.jar  
    • Do I should not play the Eyemod in my server? But when I play singleplayer with the mod, it works 
  • Topics

×
×
  • Create New...

Important Information

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