类 SizedIngredient
java.lang.Object
net.neoforged.neoforge.common.crafting.SizedIngredient
Standard implementation for an ingredient and a count.
Ingredient
does not perform count checks, so this class is used to wrap an ingredient with a count,
and provide a standard serialization format.
-
字段概要
字段修饰符和类型字段说明private final int
private final Ingredient
static final com.mojang.serialization.Codec
<SizedIngredient> The "nested" codec forSizedIngredient
.static final StreamCodec
<RegistryFriendlyByteBuf, SizedIngredient> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明int
count()
boolean
int
hashCode()
static SizedIngredient
Helper method to create a simple sized ingredient that matches a single item.boolean
Performs a size-sensitive test on the given stack.toString()
-
字段详细资料
-
NESTED_CODEC
The "nested" codec forSizedIngredient
.The count is serialized separately from the rest of the ingredient, for example:
{ "ingredient": "minecraft:apple", "count": 3 }
-
STREAM_CODEC
-
ingredient
-
count
private final int count
-
-
构造器详细资料
-
SizedIngredient
-
-
方法详细资料
-
of
Helper method to create a simple sized ingredient that matches a single item. -
ingredient
-
count
public int count() -
test
Performs a size-sensitive test on the given stack.- 返回:
true
if the stack matches the ingredient and has at least the required count.
-
equals
-
hashCode
public int hashCode() -
toString
-