Get item by numerical id

I’m currently working on a plugin that prompts a user for an item. I want them to be able to type in the numerical value of that item. (ie 5 = wood planks, or 5:4 = acacia wood planks).

Do I have to create a map that maps each item to a standard id? (ie 17 => minecraft:log)

Or is there a way to do this through Sponge? I’m using SpongeVanilla.

I don’t believe so. an ItemStack does not hold the numerical id of the item accept for the unsafe damage value for item variants like color and wood. Curious of your reasoning for this?

Minecraft doesn’t use numerical IDs anymore, at least not publicly. If you’re just looking to be able to get an ItemType from a command, you can use GenericArguments.catalogType.

1 Like

I sort have figured it out. The only issue is that it seems like you have to type something like “minecraft:log” in, in order to get an item. Instead of using number values or strings.

Since the way I want this to work doesn’t seem possible with the current configuration of Minecraft. I think I’m just going to make a file that is stored as a sort of config that maps all the integer and string values to a Minecraft ID. This will also make items user customizable so they can have their own names or ids for items.

Unless there is a better way to go about doing this. I’m open to suggestions. Thank you @TrenTech & @pie_flavor

I’m still wondering why you need numerical IDs in the first place. Minecraft no longer works with them.

1 Like

If I were you, I would just use the String version of the item id, such as minecraft:log. It has many benefits as compared to the numerical ids:

  • It is the “new way” of doing ids, Minecraft does not even support numerical ids
  • It has inherit support for mods
  • Easier for your users to remember
  • You do not have to map a number to the String id
  • If you did use numerical ids, it would break support for mods unless you explicitly add the mod to your map
1 Like


I wasn’t aware that they weren’t a thing. I’m making a shop plugin, I started one for spigot, but noticed how well sponge was coming along so I decided to use this instead.

I just think it’s much nicer for a player to be able to browse a shop, have the item name, id, and price displayed to them. Then they could just use the id or name to purchase the item. numerical ID was always the quickest, nicest looking option.

EDIT: I think I found a solution that would work even better than numerical IDs. I really appreciate the help from the three of you! :slight_smile:

Just a quick tip - Sponge uses the Discourse forum software; if you click Reply to someone’s message, it’s the equivalent of tagging them.

I replied to Flibio.

Anyway, if I were making a sign shop plugin, I’d use a command to create the sign, and have the actual shop info on the sign as NBT. Then the sign can say whatever you want.