Posted August 28, 20223 yr I'd like to make it so that an item can't be enchanted(or not be enchanted with certain enchantments, this includes the anvil), how can I achieve this? I've looked through a bunch of the vanilla code but can't seem to find how they do it. Edited August 28, 20223 yr by nexoner
August 28, 20223 yr For the EnchantingTable you can override #canApplyAtEnchantingTable in your Item class. For the Anvil you can use AnvilUpdateEvent, cancel the Event if the Enchantment can not be applied to your Item.
August 28, 20223 yr Author 1 minute ago, Luis_ST said: For the EnchantingTable you can override #canApplyAtEnchantingTable in your Item class. For the Anvil you can use AnvilUpdateEvent, cancel the Event if the Enchantment can not be applied to your Item. Ah! That makes sense, thanks, didn't know that that event existed
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.