All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.content.electric.recipes.MultiRecipeGroup Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

The newest version!
/**
 * 
 */
package mmb.content.electric.recipes;

import java.util.Set;

import mmb.NN;
import mmb.Nil;
import mmb.engine.item.ItemEntry;
import mmb.engine.recipe.Recipe;
import mmb.engine.recipe.RecipeGroup;
import monniasza.collects.Collects;

/**
 * An interface to a multi-item recipe group
 * @author oskar
 * @param  type of recipes
 */
public interface MultiRecipeGroup<@NN T extends Recipe> extends RecipeGroup {
	/**
	 * Finds recipe(s) which meets criteria
	 * @param in required input item
	 * @return a set of matching recipes
	 */
	@Nil public Set findPlausible(ItemEntry in);
	/**
	 * Finds a single recipe which meets criteria
	 * @param catalyst required catalyst (null if none)
	 * @param in required inputs
	 * @return a matching recipe or null if not found
	 */
	@Nil public default T findExact(Set<@NN ItemEntry> in, @Nil ItemEntry catalyst) {
		Set candidates = findPlausible(Collects.first(in));
		if(candidates == null) return null;
		for(T candidate: candidates) {
			if(candidate.catalyst() == catalyst && candidate.inputs().items().equals(in)) return candidate;
		}
		return null;
	}
	/** @return minimum ingredients */
	public int minIngredients();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy