SpongePowered / Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
1.41k stars 194 forks source link

How can I inject on FunctionInterface method #558

Closed the-doo closed 2 years ago

the-doo commented 2 years ago

Like this:

net.minecraft.enchantment.EnchantmentHelper#getAttackDamage


public static float getAttackDamage(ItemStack stack, EntityGroup group) {
        MutableFloat mutableFloat = new MutableFloat();
        forEachEnchantment((enchantment, level) -> {
            // I want to inject at here 
            mutableFloat.add(enchantment.getAttackDamage(level, group));
        }, stack);
        return mutableFloat.floatValue();
    }

Has any way to do it?

zml2008 commented 2 years ago

This is a bug tracker, not a support forum. For further assistance, please make sure you are fimiliar with Mixin documentation and stop by our Discord.