Fix material ingredient showing no items when the material registry is not loaded
@@ -92,12 +92,17 @@ public class MaterialIngredient extends Ingredient {
@Override
public ItemStack[] getMatchingStacks() {
if (materialStacks == null) {
+ if (!MaterialRegistry.initialized()) {
+ return getPlainMatchingStacks();
+ }
// no material? apply all materials for variants
Stream<ItemStack> items = Arrays.stream(getPlainMatchingStacks());
if (materialID == WILDCARD) {
+ if (!MaterialRegistry.getMaterials().isEmpty()) {
items = items.flatMap(stack -> MaterialRegistry.getMaterials().stream()
.map(mat -> IMaterialItem.withMaterial(stack, mat))
.filter(ItemStack::hasTag));
+ }
} else {
// specific material? apply to all stacks
IMaterial material = MaterialRegistry.getMaterial(this.materialID);
