记录类 CompoundIngredient
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.crafting.CompoundIngredient
- 所有已实现的接口:
ICustomIngredient
public record CompoundIngredient(List<Ingredient> children)
extends Record
implements ICustomIngredient
Ingredient that matches if any of the child ingredients match
-
字段概要
字段修饰符和类型字段说明private final List
<Ingredient> children
记录组件的字段。static final com.mojang.serialization.MapCodec
<CompoundIngredient> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明children()
返回children
记录组件的值。display()
Returns the display for this ingredient.final boolean
指示某个其他对象是否“等于”此对象。getType()
返回 the type of this ingredient。final int
hashCode()
返回此对象的哈希代码值。boolean
isSimple()
Returns whether this ingredient always requires direct stack testing.items()
返回 the list of items that this ingredient accepts。static Ingredient
of
(Ingredient... children) Creates a compound ingredient from the given list of ingredientsboolean
Checks if a stack matches this ingredient.final String
toString()
返回此记录类的字符串表示形式。从接口继承的方法 net.neoforged.neoforge.common.crafting.ICustomIngredient
toVanilla
-
字段详细资料
-
children
children
记录组件的字段。 -
CODEC
-
-
构造器详细资料
-
CompoundIngredient
创建CompoundIngredient
记录类的实例。- 参数:
children
-children
记录组件的值
-
-
方法详细资料
-
of
Creates a compound ingredient from the given list of ingredients -
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
-
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
-
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
-
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 此记录类中的所有组件都使用Objects::equals(Object,Object)
进行比较。 -
children
返回children
记录组件的值。- 返回:
children
记录组件的值
-