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.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<Boolean> info) {
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.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<Boolean> info) {
if (SeaponyGraceStatusEffect.hasGrace(entity)) {
info.setReturnValue(false);
}
}
}