Posted October 6, 20231 yr I'm using mixins to modify enchantments. In this case, its the sharpness enchantment. I would like sharpness to not be applicable to the sword and axe by injecting canEnchant here is my code: @Inject(at = @At("HEAD"), method = "canEnchant", cancellable = true) private void Sharpness(ItemStack itemToEnchant, CallbackInfoReturnable<Boolean> info) { if (itemToEnchant.getItem() instanceof TieredItem) { Enchantment e = (Enchantment) ((Object)this); if (e instanceof DamageEnchantment) { info.setReturnValue(false); } } } This code works flawlessly for any type of sword, but axes refuse to get changed, even when changing TieredItem to AxeItem. I would love to know a fix to this.
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.