Difficulty in registering mod item to ItemGroup (1.21.5) #4679
              
                Unanswered
              
          
                  
                    
                      duskingtide
                    
                  
                
                  asked this question in
                Mod Dev Support
              
            Replies: 1 comment
-
| public class Culinaria implements ModInitializer {
    public static final String MOD_ID = "culinaria";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
    @Override
    public void onInitialize() {
        LOGGER.info("Hello Fabric world!");
        CulinariaItems.initialize();
        ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK)
                .register((itemGroup) -> itemGroup.add(CulinariaItems.FISH_SANDWICH));
    }
} | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Heya, I'm really new to modding so please go easy on me! Been following the posted documentation for Fabric modding and I've hit a snag in registering my modded item to an ItemGroup. Here's a snippet from my Mod.java:
Attempting to build the project gets me a few errors, as follows:

I suspect I've not placed
ItemGroupEvents.modifyEntriesEventin the correct place, but I can't tell. Wiki says to add it to the mod items class initializer method which I have done. I do see that the documentation is intended for 1.21.4, not 1.21.5, but also can't tell whether this is a code error or a 'you're using documentation for the wrong version you idiot' error. Any advice is greatly appreciated! Thank you!Beta Was this translation helpful? Give feedback.
All reactions