1

I'm making a map for fighting and I made classes to choose from. I condensed it so all you have to do is press a button to scroll through the classes. Once the button is pressed all the command blocks are cloned and replaced to change the specific items in each class. Above the 4 buttons are picture frames with a simple item that compares to the class, like a bow for an archer, sword for warrior and so on. I tried to put a potion in the frame but only got a bottle of water. I tried /summon but the frame and items would pop out when replaced. Lastly, I found this but I don't know where to put the ench tag or how to format it, also don't know how to do the xyz, when I did, it changed every single frame in my world, terrible :(

So my questions are: How do you put enchanted items/potions in an item frame, to a certain coordinate with command block and have them replace?

I'm guessing it should look something like this, and I have no idea where the xyz coordinates go.

/entitydata @e[type=ItemFrame] {Item:{id:minecraft:'item'}}

/entitydata @e[type=ItemFrame] {ench:[{id:minecraft:'enchanted item/potion'}]}
2

The coordinates can be added as target selector arguments, i.e. inside the @e[...], using the x, y, and z arguments, combined with r to set a maximum radius. Note that Tilde notation is not allowed for this, you need the absolute coordinates.

Placing an enchanted item in an Item Frame has to be done all at once, since the entitydata is running on the Item Frame, not on the item that is in it. This is done by setting the Item tag of the item frame to a valid compound NBT structure for an item, such as

{id:"minecraft:stone_sword",tag:{ench:[{id:16,lvl:1}]}}

for a Sharpness I Stone Sword.

Overall, the command you want to be running might look like:

entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=2] {Item:{id:"minecraft:stone_sword",tag:{ench:[{id:16,lvl:1}]}}}

Be careful regarding the closing parentheses.

  • I tried to edit but to late my reply to vpzomtrrfrt was for you. – 76mickd May 3 '15 at 4:36
  • @76mickd Oh, you are correct. Edited the answer. x,y,z only move the center of the search radius, r sets a maximum, to limit it to that position. – MrLemon May 3 '15 at 19:39
  • Ah, gotcha! Here are all the ways I could get them to work but I still can't figure out the splash potions. /entitydata @e[type=ItemFrame,x=-320,y=8,z=-335,r=1] {Item:{id:"minecraft:bow",tag:{ench:[{id:34,lvl:3}]}}} /entitydata @e[type=ItemFrame,x=-324,y=8,z=-335,r=1] {Item:{id:potion,Count:1,Damage:8193}} pink potion /entitydata @e[type=ItemFrame,x=-324,y=8,z=-335,r=1] {Item:{id:potion,Count:1,Damage:20}} green potion /entitydata @e[type=ItemFrame,x=-326,y=8,z=-335,r=1] {Item:{id:"minecraft:iron_chestplate"}} – 76mickd May 4 '15 at 5:07
  • @76mickd Splash potions are just potions with a different data value (DV), i.e. Damage tag. The wiki page lists the DV for all existing splash potions. Here's a list of all existing potion's Data Values. – MrLemon May 4 '15 at 7:51
  • Got it! I also had to use minecraft:air so when replacing items they don't all stay enchanted. For some reason it turns a plain item into an enchanted one. Thanks, both of you, much help, plus others will be able to use it, because there is no info or examples on this command :D /entitydata @e[type=ItemFrame,x=-320,y=8,z=-389,r=1] {Item:{id:"minecraft:air"}} /entitydata @e[type=ItemFrame,x=-320,y=8,z=-335,r=1] {Item:{id:potion,Damage:16428,tag:{CustomPotionEffect:{Item:[{id:7,Amplifier:2,Duration:1000}]}}}} – 76mickd May 5 '15 at 6:35
2

I made a picture of NBT data tree for the frame picture. As stated above, you need to change the data of item frame, not the item inside it. enter image description here

If you wonder what I used for showing this - it is Forge mod for editing NBT data ingame. I think it is superior tool for mapmaking :) You can get it HERE , however you need to have Forge installed. (but in theory, you can edit all you need and then run it with normal vanilla client -> NEEDS verification , however something says me that forge saves are not quite backward compatible with vanilla)

But as always, you can use Commandblock.

0

Try Item:{id:"minecraft:potion",tag:{ench:[{id:16,lvl:1}]}}, replacing the enchantment data with whatever you want. For more information, including potions, check this page on Minecraft Wiki.

  • It still keeps changing all of the frames in the world. I tried PosX, TileX, and x, even X but nothing, I guess these aren't the tags. The sword was enchanted but the potion was a plain bottle of water. – 76mickd May 3 '15 at 4:11
  • /entitydata @e[type=ItemFrame,x=,y=,z=,r=2] {Item:"minecraft:iron_sword",tag:{ench:[id:16,lvl:3}]}}} For some reason it works but the "r=2" has to be there and it doesn't matter the distance, maybe a glitch. I got the potions too, they look like this... /entitydata @e[type=ItemFrame,x=,y=,z=,r=2] {Item:{id:potion,Count:9888,Damage:20}} Can't figure out splash potions, any help, much Thanks! – 76mickd May 3 '15 at 8:08
0

Regular Item:

/entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=1] {Item:{id:"minecraft:iron_chestplate"}}

Enchanted Item:

/entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=1] {Item:{id:"minecraft:bow",tag:{ench:[{id:34,lvl:3}]}}}

Regular Potion:

/entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=1] {Item:{id:potion,Count:1,Damage:8193}}

Splash Potion:

/entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=1] {Item:{id:potion,Damage:16428,tag:{CustomPotionEffects:{Item:[{id:7,Amplifier:2,D‌​uration:1000}]}}}}

Remove Item Data:

/entitydata @e[type=ItemFrame,x=1,y=2,z=3,r=1] {Item:{id:"minecraft:air"}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.