#Assigning A Tag To An Item Based On It's NBT

1 messages · Page 1 of 1 (latest)

unique silo
#

As the title suggests, is there a way to assign an item tag (i.e. forge:cobblestone) to an item with specific NBT data (i.e. if "stone" is present in it's NBT).

Script below is an attempt I made, led to a crash lol lmfao

ServerEvents.tags('item', event => {
      event.add('medievalorigins:is_golden_weapon', Item.of("tetra:modular_sword", '{display:"/^Gold*/"}'))
})
gilded loomBOT
#

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

viscid tapir
#

@unique silo I just saw this earlier while searching for something else.
#1395726785223589908 message

mortal wedgeBOT
#

[➤](#1395726785223589908 message)
wanting to add a tag each base color of leather chestplate and can't work out how to include the nbt in the list, stuck here:
event.add('modpack:primary_leather_chestplate_colours', ['minecraft:leather_chestplate'])

viscid tapir
unique silo
#

a h

#

so I'll take that as a No I Can't Do That

viscid tapir
#

I don't think so?

#

You are on a different version

unique silo
#

1.20.1 Forge

viscid tapir
#

But I can't recall... seeing this proven otherwise

unique silo
#

yeah I was gonna try some jank to read the display name instead of the NBT (i.e. Is a Sword with display keyword "Gold") but im lost at that

unique silo
viscid tapir
#

Yeah I'm logging onto Minecraft right now to see if I can find something that proves this otherwise

unique silo
#

I'll leave this open for now then 👍

clever cape
unique silo
# clever cape Why do you need the tag?

ok so
there's this origin, Goblin, gets a buff on gold tools and such, the buff is applied to items with the tag
I wanna expand what the tag applies to, including Tetra tools, hence NBT shenanigans

clever cape
#

That's what the origin does right? If you can't directly integrate the item into the origin handler then why not make a parallel system?

unique silo
clever cape
clever cape
#

Gotcha. Let me check the source then

unique silo
#

I have a very cursary knowledge on origins and datapacks, but I did unpack it to get that tag info

viscid tapir
unique silo
clever cape
#

I noticed that as well. It's listed in the goblin origin json, at least

viscid tapir
#

So I don't think item tags on things based on NBT is possible because I couldn't find a single item in the vanilla game that demonstrates this working and then I tried thinking of a single mod where this situation exists and it ends up being a different item.

unique silo
viscid tapir
#

What?

#

Oh lemme read up I guess

unique silo
#

(tl;dr the tag is for origins compat, so I'll work that way in)

viscid tapir
#

Okay you can also use KubeJS for testing what item they're holding and applying a effect

#

However if you want to use origins then you're free to do so

clever cape
#

I mean, you could do some nbt transfer shenanigans and swap tetra:modular_sword for kubejs:gold_sword and then somehow integrate your KJS item back into tetra, but all that seems like it's almost more trouble than it's worth

unique silo
viscid tapir
#

I just haven't heard from my friend, who likes the mod, good things about the json files. To be fair, he was comparing it to kubejs.

clever cape
#

Is there no way to check for the nbt of an item in origins?

clever cape
unique silo
viscid tapir
#

They work in Json files. Again, from what I've heard. They can't do much outside of what the mod already allows because when you step off that foundation there's zero log.

#

No probejs

unique silo
#

I don't use probeJS anyway, I prefer my suffering raw

unique silo
#

anyway if that's that I'll do a little tl;dr and close the ticket
cheers for the help 👍

viscid tapir
#

Wait

unique silo
#

waiting

viscid tapir
#

Oh wow that worked

#

So

#

Basically are you closing the ticket, then reopening the one about this "Testing for item in hand to apply affect" or are you using origins?

unique silo
viscid tapir
#

All right, see ya, and good luck

unique silo