Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

  • Author
1 hour ago, izofar said:

ItemGroup belongs to the net.minecraft.item package, not "items"

that doesn't work either 

:(

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

  • Author
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!!

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.