0

Context: Ok, so I am making some custom enchantment stuffs and I want to be able to change the NBT data of the item, the way I am doing it is just making the players put the items into a chest then /fill destroy and killing the chest item, since the items are now entities I can use /entitydata to edit the items NBT datas, I've done this pretty well to an extent. I've looked around to no avail.

Problem: entitydata @e[type=Item,c=1] {Item:{tag:{Tags:[hi]}}} works, it gives the player a stone with the tag "hi" entitydata @e[type=Item,c=1] {Item:{tag:{Tags:[hi,hello,test]}}}

The 2nd problem is, even if I try to use lore and just use the section sign or something to make an "invisible string" it just replaces the lore with the new one, is there any thing that I can use to "add" NBT data to something like mentioned above?

Also, if I were to run a /scoreboard players add {data} how would I make the data be separate, so I could run executes on it, and players holding those items, say if a player was holding something with the tags: [kill,fly] when I execute on it, I can make the player execute the kill function and the fly function

5
  • I just saw your edit after I answered. You should not ask more then one question within a question. I recommend removing the edit information and asking another question after you have searched for an answer. Try to clarify what you are asking as it is quite difficult to make sense of your questions.
    – IronAnvil
    Jun 15, 2018 at 2:13
  • They're all the same question, give/edit/execute on items with multiple tags
    – Devan S.
    Jun 15, 2018 at 2:48
  • 4
  • @pppery Are you sure? This is a 1.12- command, clearly they are looking for 1.12- answers... Jul 30, 2021 at 3:42
  • 1
    This question was asked before 1.13 was released. I believe that questions referencing what was the current version of Minecraft at the time they are asked should be assumed to continue to reference the current version of Minecraft, rather than forcing every question to become obsolete with each update.
    – pppery
    Jul 30, 2021 at 3:51

1 Answer 1

0

No, you can not currently add NBT data to data which already exists. You have to overwrite the existing data in order to modify it. I am referring to lore with this.

In the case of scoreboard tags, you can add and remove specific tags without modifying the rest, but not with the entitydata command.

You have to use the scoreboard tag commands for this:

scoreboard players tag <entity> add <tagName> [dataTag]
scoreboard players tag <entity> remove <tagName> [dataTag]
4
  • Hm, alright I found a "undesirable" way to do it, since swords and pickaxes don't use the protection enchant, I just enchanted the item with protection and then scoreboard-executed on that, and obviously hid enchants, the problem here is Is A: I don't know how to add enchants with entitydata and B: How to show the enchants that actually do affect the weapon like sharpness etc.
    – Devan S.
    Jun 15, 2018 at 2:46
  • That is not a good way to do it. Much more complicated then needed. Do you discord?
    – IronAnvil
    Jun 15, 2018 at 2:51
  • Actually, I just found a simple way, I'm quite dumb :P I'll send /minecraft:give @p stone 1 0 {test:1,tester:0,testest:1} scoreboard players tag @p add test {SelectedItem:{tag:{test:1}}} But I'm still stuck with how to add lore, this is probably a job for plugins, sigh ;(
    – Devan S.
    Jun 15, 2018 at 2:56
  • @DevanS. I don't recommend doing it that way either. Using scoreboard tags will accomplish what you want as far as tagging items and being able to execute based on them. If you are wanting to add lore to an item, which already has lore, the only way to do it is to overwrite the existing. You could test for specific lore and overwrite with the old lore as well as a new line. It would appear to add a new line to the players. However, if you want multiple combinations of lore, this would require a lot of commands.
    – IronAnvil
    Jun 19, 2018 at 14:48

Not the answer you're looking for? Browse other questions tagged .