Posted July 21, 20241 yr Hi, I created a custom tool that extends the DiggerItem class, but I am unable to give it enchantments as with other tools. For example, when I try to use the /enchant command, it says that my item "cannot support that enchantment". Similarly, the anvil does not allow me to add book enchantments to the item. I have tried overwriting the methods relating to enchantments, as shown below. What are the steps that I need to take to enable vanilla enchantments on my custom tool? Current code: public class MyItem extends DiggerItem { public MyItem(Tier tier, Properties pProperties) { super(tier, MyTags.Blocks.MINEABLE_WITH_MYITEM, pProperties); } @Override public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { return true; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return true; } @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } @Override public boolean isEnchantable(@SuppressWarnings("null") ItemStack pStack) { return true; } }
July 21, 20241 yr Author 23 minutes ago, JuSTGh0sT1242 said: why do you need DiggerItem, just use Pickaxe/AxeItem etc. I'm making an all-in-one tool, so I figured it would be best to extend DiggerItem and then implement the functionality of each integrated tool in my item's class.
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.