Fix vanilla behaviour change causing Dragon Breath's to leave an empty Glass Bottle in Brewing Stand ()

This fix restores the previouslly broken behaviour of item remainders in brewing stands.
This commit is contained in:
modmuss50 2023-01-31 10:18:30 +00:00 committed by GitHub
parent 70be179cf3
commit 312c329484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions
fabric-item-api-v1/src
main/java/net/fabricmc/fabric/mixin/item
testmod/java/net/fabricmc/fabric/test/item/gametest

View file

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

View file

@ -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(templateName = EMPTY_STRUCTURE)
//@GameTest(templateName = 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));