From f899bc57450167ffb9070a0c5ccee54ba38e219d Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Mon, 15 Jan 2024 17:40:57 +0100 Subject: [PATCH] Fixed FabricAPI injection conflict Fixes #319 --- .../mixin/fixes/minecraft/MixinMinecraftClient.java | 2 +- .../injection/mixin/fixes/minecraft/item/MixinItem.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java index b0742359..0e2f622f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinMinecraftClient.java @@ -60,7 +60,7 @@ public abstract class MixinMinecraftClient { public ClientPlayerEntity player; @Shadow - public int attackCooldown; + protected int attackCooldown; @Shadow @Final diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java index d65d08a5..8e9da51d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinItem.java @@ -19,6 +19,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; import net.minecraft.item.CrossbowItem; import net.minecraft.item.Item; @@ -56,12 +57,12 @@ public abstract class MixinItem { } } - @Redirect(method = {"use", "finishUsing", "getUseAction", "getMaxUseTime"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isFood()Z")) - private boolean makeFoodInstantConsumable(Item instance) { + @ModifyExpressionValue(method = {"use", "finishUsing", "getUseAction", "getMaxUseTime"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isFood()Z")) + private boolean makeFoodInstantConsumable(boolean original) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.b1_7tob1_7_3)) { return false; } - return instance.isFood(); + return original; } }