@Override public String getRecipeInfo() { return LogHelper.getStackDescription(recipe.getRecipeOutput()); } }
public static Collection<IFabricatorRecipe> getRecipes(ItemStack itemStack) { if (itemStack.isEmpty()) { return Collections.emptyList(); } return recipes.stream().filter(recipe -> { ItemStack output = recipe.getRecipeOutput(); return ItemStackUtil.isIdenticalItem(itemStack, output); }).collect(Collectors.toList()); } }
public ItemStack getResult(RecipePair<IFabricatorRecipe> myRecipePair) { IFabricatorRecipe myRecipe = myRecipePair.getRecipe(); if (myRecipe == null) { return ItemStack.EMPTY; } return myRecipe.getRecipeOutput().copy(); }
@Override public boolean checkIsRecipe(IFabricatorRecipe recipe) { return recipe != null && matches(product, toIItemStack(recipe.getRecipeOutput())); } }
@Override public void getIngredients(IIngredients ingredients) { IFabricatorRecipe recipe = getRecipe(); NonNullList<NonNullList<ItemStack>> itemInputs = recipe.getIngredients(); List<List<ItemStack>> inputStacks = new ArrayList<>(); for (List<ItemStack> stacks : itemInputs) { List<ItemStack> copy = new ArrayList<>(); copy.addAll(stacks); inputStacks.add(copy); } ingredients.setInputLists(ItemStack.class, inputStacks); ingredients.setInputs(FluidStack.class, Collections.singletonList(getRecipe().getLiquid())); ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput()); } }
@Override protected void onIndexUpdate(int index, IFabricatorRecipe recipe) { selectedElement.add(new TankElement(1, 33, null, () -> new FluidTankInfo(recipe.getLiquid(), 2000), FABRICATOR_TANK_OVERLAY, 16, 16)); NonNullList<NonNullList<ItemStack>> ingredients = recipe.getIngredients(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { int ingredientIndex = y * 3 + x; if (ingredientIndex >= ingredients.size()) { continue; } NonNullList<ItemStack> items = ingredients.get(ingredientIndex); selectedElement.add(new IngredientElement(21 + x * 19, 1 + y * 19, Ingredient.fromStacks(items.toArray(new ItemStack[items.size()])))); } } ItemStack plan = recipe.getPlan(); if (!plan.isEmpty()) { selectedElement.item(91, 1, plan); } selectedElement.item(91, 39, recipe.getRecipeOutput()); NonNullList<ItemStack> smeltingInput = NonNullList.create(); Fluid recipeFluid = recipe.getLiquid().getFluid(); for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(recipeFluid)) { smeltingInput.add(s.getResource()); } if (!smeltingInput.isEmpty()) { selectedElement.add(new IngredientElement(1, 6, smeltingInput)); } }