From 0e09ac397d0e835a134c5aaeb97cb8f8fe932881 Mon Sep 17 00:00:00 2001 From: Wolf2323 Date: Thu, 10 Dec 2020 22:24:08 +0100 Subject: [PATCH] fix BrewingStand inventory is updated immediately instead of after firing the event. Now the event can be canceled correct. (#4351) --- .../nossr50/skills/alchemy/AlchemyPotionBrewer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java index f42584b25..8b9f9ae36 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java @@ -114,6 +114,7 @@ public final class AlchemyPotionBrewer { } List inputList = new ArrayList<>(); + ItemStack[] outputList = new ItemStack[3]; for (int i = 0; i < 3; i++) { ItemStack item = inventory.getItem(i); @@ -128,7 +129,7 @@ public final class AlchemyPotionBrewer { inputList.add(input); if (output != null) { - inventory.setItem(i, output.toItemStack(item.getAmount()).clone()); + outputList[i] = output.toItemStack(item.getAmount()).clone(); } } @@ -139,6 +140,12 @@ public final class AlchemyPotionBrewer { return; } + for (int i = 0; i < 3; i++) { + if(outputList[i] != null) { + inventory.setItem(i, outputList[i]); + } + } + removeIngredient(inventory, player); for (AlchemyPotion input : inputList) {