diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinGuardianTargetPredicate.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinGuardianTargetPredicate.java index 3b2f31b2..14001427 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinGuardianTargetPredicate.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinGuardianTargetPredicate.java @@ -5,7 +5,9 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; -import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import com.minelittlepony.unicopia.entity.effect.SeaponyGraceStatusEffect; import net.minecraft.entity.LivingEntity; @@ -16,8 +18,10 @@ abstract class MixinGuardianTargetPredicate { @Shadow private @Final GuardianEntity owner; - @ModifyReturnValue(method = "test", at = @At("RETURN")) - private boolean unicopia_excludeSeaponysGrace(boolean result, @Nullable LivingEntity target) { - return result && SeaponyGraceStatusEffect.hasIre(target, owner); + @Inject(method = "test", at = @At("HEAD"), cancellable = true) + private void unicopia_excludeSeaponysGrace(@Nullable LivingEntity target, CallbackInfoReturnable info) { + if (!SeaponyGraceStatusEffect.hasIre(target, owner)) { + info.setReturnValue(false); + } } } diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinPufferfishEntity.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinPufferfishEntity.java index 9231dafa..75ddc656 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinPufferfishEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinPufferfishEntity.java @@ -2,7 +2,9 @@ package com.minelittlepony.unicopia.mixin; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import com.minelittlepony.unicopia.entity.effect.SeaponyGraceStatusEffect; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.passive.FishEntity; @@ -12,8 +14,10 @@ import net.minecraft.entity.passive.PufferfishEntity; abstract class MixinPufferfishEntity extends FishEntity { MixinPufferfishEntity() { super(null, null); } - @ModifyReturnValue(method = "method_6591(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("RETURN")) - private static boolean unicopia_excludeSeaponysGrace(boolean result, LivingEntity entity) { - return result && !SeaponyGraceStatusEffect.hasGrace(entity); + @Inject(method = "method_6591(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("HEAD"), cancellable = true) + private static void unicopia_excludeSeaponysGrace(LivingEntity entity, CallbackInfoReturnable info) { + if (SeaponyGraceStatusEffect.hasGrace(entity)) { + info.setReturnValue(false); + } } }