Jump to content

SOLVED. getItemById giving me the wrong items? (1.16.1)


Recommended Posts

Hello, I am trying to do a quick little override with a custom item so that it gives you back a glass bottle when you craft with my item (similar to crafting with a milk bucket). According to various wiki's the glass bottle's numeric Id is 374 but when I use that I get a lilac back instead? I'm not sure if this is due to Minecraft steering away from the numeric Id's but I couldn't figure out how to use the namespaced id since I am still new to this. Thanks in advance.


Here's part of the code:


    public boolean hasContainerItem(ItemStack stack) {
        return true;

    public ItemStack getContainerItem(ItemStack itemStack) {
        ItemStack cm = new ItemStack(getItemById(374));
                return cm;


Edited by SolidCraft
Solved. Don't used Item Id's lol
Link to comment
Share on other sites

18 hours ago, poopoodice said:

You can get vanilla items directly from Items, instead of using numeric ids (which shouldn't be used).


17 hours ago, LexManos said:

You should NEVER use numeric ids for any registry objects.

Use the proper item references.

Yeah I just used Items.GLASS_BOTTLE I don't really know why I got stuck on this haha. Thanks for the support

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.

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.


  • Create New...

Important Information

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