mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Fixed the alchemy properly (#4658)
This commit is contained in:
parent
5b1a69b3f7
commit
ba1f15b655
@ -22,6 +22,7 @@ import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class AlchemyPotionBrewer {
|
||||
@ -113,8 +114,8 @@ public final class AlchemyPotionBrewer {
|
||||
return;
|
||||
}
|
||||
|
||||
List<AlchemyPotion> inputList = new ArrayList<>();
|
||||
var outputList = new ArrayList<ItemStack>();
|
||||
List<AlchemyPotion> inputList = new ArrayList<>(Collections.nCopies(3, null));
|
||||
List<ItemStack> outputList = new ArrayList<>(Collections.nCopies(3, null));
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ItemStack item = inventory.getItem(i);
|
||||
@ -126,10 +127,10 @@ public final class AlchemyPotionBrewer {
|
||||
AlchemyPotion input = PotionConfig.getInstance().getPotion(item);
|
||||
AlchemyPotion output = input.getChild(ingredient);
|
||||
|
||||
inputList.add(input);
|
||||
inputList.set(i, input);
|
||||
|
||||
if (output != null) {
|
||||
outputList.add(output.toItemStack(item.getAmount()).clone());
|
||||
outputList.set(i, output.toItemStack(item.getAmount()).clone());
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,6 +150,8 @@ public final class AlchemyPotionBrewer {
|
||||
removeIngredient(inventory, player);
|
||||
|
||||
for (AlchemyPotion input : inputList) {
|
||||
if (input == null) continue;;
|
||||
|
||||
AlchemyPotion output = input.getChild(ingredient);
|
||||
|
||||
if (output != null && player != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user