If the player's already holding something, this won't work. (or if their cursor isn't over the slot the item will go into)
IE:
The player currently is holding a wooden sword. You give them a diamond sword, and enchant the item they are holding. The wooden sword gets the enchantment, not the diamond sword.
The player's cursor is on their 9th slot in the hotbar. You give the player a diamond sword, it goes into their 1st slot on their hotbar. The command block enchants the item they are holding, which is nothing. Nothing gets the enchantment, the diamond sword remains unenchanted.
Proof of concept, perhaps. But nothing complete, by far.
Clear player's inventory, give them 9 diamond swords, enchant the item, clear all diamond swords that do not have the enchantment.
^BugProof.
But how do you tell which sword has the enchantment?
Ultimately command blocks need a scripting language. Not being able to pass variables between blocks makes them limited.
If we had a simple scripting language we could do this:
Player p = @r;
Item i = 278 // diamond pick? It's been a while.
i.enchant(ENCHANT, LEVEL) // fill in those values with numbers
p.give(i);
That would select a random player and give them an enchanted item. A scripting language would be able to do a lot more than that. But I can see it wouldn't be the simplest thing to add to the game.
No Katheryn999, it is /give @p minecraft:bow {ench:[{48,5}]}
it is a comma not a period
and also you guys could do what Diamondar said and do /give @p 278 1 efficiency:2 durability:2
or in other words /give @p <Id> <Amount> <EnchantmentName>:<Level>
In terms of vanilla, the first one is incorrect. You must have the tag labels ('id' and 'lvl'), as well as completed /give syntax (missing amount and Damage value):
But how do you tell which sword has the enchantment?
If we had a simple scripting language we could do this:
That would select a random player and give them an enchanted item. A scripting language would be able to do a lot more than that. But I can see it wouldn't be the simplest thing to add to the game.
Welcome to 1.7.
(This was posted on Twitter by Jeb on September 3rd)
If you want to talk privately, click me...
If you're referring to the image I posted, then yes. If you mean the current command, then no.
If you want to name something in 1.7, do /give [player] [item] [amount] [data] {display:{Name:"<NAME>"}}
If you want to talk privately, click me...
Yay I feel smart!
Can you do this what /give @a minecraft:diamond_sword then add data tags?
but i tried it but 48.5 is vaild number
it is a comma not a period
and also you guys could do what Diamondar said and do /give @p 278 1 efficiency:2 durability:2
or in other words /give @p <Id> <Amount> <EnchantmentName>:<Level>
- Glados
This is really cool
In terms of vanilla, the first one is incorrect. You must have the tag labels ('id' and 'lvl'), as well as completed /give syntax (missing amount and Damage value):
The second I believe is a Bukkit feature.
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/