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

mmb.engine.craft.singles.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<

There is a newer version: 0.6
Show newest version
/**
 * 
 */
package mmb.engine.craft.singles;

import java.util.Set;

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

/**
 *
 * @author oskar
 *
 */
public interface MultiRecipeGroup> extends RecipeGroup {
	/**
	 * Finds recipe(s) which meets criteria
	 * @param in required input item
	 * @return a matching recipe or null if not found
	 */
	@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 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