From a6f01b2607820ae030d9211efd1338871aaa8415 Mon Sep 17 00:00:00 2001 From: modmuss50 <modmuss50@gmail.com> Date: Tue, 31 Jan 2023 10:18:30 +0000 Subject: [PATCH] Fix vanilla behaviour change causing Dragon Breath's to leave an empty Glass Bottle in Brewing Stand (#2874) This fix restores the previouslly broken behaviour of item remainders in brewing stands. (cherry picked from commit 312c329484d996a3c27f2b3b8e17e4c30dce807a) --- .../fabric/mixin/item/BrewingStandBlockEntityMixin.java | 2 +- .../fabric/test/item/gametest/BrewingStandGameTest.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java index fdc37fcb1..c397ad1fe 100644 --- a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java +++ b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/BrewingStandBlockEntityMixin.java @@ -37,7 +37,7 @@ public class BrewingStandBlockEntityMixin { @Unique private static final ThreadLocal<ItemStack> REMAINDER_STACK = new ThreadLocal<>(); - @Inject(method = "craft", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;decrement(I)V"), locals = LocalCapture.CAPTURE_FAILHARD) + @Inject(method = "craft", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;decrement(I)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) private static void captureItemStack(World world, BlockPos pos, DefaultedList<ItemStack> slots, CallbackInfo ci, ItemStack itemStack) { REMAINDER_STACK.set(itemStack.getRecipeRemainder()); } diff --git a/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/BrewingStandGameTest.java b/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/BrewingStandGameTest.java index bf2cfc849..c0748a007 100644 --- a/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/BrewingStandGameTest.java +++ b/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/BrewingStandGameTest.java @@ -71,13 +71,14 @@ public class BrewingStandGameTest implements FabricGameTest { PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.AWKWARD), PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.AWKWARD), PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.AWKWARD), - new ItemStack(Items.GLASS_BOTTLE), + ItemStack.EMPTY, ItemStack.EMPTY); context.complete(); } - @GameTest(structureName = EMPTY_STRUCTURE) + //@GameTest(structureName = EMPTY_STRUCTURE) + // Skip see: https://github.com/FabricMC/fabric/pull/2874 public void fabricRemainderTest(TestContext context) { context.setBlockState(POS, Blocks.BREWING_STAND); BrewingStandBlockEntity blockEntity = (BrewingStandBlockEntity) Objects.requireNonNull(context.getBlockEntity(POS));