• Hey! Register here to create your account, engage with the community, and talk about what is new!

Identifying specific enchantments on items

Swirrl

New member
Joined
Jun 23, 2021
Messages
5
So I'm trying to make it so that you can upgrade enchantments on items, and I'm getting stuck on identifying how to check for a specific enchantment/ench level, I have {SetVariable [GetItemEnchants] } but after that I'm getting stuck.

1625695958546.png
 
Solution
The GetItemEnchants returns a list of lists as you can see in the lore 1625732268411.png
To do you you repeat For Each in the enchantments variable, lets say the current index value variable is "value", you check If Variable List Contains {value, <the enchantment you want>}, and inside the piston you place a Set Variable: Get List Value {<the variable that will get the level>, value, NUMBER(2)} and then you place a Stop Repeat after the Get List Value to save some cpu

a code of how to do it: (the sword is enchanted but it's not showing in the browser, you can click on Get Give Command and try it)...

ARMcPro

Well-known member
Joined
Oct 20, 2020
Messages
188
The GetItemEnchants returns a list of lists as you can see in the lore 1625732268411.png
To do you you repeat For Each in the enchantments variable, lets say the current index value variable is "value", you check If Variable List Contains {value, <the enchantment you want>}, and inside the piston you place a Set Variable: Get List Value {<the variable that will get the level>, value, NUMBER(2)} and then you place a Stop Repeat after the Get List Value to save some cpu

a code of how to do it: (the sword is enchanted but it's not showing in the browser, you can click on Get Give Command and try it)

You can get the current index of the repeat and do Set List Value and stuff
 
Solution
Top Bottom