类 DataComponentIngredient
java.lang.Object
net.neoforged.neoforge.common.crafting.DataComponentIngredient
- 所有已实现的接口:
ICustomIngredient
Ingredient that matches the given items, performing either a
strict
or a partial NBT test.
Strict NBT ingredients will only match items that have exactly the provided tag, while partial ones will match if the item's tags contain all of the elements of the provided one, while allowing for additional elements to exist.
-
字段概要
字段修饰符和类型字段说明static final com.mojang.serialization.MapCodec
<DataComponentIngredient> private final DataComponentExactPredicate
private final ItemStack[]
private final boolean
-
构造器概要
构造器构造器说明DataComponentIngredient
(HolderSet<Item> items, DataComponentExactPredicate components, boolean strict) -
方法概要
修饰符和类型方法说明display()
Returns the display for this ingredient.getType()
返回 the type of this ingredient。boolean
isSimple()
Returns whether this ingredient always requires direct stack testing.boolean
isStrict()
items()
返回 the list of items that this ingredient accepts。itemSet()
static <T> Ingredient
of
(boolean strict, Supplier<? extends DataComponentType<? super T>> type, T value, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
of
(boolean strict, DataComponentExactPredicate predicate, Holder<Item>... items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
of
(boolean strict, DataComponentExactPredicate predicate, HolderSet<Item> items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
of
(boolean strict, DataComponentExactPredicate predicate, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
of
(boolean strict, DataComponentMap map, Holder<Item>... items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
of
(boolean strict, DataComponentMap map, HolderSet<Item> items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
of
(boolean strict, DataComponentMap map, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given componentsstatic <T> Ingredient
of
(boolean strict, DataComponentType<? super T> type, T value, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given componentsstatic Ingredient
Creates a new ingredient matching the given item, containing the given componentsboolean
Checks if a stack matches this ingredient.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.neoforge.common.crafting.ICustomIngredient
toVanilla
-
字段详细资料
-
CODEC
-
items
-
components
-
strict
private final boolean strict -
stacks
-
-
构造器详细资料
-
DataComponentIngredient
public DataComponentIngredient(HolderSet<Item> items, DataComponentExactPredicate components, boolean strict)
-
-
方法详细资料
-
test
从接口复制的说明:ICustomIngredient
Checks if a stack matches this ingredient. The stack must not be modified in any way.- 指定者:
test
在接口中ICustomIngredient
- 参数:
stack
- the stack to test- 返回:
true
if the stack matches this ingredient,false
otherwise
-
items
从接口复制的说明:ICustomIngredient
返回 the list of items that this ingredient accepts。The following guidelines should be followed for good compatibility:
- At least one item must be returned for the ingredient not to be considered empty. Empty ingredients invalidate the entire recipe.
- The ingredient should return all
Item
s it might possible accept. This allows mods that inspect the ingredient to figure out which stacks it might accept. - Returned items might not always be accepted by the ingredient, as an ingredient might still perform additional NBT-dependent tests.
- An exception is ingredients that are simple,
for which
testing a stack
is equivalent to testing if the item is in the returned list.
Note: no caching needs to be done by the implementation, this is already handled by the ingredient itself.
- 指定者:
items
在接口中ICustomIngredient
- 返回:
- the list of items that this ingredient accepts
-
isSimple
public boolean isSimple()从接口复制的说明:ICustomIngredient
Returns whether this ingredient always requires direct stack testing.- 指定者:
isSimple
在接口中ICustomIngredient
- 返回:
true
if this ingredient ignores NBT data when matching stacks,false
otherwise- 另请参阅:
-
getType
从接口复制的说明:ICustomIngredient
返回 the type of this ingredient。The type must be registered to
NeoForgeRegistries.INGREDIENT_TYPES
.- 指定者:
getType
在接口中ICustomIngredient
- 返回:
- the type of this ingredient
-
display
从接口复制的说明:ICustomIngredient
Returns the display for this ingredient.The display is synced to the client, and is also used to retrieve the
ItemStack
s that are shown to the client.- 指定者:
display
在接口中ICustomIngredient
-
itemSet
-
components
-
isStrict
public boolean isStrict() -
of
Creates a new ingredient matching the given item, containing the given components -
of
public static <T> Ingredient of(boolean strict, DataComponentType<? super T> type, T value, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given components -
of
public static <T> Ingredient of(boolean strict, Supplier<? extends DataComponentType<? super T>> type, T value, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given components -
of
Creates a new ingredient matching any item from the list, containing the given components -
of
@SafeVarargs public static Ingredient of(boolean strict, DataComponentMap map, Holder<Item>... items) Creates a new ingredient matching any item from the list, containing the given components -
of
Creates a new ingredient matching any item from the list, containing the given components -
of
@SafeVarargs public static Ingredient of(boolean strict, DataComponentExactPredicate predicate, Holder<Item>... items) Creates a new ingredient matching any item from the list, containing the given components -
of
public static Ingredient of(boolean strict, DataComponentExactPredicate predicate, ItemLike... items) Creates a new ingredient matching any item from the list, containing the given components -
of
public static Ingredient of(boolean strict, DataComponentExactPredicate predicate, HolderSet<Item> items) Creates a new ingredient matching any item from the list, containing the given components
-