From 80bb77f78ee209d03b53dabddd8941bc41c4e2f1 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 5 Jan 2024 14:35:44 +0000 Subject: [PATCH] Fix review comment --- .../fabricmc/fabric/mixin/item/WolfEntityMixin.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/WolfEntityMixin.java b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/WolfEntityMixin.java index 1d39d52e60..ca3245ee09 100644 --- a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/WolfEntityMixin.java +++ b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/WolfEntityMixin.java @@ -18,6 +18,7 @@ import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; @@ -33,18 +34,18 @@ @Mixin(WolfEntity.class) class WolfEntityMixin { - @SuppressWarnings("MissingUnique") - private static final ThreadLocal fabric_interactMob_itemStack = new ThreadLocal<>(); + @Unique + private static final ThreadLocal INTERACTION_STACK = new ThreadLocal<>(); @Inject(method = "interactMob", at = @At("HEAD")) private void storeCopy(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - fabric_interactMob_itemStack.set(player.getStackInHand(hand).copy()); + INTERACTION_STACK.set(player.getStackInHand(hand).copy()); } @Redirect(method = "interactMob", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getFoodComponent()Lnet/minecraft/item/FoodComponent;")) private @Nullable FoodComponent getStackAwareFoodComponent(Item instance, PlayerEntity player, Hand hand) { - FoodComponent fc = fabric_interactMob_itemStack.get().getFoodComponent(); - fabric_interactMob_itemStack.remove(); + FoodComponent fc = INTERACTION_STACK.get().getFoodComponent(); + INTERACTION_STACK.remove(); return fc; }