From aa8cde4a8d6730ae1403803db3269a02d0cd185d Mon Sep 17 00:00:00 2001 From: Thelnfamous1 Date: Fri, 9 Feb 2024 20:57:55 -0600 Subject: [PATCH] Partial fix for #45, #48 --- build.gradle | 5 ++++- gradle.properties | 3 ++- .../infamous/dungeons_libraries/mixin/BowItemMixin.java | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 511ed86..96cf5d9 100644 --- a/build.gradle +++ b/build.gradle @@ -137,7 +137,10 @@ dependencies { runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") - + compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}")) + implementation(jarJar("io.github.llamalad7:mixinextras-forge:${mixinextras_version}")) { + jarJar.ranged(it, "[${mixinextras_version},)") + } // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html diff --git a/gradle.properties b/gradle.properties index 2e3f62d..0ef7e58 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,5 @@ geckolib_version=3.1.39 curios_version=1.19.2-5.1.1.0 mappings_channel=official mappings_version=1.19.2 -modid=dungeons_libraries \ No newline at end of file +modid=dungeons_libraries +mixinextras_version=0.3.5 \ No newline at end of file diff --git a/src/main/java/com/infamous/dungeons_libraries/mixin/BowItemMixin.java b/src/main/java/com/infamous/dungeons_libraries/mixin/BowItemMixin.java index ff183c4..8414bd5 100644 --- a/src/main/java/com/infamous/dungeons_libraries/mixin/BowItemMixin.java +++ b/src/main/java/com/infamous/dungeons_libraries/mixin/BowItemMixin.java @@ -1,6 +1,8 @@ package com.infamous.dungeons_libraries.mixin; import com.infamous.dungeons_libraries.utils.RangedAttackHelper; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; @@ -13,16 +15,15 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(BowItem.class) public abstract class BowItemMixin { - @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/BowItem;getPowerForTime(I)F"), + @WrapOperation(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/BowItem;getPowerForTime(I)F"), method = "releaseUsing") - private float libraries_releaseUsing_getPowerForTime(int useTime, ItemStack itemStack, Level level, LivingEntity livingEntity, int useTimeRemaining) { + private float libraries_releaseUsing_getPowerForTime(int useTime, Operation original, ItemStack itemStack, Level level, LivingEntity livingEntity, int useTimeRemaining) { return RangedAttackHelper.getBowArrowVelocity(livingEntity, itemStack, useTime); }