diff --git a/src/main/java/org/ladysnake/impaled/mixin/EfficiencyEnchantmentMixin.java b/src/main/java/org/ladysnake/impaled/mixin/EfficiencyEnchantmentMixin.java new file mode 100644 index 0000000..41a55a4 --- /dev/null +++ b/src/main/java/org/ladysnake/impaled/mixin/EfficiencyEnchantmentMixin.java @@ -0,0 +1,19 @@ +package org.ladysnake.impaled.mixin; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.ladysnake.impaled.common.item.MaelstromItem; +import net.minecraft.enchantment.EfficiencyEnchantment; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + + +@Mixin(EfficiencyEnchantment.class) +public class EfficiencyEnchantmentMixin { + + @WrapOperation(method = "isAcceptableItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z")) + private boolean maelstromAccept(EfficiencyEnchantment instance, ItemStack stack, Operation original){ + return original.call(instance, stack) || stack.getItem() instanceof MaelstromItem; + } +} diff --git a/src/main/resources/impaled.mixins.json b/src/main/resources/impaled.mixins.json index a39322e..e81a6a4 100644 --- a/src/main/resources/impaled.mixins.json +++ b/src/main/resources/impaled.mixins.json @@ -10,6 +10,7 @@ ], "mixins": [ "DamageSourcesMixin", + "EfficiencyEnchantmentMixin", "EnchantmentTargetMixin", "EntityMixin", "LivingEntityMixin", @@ -23,4 +24,4 @@ "injectors": { "defaultRequire": 1 } -} \ No newline at end of file +}