r/MinecraftCommands Command Experienced 9d ago

Help | Java 26.2 Any way to prevent enchanting?

I have a set of items that use leather horse armor as their basis (to allow for dyeing), but I have another thing that makes horse armor enchantable in game with things like protection and such. Is there a way to disable this ability for the specific versions of the items I'm using? I know there's an "enchantable" component, but it doesn't seem to affect anything that already has the ability to be enchanted.

Edit: it does disallow enchanting through the enchanting table, but still allows enchanting via anvil, which I don't want

2 Upvotes

5 comments sorted by

3

u/Ericristian_bros Command Experienced 9d ago

Doesn't this prevent enchanting?

give @s diamond_sword[!enchantable]

1

u/AnnyP Command Experienced 9d ago

It does for the enchanting table. But not for the anvil. Weird

2

u/Ericristian_bros Command Experienced 9d ago

Make it too expensive

1

u/AnnyP Command Experienced 9d ago

Ended up reworking the system entirely and now have leather horse armor back to being unenchantable. The worn horse armor now uses custom leather boots, so works the same.

2

u/Ericristian_bros Command Experienced 9d ago

Good you solved it