diff --git a/src/main/java/ru/betterend/recipe/builders/AlloyingRecipe.java b/src/main/java/ru/betterend/recipe/builders/AlloyingRecipe.java index 0e3dfc5f..7ea3597c 100644 --- a/src/main/java/ru/betterend/recipe/builders/AlloyingRecipe.java +++ b/src/main/java/ru/betterend/recipe/builders/AlloyingRecipe.java @@ -238,8 +238,8 @@ public class AlloyingRecipe implements Recipe { JsonArray ingredients = JsonHelper.getArray(json, "ingredients"); Ingredient primaryInput = Ingredient.fromJson(ingredients.get(0)); Ingredient secondaryInput = Ingredient.fromJson(ingredients.get(1)); - JsonObject result = JsonHelper.getObject(json, "result"); String group = JsonHelper.getString(json, "group", ""); + JsonObject result = JsonHelper.getObject(json, "result"); ItemStack output = ItemUtil.fromJsonRecipe(result); if (output == null) { throw new IllegalStateException("Output item does not exists!"); diff --git a/src/main/java/ru/betterend/util/ItemUtil.java b/src/main/java/ru/betterend/util/ItemUtil.java index 65f15237..8d8f6835 100644 --- a/src/main/java/ru/betterend/util/ItemUtil.java +++ b/src/main/java/ru/betterend/util/ItemUtil.java @@ -31,13 +31,17 @@ public class ItemUtil { public static ItemStack fromStackString(String stackString) { if (stackString == null || stackString.equals("")) return null; String[] parts = stackString.split(":"); + if (parts.length < 2) return null; + if (parts.length == 2) { + Identifier itemId = new Identifier(stackString); + Item item = Registry.ITEM.getOrEmpty(itemId).orElse(null); + if (item == null) return null; + return new ItemStack(item); + } Identifier itemId = new Identifier(parts[0], parts[1]); Item item = Registry.ITEM.getOrEmpty(itemId).orElse(null); if (item == null) return null; - if (parts.length > 2) { - return new ItemStack(item, Integer.valueOf(parts[2])); - } - return new ItemStack(item); + return new ItemStack(item, Integer.valueOf(parts[2])); } @Nullable