#How to get all tags of an item

6 messages · Page 1 of 1 (latest)

empty kestrel
#

If I have an item id like "thermal:silver_ingot", I want to simply get all the tags of it as a JS string array: ["forge:ingots", "forge:ingots/silver"]. How do I do that?

What I've tried:

let item = Item.of(itemId);

let tags = [];
item.getTags() // Java Collection<ResourceLocation>
  .forEach((t) => tags.push(t.toString()));

I get this error:

[ERROR] ! Error in 'ServerEvents.tags': class dev.latvian.mods.rhino.MemberBox (in module rhino) cannot access a member of class java.util.stream.ReferencePipeline$Head (in module java.base) with modifiers "public"
[21:51:27] [ERROR] ! java.lang.IllegalAccessException: class …rhino.MemberBox (in module rhino) cannot access a member of class java.util.stream.ReferencePipeline$Head (in module java.base) with modifiers "public"

Similar issue, unresolved:
https://discord.com/channels/303440391124942858/1148653896722554920

warped totemBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

empty kestrel
#

For context, what I am trying to do is remove duplicate items (multiple mods adding the same items) like golden plates from the thermal series and golden sheets from create.

I first get all items with the tag "forge:plate" with let allPlates = Ingredient.of("#forge:plate").getItemIds()

Now I want to group them by material to see what materials have multiple plates. To get the material of a plate I need to get its other tag like "forge:plate/gold" so I know it's a golden plate. I cannot know it is a golden plate with the item id only since the id naming doesn't seem to be as consistent as the tag. (it's thermal:gold_plate, but create:golden_sheet)

I am adding this context cuz I may be lost as I am a complete beginner but yeah.
TLDR I am trying to get the name of the material of an item (through the tag)

#

Oh found the solution, sorry!
let tags = item.tags.map(tag => tag.location().toString()).toList()

fierce cliff