Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

error: package net.minecraft.item does not exist import net.minecraft.item.ItemGroup;


parkat
 Share

Recommended Posts

I am new to modding and I'm sure this is a simple fix but I cannot for the life of me figure out why this error is thrown. 

I am running forge-1.17.1-37.0.90 and all other aspects seem to be working fine

I am following this tutorial https://thebookofmodding.ml/adding-custom-items/

here is my code (sorry its messy rn) [registryhandler class]

https://imgur.com/a/EGC2jyj

package com.example.examplemod;

import net.minecraft.item.ItemGroup;
import net.minecraft.world.item.Item;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fmllegacy.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
/*
public class RegistryHandler {
    // create DeferredRegister object
    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ExampleMod.MODID);

    public static void init() {
        // attach DeferredRegister to the event bus
        ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }

    // register item
   public static final RegistryObject<Item> COPPER = ITEMS.register("copper", () ->
        //    new Item(new Item.Properties().group(ItemGroup.MATERIALS))
       //     );
                new Item(
                    new Item.Properties().group(ItemGroup.MATERIALS)
           )
    );

 */
    public class RegistryHandler {
        public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ExampleMod.MODID);

        public static void init() {
            // attach DeferredRegister to the event bus
            ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
        }

        public static final RegistryObject<Item> TITAN = ITEMS.register("titan",
                ()-> new Item(new Item.Properties().group(ItemGroup.REDSTONE)));
    }

 

Edited by parkat
Link to comment
Share on other sites

Forge use now Mojang class names and their package names, you can use the Forge bot on discord to convert from mcp to moj mappings 

But I would recommend you to use this scrip it will update your hole project automatically 

Edited by Luis_ST
Link to comment
Share on other sites

12 hours ago, Luis_ST said:

Forge use now Mojang class names and their package names, you can use the Forge bot on discord to convert from mcp to moj mappings 

But I would recommend you to use this scrip it will update your hole project automatically 

thank you! this works!!

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.