Minecraft – way to test for an item that hasn’t been renamed

minecraft-commandsminecraft-java-edition

This is for adventure mode.

Is there a way to test for an item that hasn't been renamed?

I'm trying to test if a player has an item

(ie. wooden pickaxe)

and then i want to replace it with the same type of item with a different tag

(ie. wooden pickaxe named super miner and can destroy stone).

The way i have it it replaces the normal pickaxe with the custom pickaxe but then it replaces the custom pickaxe with a 2nd custom pickaxe and it keeps going.

Best Answer

I tried several commands but i could not find a way to check if a item was not renamed.

You can check, if a pickaxe was crafted:

Create a scoreboard:

/scoreboard objectives add craftedPick stat.craftItem.minecraft.wooden_pickaxe

Then the following commands in a chain:

/give @a[score_craftedPick_min=1] minecraft:wooden_pickaxe 1 1 {YOUR_TAGS}
/scoreboard players remove @a[score_craftedPick_min=1] craftedPick 1
/clear @a minecraft:wooden_pickaxe 0 1

enter image description here

Plugin to create those command block text entities: https://www.spigotmc.org/resources/commanddesciptor.23870/

Related: Replace the item crafted with a tag