#How to get rid of custom enchantments on pre-existing weapons
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D
Open question: #1296203192991879217
<@&1166082198152159386> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)
ok 👍
To make two enchantments incompatible with one another, you just need to define for both of them an exclusive_set, which will just be the other enchantment (and/or any other enchantments you want them to be incompatible with)
Removing the incompatible enchantments from existing items is quite a bit harder
ye you can see that you can give yourself an infinity mending bow with commands
the game only checks them in anvils
i know how to make them incompatable, im wondering how to remove the incompatible enchants from previous existing items
OK, well you asked how to make them incompatible too.
i can see how that can be misunderstood for but no im only asking about removing incompatable enchants from existing items
And that's pretty challenging to do, especially while retaining any other enchantments they have
ik thats why im asking for help on it?
Let me be absolutely clear then: What we were trying to say is that there isn't going to be a way to do this without pretty significant trade-offs, either to the behavior or to your time and effort.
The way you'd need to do this is with item modifiers and /execute if items checks. If you want to preserve all of the enchantments that the item has that aren't incompatible, the simplest way would be:
- Have a ticking command that runs a function as all players
- In that function, for each slot that items with those enchantments could appear in from among the four armor slots, and both hands, run yet another function if that item has both of the incompatible enchantments via an
if itemscheck. - In that function, individually check if that item has each possible enchantment, and somehow store that true/false data somewhere, along with what level it was. Could be a scoreboard or storage, whatever works for you.
- Clear all of the item's enchantments.
- Then, for each enchantment it had, except the incompatible enchantments, use a set_enchantments item modifier to give it that enchantment at that level
- Finally, somehow determine which of the incompatible enchantments you want it to keep, and use an item modifier to add that back, too.
The main trade-offs here are an incredible amount of item modifiers and if items checks, and no reasonable way to handle preserving custom enchantments from other data packs or mods. It's possible this could be eased using macros and in-line item modifiers, but I'm not well versed enough in macros to guide you through that process.
would just making a new enchant that does the same thing and removing the old one work or would that cause issues?
or is what you said the only way..
I'm not sure if that would work, it's possible it could corrupt the world or those items
But it also might just remove the old enchantment, so could be worth a try. Just make a backup first
okay if that doesnt work ill find a way to do your method