Posted February 23, 20169 yr I have a couple of custom enchants, and I have the effects for when my item is enchanted. Everything works fine in that regard. My problem is that my enchants are being applied to vanilla items. Currently, my custom item extends ItemBow, thus my enchants use the EnumEnchantmentType.BOW. I have been looking around for a way to prevent my enchants from appearing on vanilla items, and/or for a way to specify a custom enchant type, but most tutorials/requests for help only go into adding effects to vanilla stuff (the opposite of what I want) I have tried this, on suggestion from a search result: public boolean canApply(ItemStack stack) { if (stack.getItem() instanceof DTPotshot) { return true; } else { return false; } } And: public boolean canApply(ItemStack stack) { if (stack.getItem() == DTItems.potShot) { return true; } else { return false; } } But this seems do have done utterly nothing (that I can see). My question is; how can I set a custom Enchant Type (if possible), or how can I prevent my enchants on going on vanilla items?
February 23, 20169 yr Idea below is one i just though of, isn't written anywhere and may cause problems: You can use EnumHelper to create new EnumEnchantmentType , and then use it in your enchantments and item. Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
February 23, 20169 yr Enchantment#canApply is only used by the /enchant command and the Anvil and falls back to Enchantment#canApplyAtEnchantingTable . Enchantment#canApplyAtEnchantingTable is used by the Enchanting Table and the EnchantmentHelper.addRandomEnchantment method (used by mobs and dungeon/fishing loot). Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 23, 20169 yr Author Wow, that did the trick. Thanks. Funny thing is, I looked at that earlier today and must have just completely glanced over it.
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.