public static void registerCustomItemsRecipes() {
Main.getInstance().getConfigManager().getCustomItems().getConfigurationSection("CustomItems").getKeys(false).forEach(item -> {
List<String> matrix = Main.getInstance().getConfigManager().getCustomItems().getStringList("CustomItems." + item + ".Craft.Matrix");
ShapedRecipe shapedRecipe = new ShapedRecipe(new NamespacedKey(Main.getInstance(), item.toLowerCase()), ItemUtils.getCustomItemFromConfig(item).getItemStack());
shapedRecipe.shape(matrix.get(0),
matrix.get(1),
matrix.get(2));
Main.getInstance().getConfigManager().getCustomItems().getConfigurationSection("CustomItems." + item + ".Craft.Ingredients").getKeys(false).forEach(ingredient -> {
String customItemName = Main.getInstance().getConfigManager().getCustomItems().getString("CustomItems." + item + ".Craft.Ingredients." + ingredient + ".CustomItem");
if(customItemName != null) {
TWDItem twdItem = ItemUtils.getCustomItemFromConfig(customItemName);
shapedRecipe.setIngredient(ingredient.charAt(0), new RecipeChoice.ExactChoice(twdItem.getItemStack()));
} else {
Material material = Material.valueOf(Main.getInstance().getConfigManager().getCustomItems().getString("CustomItems." + item + ".Craft.Ingredients." + ingredient + ".Material").toUpperCase());
shapedRecipe.setIngredient(ingredient.charAt(0), material);
}
});
shapedRecipes.add(shapedRecipe);
Bukkit.addRecipe(shapedRecipe);
});
}