/// <summary> /// Sets the currently selected recipie. /// </summary> public void setSelectedRecipe(ButtonRecipe recipe) { this.selectedRecipe = recipe; ItemData[] ingredients; if (recipe == null) { ingredients = new ItemData[0]; } else { ingredients = recipe.getRecipe().getIngredients(); } for (int i = 0; i < this.ingredientIcons.Length; i++) { RecipeIngredientIcon icon = this.ingredientIcons[i]; if (i <= ingredients.Length - 1) { icon.setItem(ingredients[i]); icon.setColor(this.getPlayer().inventory.containsItem(ingredients[i], out int j) ? RecipeIngredientIcon.EnumColor.GREEN : RecipeIngredientIcon.EnumColor.RED); } else { icon.setItem(null); icon.setColor(RecipeIngredientIcon.EnumColor.GRAY); } } this.updateCraftButtonInteractable(); }