Skip to content

Commit

Permalink
attributemixin
Browse files Browse the repository at this point in the history
  • Loading branch information
bibi-reden committed Jun 25, 2024
1 parent 835357d commit 0a0618c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -50,12 +51,12 @@ abstract class ClampedEntityAttributeMixin extends EntityAttributeMixin {
return original;
}

@WrapMethod(method = "clamp")
private double data_attributes$clamp(double value, Operation<Double> original) {
@ModifyReturnValue(method = "clamp", at = @At("RETURN"))
private double data_attributes$clamp(double original, @Local(argsOnly = true) double value) {
if (this.data_enabled) {
return this.data_attributes$clamped(value);
}
return original.call(value);
return original;
}

@Override
Expand Down

0 comments on commit 0a0618c

Please sign in to comment.