@Override public Optional<Match> matches(NonNullList<ItemStack> stacks) { List<ItemStack> matches = Lists.newArrayList(); Optional<Match> match = super.matches(stacks); while(match.isPresent() && matches.size() < 3) { ItemStack stack = match.get().stacks.get(0); matches.add(stack); // remove all meats of the same kind for(int i = 0; i < stacks.size(); i++) { if(stacks.get(i).getItem() == stack.getItem()) { stacks.set(i, ItemStack.EMPTY); } } match = super.matches(stacks); } if(matches.size() >= 3) { return Optional.of(new Match(matches, 1)); } return Optional.empty(); } }
public static RecipeMatch of(String oredict, int amount, int matched) { return new RecipeMatch.Oredict(oredict, amount, matched); }
public static RecipeMatch of(List<ItemStack> oredict, int amount, int matched) { return new RecipeMatch.Oredict(oredict, amount, matched); }
/** * Associates an oredict entry with this material. Used for repairing and other. * * @param oredictItem Oredict-String * @param amountNeeded How many of this item are needed to count as one full material item. * @param amountMatched If both item and amount are present, how often did they match? */ public void addItem(String oredictItem, int amountNeeded, int amountMatched) { items.add(new RecipeMatch.Oredict(oredictItem, amountNeeded, amountMatched)); }
public static void registerMelting(String oredict, Fluid fluid, int amount) { registerMelting(new MeltingRecipe(new RecipeMatch.Oredict(oredict, 1, amount), fluid)); }
/** * Adds a new drying recipe * * @param oredict Input ore dictionary entry * @param output Output ItemStack * @param time Recipe time in ticks */ public static void registerDryingRecipe(String oredict, ItemStack output, int time) { if(output.isEmpty() || oredict == null) { return; } addDryingRecipe(new DryingRecipe(new RecipeMatch.Oredict(oredict, 1), output, time)); }