Skip to content

Commit

Permalink
Fixed FabricAPI injection conflict
Browse files Browse the repository at this point in the history
Fixes #319
  • Loading branch information
RaphiMC committed Jan 15, 2024
1 parent e4159c5 commit f899bc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public abstract class MixinMinecraftClient {
public ClientPlayerEntity player;

@Shadow
public int attackCooldown;
protected int attackCooldown;

@Shadow
@Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,12 +57,12 @@ private void dontStackFood(CallbackInfoReturnable<Integer> cir) {
}
}

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

}

0 comments on commit f899bc5

Please sign in to comment.