Fixed FabricAPI injection conflict

Fixes #319
This commit is contained in:
RaphiMC 2024-01-15 17:40:57 +01:00
parent e4159c5b0d
commit f899bc5745
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
2 changed files with 5 additions and 4 deletions

View File

@ -60,7 +60,7 @@ public abstract class MixinMinecraftClient {
public ClientPlayerEntity player;
@Shadow
public int attackCooldown;
protected int attackCooldown;
@Shadow
@Final

View File

@ -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;
}
}