I am making an enchantment for the bundle which would allow it to store items. To do this, I am using a ModifyReturnValue into getWeight() of BundleContents. I need to check the level of the enchantment on the item within that method, however, to get a Holder<Enchantment>, I need the Level. Is there a way I can access the level from BundleContents?
@ModifyReturnValue(method = "getWeight", at = @At("RETURN"))
private static Fraction getWeight(Fraction original, ItemStack item) {
int capacityLevel = item.getEnchantments().getLevel(ModEnchantmentHelper.getHolder(ModEnchantments.CAPACITY.getKey(), LEVEL));
return original.divideBy(Fraction.getFraction(capacityLevel > 0 ? capacityLevel / 2f : 1));
}