diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b17a89..2d4fe27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,2 @@ -## Additions 💫 - -Implemented diminishing formula. \ No newline at end of file +## Changes ⚙️ +- Now using `WrapMethod` on computation of modifier(s) to avoid unneeded recalculation. \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 61b2c3d..35b291d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loom_version=1.7-SNAPSHOT minecraft_version=1.20.1 fabric_kotlin_version=1.11.0+kotlin.2.0.0 fabric_api_version=0.92.2+1.20.1 -mod_version=2.0.0-beta.7+1.20.1 +mod_version=2.0.0-beta.8+1.20.1 loader=fabric yarn_mappings=1.20.1+build.10 @@ -23,7 +23,7 @@ ksp_owo_config_version=0.1.0 endec_version=0.1.7 endec_netty_version=0.1.3 -mixinextras_version=0.3.6 +mixinextras_version=0.5.0-beta.1 org.gradle.jvmargs=-Xmx4000m org.gradle.parallel=true diff --git a/src/main/java/com/bibireden/data_attributes/mixin/EntityAttributeInstanceMixin.java b/src/main/java/com/bibireden/data_attributes/mixin/EntityAttributeInstanceMixin.java index a066200..7a3f0bc 100644 --- a/src/main/java/com/bibireden/data_attributes/mixin/EntityAttributeInstanceMixin.java +++ b/src/main/java/com/bibireden/data_attributes/mixin/EntityAttributeInstanceMixin.java @@ -6,6 +6,8 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -82,13 +84,13 @@ protected void onUpdate() {} } @SuppressWarnings("UnreachableCode") - @ModifyReturnValue(method = "computeValue", at = @At("RETURN")) - private double data_attributes$computeValue(double original) { + @WrapMethod(method = "computeValue") + private double data_attributes$computeValue(Operation original) { MutableEntityAttribute attribute = (MutableEntityAttribute) this.getAttribute(); StackingFormula formula = attribute.data_attributes$formula(); // If the formula is set to Flat and there is no associated container, provide original. - if (formula == StackingFormula.Flat && this.data_attributes$container == null) return original; + if (formula == StackingFormula.Flat && this.data_attributes$container == null) return original.call(); AtomicReference k = new AtomicReference<>(0.0D); AtomicReference v = new AtomicReference<>(0.0D);