Skip to content

Commit

Permalink
Revert mixinextras usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Jun 24, 2024
1 parent a6b16ec commit 6eb2464
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
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;
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

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;
Expand All @@ -12,8 +14,10 @@
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);
}
}
}

0 comments on commit 6eb2464

Please sign in to comment.