Fixed #67 Incorrect boolean calculation for matrix result.

Fixed firework recipe breaking when server restarts
This commit is contained in:
James Peters 2022-01-23 21:41:21 +00:00
parent c94f73fdf5
commit 3e2ec6d04d
2 changed files with 7 additions and 3 deletions

View File

@ -427,7 +427,7 @@ public class VirtualCraftingHolder implements InventoryHolder {
HashMap<Integer, ItemStack> map = tempOutput.addItem(craftingResult.result());
boolean isEmpty = Arrays.stream(craftingResult.matrixResult())
.anyMatch(itemStack -> (itemStack == null || itemStack.getType() == Material.AIR));
.allMatch(itemStack -> (itemStack == null || itemStack.getType() == Material.AIR));
// Add any leftover items from the recipe e.g buckets.
HashMap<Integer, ItemStack> craftingMatrixLeftOvers =

View File

@ -37,8 +37,12 @@ public class RecipeSerializable implements ConfigurationSerializable {
public RecipeSerializable(Map<String, Object> map) {
Object obj = map.get("items");
if (obj != null) {
//noinspection unchecked
items = (ItemStack[]) obj;
if (obj instanceof ItemStack[] itemArray) {
items = itemArray;
} else {
//noinspection unchecked
items = ((List<ItemStack>)obj).toArray(new ItemStack[9]);
}
}
//noinspection deprecation