ACombinedIngredient¶
abstract class ACombinedIngredient : IACustomIngredient
Base class for ALL and ANY ingredients.
Inheritors¶
Types¶
Serializer¶
class Serializer<I : ACombinedIngredient>(
val identifier: ResourceLocation,
factory: Function<List<Ingredient>, I>,
allowEmptyCodec: MapCodec<I>,
disallowEmptyCodec: MapCodec<I>
) : IACustomIngredientSerializer<I>
Properties¶
ingredients¶
val ingredients: List<Ingredient>
matchingStacks¶
abstract val matchingStacks: MutableList<ItemStack>
Return
the list of stacks that match this ingredient.
The following guidelines should be followed for good compatibility:
-
These stacks are generally used for display purposes, and need not be exhaustive or perfectly accurate.
-
An exception is ingredients that .requiresTesting, for which it is important that the returned stacks correspond exactly to all the accepted Items.
-
At least one stack must be returned for the ingredient not to be considered empty.
-
The ingredient should try to return at least one stack with each accepted Item. This allows mods that inspect the ingredient to figure out which stacks it might accept.
Note: no caching needs to be done by the implementation, this is already handled by the ingredient itself.
requiresTesting¶
open override val requiresTesting: Boolean
Returns whether this ingredient always requires .test.
Return
false if this ingredient ignores NBT data when matching stacks, true otherwise
See also
- FabricIngredient.requiresTesting
serializer¶
abstract val serializer: IACustomIngredientSerializer<*>
Return
The serializer for this ingredient
The serializer must have been registered using IACustomIngredientSerializer.register.
vanilla¶
@get:
ApiStatus.NonExtendable
open val vanilla: Ingredient
Return
a new Ingredient behaving as defined by this custom ingredient.
Functions¶
test¶
Checks if a stack matches this ingredient. The stack must not be modified in any way.
Return
true if the stack matches this ingredient, false otherwise
Parameters
- stack: the stack to test