Jump to content

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


Recommended Posts

Posted (edited)

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:

 

    @Override
    public boolean hasContainerItem(ItemStack stack) {
        return true;
    }

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

 

Edited by SolidCraft
Solved. Don't used Item Id's lol
Posted

You should NEVER use numeric ids for any registry objects.

Use the proper item references.

  • Thanks 1

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
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

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

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

Announcements



×
×
  • Create New...

Important Information

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