Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • SOLVED. getItemById giving me the wrong items? (1.16.1)
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 2
SolidCraft

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

By SolidCraft, September 15, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

SolidCraft    0

SolidCraft

SolidCraft    0

  • Tree Puncher
  • SolidCraft
  • Members
  • 0
  • 2 posts
Posted September 15, 2020 (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 September 15, 2020 by SolidCraft
Solved. Don't used Item Id's lol
  • Quote

Share this post


Link to post
Share on other sites

poopoodice    109

poopoodice

poopoodice    109

  • Dragon Slayer
  • poopoodice
  • Members
  • 109
  • 882 posts
Posted September 15, 2020

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

  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

LexManos    1616

LexManos

LexManos    1616

  • Reality Controller
  • LexManos
  • Forge Code God
  • 1616
  • 8925 posts
Posted September 15, 2020

You should NEVER use numeric ids for any registry objects.

Use the proper item references.

  • Thanks 1
  • Quote

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Patreon: http://www.patreon.com/lexmanos
Paypal: http://paypal.me/LexManos

BitCoin: 1Q8rWvUNMM2T1ZfDaFeeYQyVXtYoeT6tTn

Share this post


Link to post
Share on other sites

SolidCraft    0

SolidCraft

SolidCraft    0

  • Tree Puncher
  • SolidCraft
  • Members
  • 0
  • 2 posts
Posted September 15, 2020
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

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 2
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Woodside
      [1.15.2] Render as 2D icon in GUI, 3D model in hand

      By Woodside · Posted just now

      Seem to be missing RenderMaterial which I cannot find.
    • bleep_blops
      Forge Installation Problem

      By bleep_blops · Posted 10 minutes ago

      Hello! I'm having a weird problem during installation where when I go to download forge 1.12.2 and try and open it, all it does is download another forge file. I've downloaded forge before and notice that instead of having the forge icon it is instead a the google chrome logo. I'm not sure what is causing this and was hoping you could help me. I also should let you know that I have the newest java downloaded. Thanks!
    • Klarks
      [1.16.4] How i can open a container by clicking on my mob

      By Klarks · Posted 15 minutes ago

      I dont quite understand what you mean by this. I created a new class.      NetworkHooks.openGui((ServerPlayerEntity) playerEntity,new MyModContainer(0,new anonymousInnerClass() { },playerEntity.inventory));     public class anonymousInnerClass implements INamedContainerProvider { @Override public ITextComponent getDisplayName() { return new StringTextComponent("Name"); } @Nullable @Override public Container createMenu(int id, PlayerInventory playerInventory, PlayerEntity playerEntity) { return new MyModContainer(id,playerInventory); } }
    • BobbyLikesCake
      1.16.4 (Heavily decent modded with around 150ish mods) Crash with exit code -1 most of the time and sometimes exit code 0.

      By BobbyLikesCake · Posted 31 minutes ago

      Ok, The debug log is here:  https://pastebin.aquilenet.fr/?b2c84859c3c0ad45#26FCvr6VHB8TKL24Ux83N7G1k1eCNAHhQJNaTuAYKLyB
    • diesieben07
      [1.15.2] Render as 2D icon in GUI, 3D model in hand

      By diesieben07 · Posted 41 minutes ago

      In 1.16 Forge has SeparatePerspectiveModel, which you can trivally port to 1.15.
  • Topics

    • Woodside
      2
      [1.15.2] Render as 2D icon in GUI, 3D model in hand

      By Woodside
      Started 1 hour ago

    • bleep_blops
      0
      Forge Installation Problem

      By bleep_blops
      Started 10 minutes ago

    • Klarks
      16
      [1.16.4] How i can open a container by clicking on my mob

      By Klarks
      Started 23 hours ago

    • BobbyLikesCake
      2
      1.16.4 (Heavily decent modded with around 150ish mods) Crash with exit code -1 most of the time and sometimes exit code 0.

      By BobbyLikesCake
      Started 2 hours ago

    • metword
      17
      [1.16.4] Config file will not update.

      By metword
      Started Wednesday at 11:20 AM

  • Who's Online (See full list)

    • bleep_blops
    • BobbyLikesCake
    • Danebi
    • Woodside
    • vemerion
    • Klarks
    • EnergizedAB
    • DaemonUmbra
    • philip-elsner@gmx.net
    • Telmoun
    • Forix
    • Carzival
    • LexManos
    • RafaMv
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • SOLVED. getItemById giving me the wrong items? (1.16.1)
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community