I've been using command blocks for a long time in Minecraft, and I was wondering if anyone knows of a way to make it so that the level of enchantment on an item can be a scoreboard score.
Something like this would be ideal:
give @p diamond_pickaxe{Enchantments:[{id:"efficiency",lvl:["score":{"name":"ench","objective":"level"}]}]}
Effectively, that command (if executed how I would intend for it to be) would give the nearest player a Diamond Pickaxe with the Efficiency enchantment -- the level of the enchantment being equal to ench's score in the objective named "level."
I've been using command blocks for a long time in Minecraft, and I was wondering if anyone knows of a way to make it so that the level of enchantment on an item can be a scoreboard score.
Something like this would be ideal:
give @p diamond_pickaxe{Enchantments:[{id:"efficiency",lvl:["score":{"name":"ench","objective":"level"}]}]}
Effectively, that command (if executed how I would intend for it to be) would give the nearest player a Diamond Pickaxe with the Efficiency enchantment -- the level of the enchantment being equal to ench's score in the objective named "level."
Thanks in advance,
Sammy
I never rly try to do this, cuz I don't think it's ever necessary (I don't know your objective exactly, but ain't gonna question it).
Let's assume the pickaxe:
1) is custom (i.e. not by mining diamonds, crafting one and enchanted)
2) always have Efficiency as the 1st enchantment
3) will only be executed if the player holds it
4) MUST have that enchantment, even with 0 lvl
Then, congratulations, your dream of using using scoreboard score as a tag variable comes true!
I tested this:
/execute as @a store result entity @s SelectedItem.tag.Enchantments[0].lvl short 1 run scoreboard players get @s <scoreboard>
I never rly try to do this, cuz I don't think it's ever necessary (I don't know your objective exactly, but ain't gonna question it).
Let's assume the pickaxe:
1) is custom (i.e. not by mining diamonds, crafting one and enchanted)
2) always have Efficiency as the 1st enchantment
3) will only be executed if the player holds it
4) MUST have that enchantment, even with 0 lvl
Then, congratulations, your dream of using using scoreboard score as a tag variable comes true!
I tested this:
/execute as @a store result entity @s SelectedItem.tag.Enchantments[0].lvl short 1 run scoreboard players get @s <scoreboard>
And it worked!
Hi there!
I was able to fiddle with this to get it how I needed it. Thanks a ton!
When (and if) I publish the project, then I'll be sure to credit you as you asked for it. I may also have some special plans to credit you within the project that aren't just a sign or a "head stuck to a wall" because you basically just gave me what I needed in order finish it in a timely and convenient manner. Finally, if you'd like, then I'll get back to you whenever I finish the project if you would like a copy of it prior to my releasing of it!
I was able to fiddle with this to get it how I needed it. Thanks a ton!
When (and if) I publish the project, then I'll be sure to credit you as you asked for it. I may also have some special plans to credit you within the project that aren't just a sign or a "head stuck to a wall" because you basically just gave me what I needed in order finish it in a timely and convenient manner. Finally, if you'd like, then I'll get back to you whenever I finish the project if you would like a copy of it prior to my releasing of it!
Thank you so much,
Sammy
Noted, thank you for actually reading my signature tho : p
(And how will you plan to place it? I mean, we can talk in Private Chat, but just giving you the question)
Rollback Post to RevisionRollBack
Advertisement Board
1. New minigame for Christmas! (Yes it's over, I know...) Check it out!
2. If you found my command solutions helpful, try to make my work worthwhile by crediting me. However, if you are to credit me, let me do it by:
Joining the map server or giving me a download link to add stuff.
This is mainly because I don't want some simple signs mentioning my name or my stupid head sticking to the wall.
Hi there folks,
I've been using command blocks for a long time in Minecraft, and I was wondering if anyone knows of a way to make it so that the level of enchantment on an item can be a scoreboard score.
Something like this would be ideal:
Effectively, that command (if executed how I would intend for it to be) would give the nearest player a Diamond Pickaxe with the Efficiency enchantment -- the level of the enchantment being equal to ench's score in the objective named "level."
Thanks in advance,
Sammy
I never rly try to do this, cuz I don't think it's ever necessary (I don't know your objective exactly, but ain't gonna question it).
Let's assume the pickaxe:
1) is custom (i.e. not by mining diamonds, crafting one and enchanted)
2) always have Efficiency as the 1st enchantment
3) will only be executed if the player holds it
4) MUST have that enchantment, even with 0 lvl
Then, congratulations, your dream of using using scoreboard score as a tag variable comes true!
I tested this:
/execute as @a store result entity @s SelectedItem.tag.Enchantments[0].lvl short 1 run scoreboard players get @s <scoreboard>
And it worked!
Joining the map server or giving me a download link to add stuff.
This is mainly because I don't want some simple signs mentioning my name or my stupid head sticking to the wall.
Hi there!
I was able to fiddle with this to get it how I needed it. Thanks a ton!
When (and if) I publish the project, then I'll be sure to credit you as you asked for it. I may also have some special plans to credit you within the project that aren't just a sign or a "head stuck to a wall" because you basically just gave me what I needed in order finish it in a timely and convenient manner. Finally, if you'd like, then I'll get back to you whenever I finish the project if you would like a copy of it prior to my releasing of it!
Thank you so much,
Sammy
Noted, thank you for actually reading my signature tho : p
(And how will you plan to place it? I mean, we can talk in Private Chat, but just giving you the question)
Joining the map server or giving me a download link to add stuff.
This is mainly because I don't want some simple signs mentioning my name or my stupid head sticking to the wall.
Private messaging sounds great. Let's keep talking in there