For example, say I want to check a player's inventory for an Iron Sword; if they have one, it's removed, and replaced by another Iron Sword - one with stats, a name, and other modifications. Is it possible to tell the game in a /clear command only to remove unmodified Iron Swords, e.g. a freshly crafted or dropped item, but not one which has been altered?
My original plan was to identify unmodified items by their damage values, newly created gear always having a value of 0, the modified replacement would have a damage of 1 and set to unbreakable.
This is problematic for two reasons: first because the item would vanish if repaired, and second because items with Unbreakable and a damage value of anything but 0 will not render.
I can get around the latter problem by dropping Unbreakable, but the item will eventually, well, break, and the former problem remains unresolved.
For example, say I want to check a player's inventory for an Iron Sword; if they have one, it's removed, and replaced by another Iron Sword - one with stats, a name, and other modifications. Is it possible to tell the game in a /clear command only to remove unmodified Iron Swords, e.g. a freshly crafted or dropped item, but not one which has been altered?
My original plan was to identify unmodified items by their damage values, newly created gear always having a value of 0, the modified replacement would have a damage of 1 and set to unbreakable.
This is problematic for two reasons: first because the item would vanish if repaired, and second because items with Unbreakable and a damage value of anything but 0 will not render.
I can get around the latter problem by dropping Unbreakable, but the item will eventually, well, break, and the former problem remains unresolved.
Try this : /clear @a iron_sword 0 1 {display:{Name:Iron Sword}} then, name the sword with stats Iron_Sword or something. Hope I helped
EDIT: If the stats sword has lore, just test for that instead i.e. {display:{Lore:[LORE HERE]}}
Unmodified tools have no extra data to work with, meaning the "display" tag does not exist. Due to the lack of data, there is no direct way to target an unmodified item with /clear, and cannot be done accurately without many command blocks checking individual slots in the player's inventory.
Unmodified tools have no extra data to work with, meaning the "display" tag does not exist. Due to the lack of data, there is no direct way to target an unmodified item with /clear, and cannot be done accurately without many command blocks checking individual slots in the player's inventory.
I see, thanks for the help anyways! Maybe I'll put in a feature request...
For example, say I want to check a player's inventory for an Iron Sword; if they have one, it's removed, and replaced by another Iron Sword - one with stats, a name, and other modifications. Is it possible to tell the game in a /clear command only to remove unmodified Iron Swords, e.g. a freshly crafted or dropped item, but not one which has been altered?
My original plan was to identify unmodified items by their damage values, newly created gear always having a value of 0, the modified replacement would have a damage of 1 and set to unbreakable.
This is problematic for two reasons: first because the item would vanish if repaired, and second because items with Unbreakable and a damage value of anything but 0 will not render.
I can get around the latter problem by dropping Unbreakable, but the item will eventually, well, break, and the former problem remains unresolved.
Any help would be greatly appreciated, thanks.
Try this : /clear @a iron_sword 0 1 {display:{Name:Iron Sword}} then, name the sword with stats Iron_Sword or something. Hope I helped
EDIT: If the stats sword has lore, just test for that instead i.e. {display:{Lore:[LORE HERE]}}
Subscribe on YT! Im awesome!
Unmodified tools have no extra data to work with, meaning the "display" tag does not exist. Due to the lack of data, there is no direct way to target an unmodified item with /clear, and cannot be done accurately without many command blocks checking individual slots in the player's inventory.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
I see, thanks for the help anyways! Maybe I'll put in a feature request...