How do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate]

How do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate] - Contemporary interior of new boardroom equipped with wooden table and red office chairs

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'}]}


Best Answer

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.




Pictures about "How do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate]"

How do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate] - Interior of contemporary workspace with office chairs at tables and wooden shelves under ceiling with geometric lamps
How do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate] - Stylish heart shaped sunglasses on wooden surface
How do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate] - Interior of cotemporary office with wooden tables and chairs illuminated by ceiling lamps



How do you give enchanted items with a command block?

You can set up some simple commands with command blocks, and let players click the button of each command block so that they receive the enchanted items. This is the general command: /give @p <ID> <amount> 0 {ench:[{id:<0-62>,lvl:<1-32767>},{id:<0-62>,lvl:<1-32767>},...]}

What is the command to give an enchanted item?

First, you need to program the command block to give an enchanted diamond sword with the /give command. This /give command will be run each time the command block is activated. So, stand in front of the command block with your pointer (the plus sign) on the command block and click on the right mouse button.

How do you make potions with command blocks?

You have to use the command /summon . Summons an entity (mobs, projectiles, items, vehicles, etc.). The entity for the Potion is called "ThrownPotion". If you want a special effect to that Potion you have to use a variable where you are able to configure the effect.



How to get already Enchanted Items with Command Blocks | MC Bedrock tutorial




More answers regarding how do you put an enchanted item or an enchanted potion in an item frame with a command block? [duplicate]

Answer 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.

Answer 3

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.

Answer 4

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"}}

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Max Vakhtbovych, Max Vakhtbovych, Tara Winstead, Max Vakhtbovych