Skip to content

AAnyIngredient

Custom ingredient that matches a stack when at least one of its sub-ingredients matches it. Build via of.

Types

Companion

object Companion

Properties

ingredients

val ingredients: List<Ingredient>

The sub-ingredients being combined; always non-empty.

matchingStacks

open override val matchingStacks: MutableList<ItemStack>

The stacks that match this ingredient, for display purposes (e.g. in a recipe viewer).

Guidelines for good compatibility:

  • These stacks need not be exhaustive or perfectly accurate, except when requiresTesting is false, in which case they must correspond exactly to every accepted item.

  • At least one stack must be returned, or the ingredient is considered empty.

  • Try to include at least one stack per accepted item, so inspecting mods can enumerate what the ingredient might accept.

No caching is required here; the ingredient itself already caches this.

requiresTesting

open override val requiresTesting: Boolean

true if any sub-ingredient is a custom ingredient that itself requires testing.

serializer

The serializer for this ingredient. Must have been registered via IACustomIngredientSerializer.register.

vanilla

@get:



ApiStatus.NonExtendable



open val vanilla: Ingredient

Converts this custom ingredient into a vanilla Ingredient behaving the same way.

Functions

test

open override fun test(stack: ItemStack): Boolean

Checks whether stack matches this ingredient. Must not modify stack.