GroupRecipe

open class GroupRecipe @JvmOverloads constructor(val name: String, val items: Map<CoordinateComponent, CMatter>, val groups: Set<GroupRecipe.Context>, predicates: List<CRecipePredicate>? = null, val results: List<ResultSupplier>? = null) : CRecipe, UnPartialSearchableRecipe

Implementation of CRecipe.

This recipe only provides CRecipe.Type.SHAPED.

This recipe has groups what is a list of air-containable matter (GroupRecipe.Matter).

This recipe has the constraint that "all Context#members to which the key that returns the smallest CoordinateComponent#toIndex value in items belongs cannot have an element in candidate that satisfies Material#isAir."

items = {
(0, 0): [Material.AIR, Material.STONE],
(0, 1): [Material.COBBLESTONE]
}

// This is invalid groups. Group1 contains the minimum coordinate what keyed with a CMatter that contains Material.AIR.
groups = [Group1{ (0, 0) }, Group2{ (0, 1) }]
// Other invalid pattern
items = {
(0, 0): [Material.STONE],
(0, 1): [Material.AIR, Material.COBBLESTONE]
}

// This is invalid group.
groups = [Group1{ (0, 0), (0, 1) }]

GroupRecipe.recipePredicate is always appended to GroupRecipe.predicates automatically, regardless of whether predicates is specified in the constructor.

Since

5.0.15

Parameters

name

Name of this recipe

items

Item mapping

groups

Air-containable context set. It can be empty.

predicates

Additional predicates prepended before recipePredicate. Defaults to none. recipePredicate is always included automatically and does not need to be added manually.

results

See also

Constructors

Link copied to clipboard
constructor(name: String, items: Map<CoordinateComponent, CMatter>, groups: Set<GroupRecipe.Context>, predicates: List<CRecipePredicate>? = null, results: List<ResultSupplier>? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Context

Context of GroupRecipe

Link copied to clipboard
class Matter : CMatter

Air-containable CMatter implementation.

Properties

Link copied to clipboard
Link copied to clipboard
open override val items: Map<CoordinateComponent, CMatter>
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val predicates: List<CRecipePredicate>

List of CRecipePredicate that run during recipe matching. null or empty means no additional conditions.

Link copied to clipboard
open override val results: List<ResultSupplier>?
Link copied to clipboard
open override val type: CRecipe.Type

Type of this recipe. See CRecipe.Type.

Functions

Link copied to clipboard

Returns CRecipePredicate inspection result on async.

Link copied to clipboard

Returns results of suppliers made asynchronously.

Link copied to clipboard
open fun getRecipePredicateResults(context: CRecipePredicate.Context, whenEmptyDefault: Boolean = true): Boolean

Returns CRecipePredicate inspection result

Link copied to clipboard

Returns results of suppliers made

Link copied to clipboard
open fun getTimes(map: Map<CoordinateComponent, ItemStack>, relation: MappedRelation, shift: Boolean, withoutMass: Boolean = true): Int

Returns the minimum craft count calculated from input item amounts and recipe requirements.

Link copied to clipboard
open override fun isValidRecipe(): Result<Unit>

Returns this CRecipe is a valid or not.

Link copied to clipboard

Maximum requires input items amount. Inclusive

Link copied to clipboard
open override fun requiresInputItemAmountMin(): Int

Minimal requires input items amount