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.

Featured Replies

  • Author
2 minutes ago, Doublecaster said:

I believe that the JSON file names are case sensitive. Try renaming itemvapestick.json to ItemVapeStick.json

Nope, that didn´t help.

Items and other IForgeRegistryEntry implementations must be registered in RegistryEvent.Register<> event.
Models must be registered with ModelLoader in ModelRegistryEvent event client-side.

Documentation on events here.
Documentation on 'registering things' here.
A proper way to register a model of an item is

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));


Please share this message to similar threads so people don't waste their time writing it over and over again.

8 minutes ago, Doublecaster said:

I believe that the JSON file names are case sensitive. Try renaming itemvapestick.json to ItemVapeStick.json

Please don't mislead people providing information you understand nothing about.

Found your problem. You're assigning "ItemVapeStick" as a registry name. Everything related to resources must be lowercase.

In order for models to function properly in IDE, you might need to have pack format set to 3.
Create pack.mcmeta file in resources directory with the following content:

{
    "pack": {
        "description": "Mod's resources",
        "pack_format": 3
    }
}



By the way, what the pokemon is VapeItems enum in Reference.java? I kinda understand what it's for, but it only makes code hard to read and confuses everyone.

Edited by MrBendelScrolls
Sneaky 8-length tab

  • Author

So...

I tried to fix the ModItems.java but I feel like I just more screwed it up... Here is a result:

public class ModItems {
    
    public static Item vapestick;
    
    public static void init() {
        
        vapestick = new ItemVapeStick();
    }
    
    public static void register() {
        GameRegistry.register(vapestick);
    }
    
    public static void registerRenders() {
        registerRender(vapestick);
    }
    
    private static void registerRender(Item item) {
        System.out.println(item.getRegistryName());
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    }

    public class EventHandler {
        @SubscribeEvent
        public void pickupItem(EntityItemPickupEvent event) {
            System.out.println("Item picked up!");
        }
            public void registerBlocks(RegistryEvent.Register<Block> event) {
                event.getRegistry().registerAll();
        }
    }

}
 

 

Then in resources, there was pack.mcmeta file already so I edited it (in nope pad) and NoBrainly changed the code to that one you wrote above and lost the original code. After that, I couldn´t run the game, so I was forced to delete the file.

 

I am a real beginner in MC modding and I just feel like I´m not able to do it. Would you be so kind and explain to me how to Register that item. I´m super confused off that article. I just wanted to learn something new. :)

 

This is a good example of using registry events.
One note: client-side ModelLoader can crash a server and shouldn't be used in common code. Solve it your way, just a call to proxy is ok.

 

18 minutes ago, Rasdek11 said:

Then in resources, there was pack.mcmeta file already so I edited it (in nope pad) and NoBrainly changed the code to that one you wrote above and lost the original code. After that, I couldn´t run the game, so I was forced to delete the file.

My fault, sorry. I gave you invalid code, there must be description field.

{
    "pack": {
        "description": "Mod's resources",
        "pack_format": 3
    }
}
  • Author
11 hours ago, diesieben07 said:

It's one of the many MrCrayfish abominations that everyone blindly copies.

So what should I do then... Do you know any other tutorials with updated codes?

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.