Revert mixinextras usage

This commit is contained in:
Sollace 2024-06-24 01:25:28 +01:00
parent a6b16ec09f
commit 6eb2464d78
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 16 additions and 8 deletions

View file

@ -5,7 +5,9 @@ import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; 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 com.minelittlepony.unicopia.entity.effect.SeaponyGraceStatusEffect;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -16,8 +18,10 @@ abstract class MixinGuardianTargetPredicate {
@Shadow @Shadow
private @Final GuardianEntity owner; private @Final GuardianEntity owner;
@ModifyReturnValue(method = "test", at = @At("RETURN")) @Inject(method = "test", at = @At("HEAD"), cancellable = true)
private boolean unicopia_excludeSeaponysGrace(boolean result, @Nullable LivingEntity target) { private void unicopia_excludeSeaponysGrace(@Nullable LivingEntity target, CallbackInfoReturnable<Boolean> info) {
return result && SeaponyGraceStatusEffect.hasIre(target, owner); if (!SeaponyGraceStatusEffect.hasIre(target, owner)) {
info.setReturnValue(false);
}
} }
} }

View file

@ -2,7 +2,9 @@ package com.minelittlepony.unicopia.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; 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 com.minelittlepony.unicopia.entity.effect.SeaponyGraceStatusEffect;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.FishEntity; import net.minecraft.entity.passive.FishEntity;
@ -12,8 +14,10 @@ import net.minecraft.entity.passive.PufferfishEntity;
abstract class MixinPufferfishEntity extends FishEntity { abstract class MixinPufferfishEntity extends FishEntity {
MixinPufferfishEntity() { super(null, null); } MixinPufferfishEntity() { super(null, null); }
@ModifyReturnValue(method = "method_6591(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("RETURN")) @Inject(method = "method_6591(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("HEAD"), cancellable = true)
private static boolean unicopia_excludeSeaponysGrace(boolean result, LivingEntity entity) { private static void unicopia_excludeSeaponysGrace(LivingEntity entity, CallbackInfoReturnable<Boolean> info) {
return result && !SeaponyGraceStatusEffect.hasGrace(entity); if (SeaponyGraceStatusEffect.hasGrace(entity)) {
info.setReturnValue(false);
}
} }
} }