private void resetRecipe() { if (currentRecipe == null) { currentProduct = null; productionTime = 0; timePerItem = 0; } else { currentProduct = currentRecipe.getProduct(); productionTime = currentRecipe.getTimePerItem(); timePerItem = currentRecipe.getTimePerItem(); } }
@Nullable public static IMoistenerRecipe findMatchingRecipe(ItemStack item) { for (IMoistenerRecipe recipe : recipes) { if (ItemStackUtil.isCraftingEquivalent(recipe.getResource(), item)) { return recipe; } } return null; }
@Override public void getIngredients(IIngredients ingredients) { IMoistenerRecipe recipe = getRecipe(); List<ItemStack> itemStackInputs = new ArrayList<>(); itemStackInputs.add(recipe.getResource()); ItemStack fuelItem = fuel.getItem(); itemStackInputs.add(fuelItem); ingredients.setInputs(ItemStack.class, itemStackInputs); List<ItemStack> itemStackOutputs = new ArrayList<>(); itemStackOutputs.add(recipe.getProduct()); ItemStack fuelProduct = fuel.getProduct(); itemStackOutputs.add(fuelProduct); ingredients.setOutputs(ItemStack.class, itemStackOutputs); ingredients.setInput(FluidStack.class, new FluidStack(FluidRegistry.WATER, recipe.getTimePerItem() / 4)); }
@Override public String getRecipeInfo() { return LogHelper.getStackDescription(recipe.getProduct()); } }
@Override public boolean checkIsRecipe(IMoistenerRecipe recipe) { return recipe != null && matches(output, toIItemStack(recipe.getProduct())); } }
public static boolean isResource(ItemStack resource) { if (resource.isEmpty()) { return false; } for (IMoistenerRecipe rec : recipes) { if (ItemStackUtil.isIdenticalItem(resource, rec.getResource())) { return true; } } return false; }