Class Ingredient
java.lang.Object
net.minecraft.world.item.crafting.Ingredient
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
static final record
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<Ingredient> This codec allows both the{...}
and[{...}, {...}, ...]
syntax.static final com.mojang.serialization.Codec
<Ingredient> Same asCODEC
except that empty ingredients ([]
) are not allowed.static final StreamCodec
<RegistryFriendlyByteBuf, Ingredient> private ICustomIngredient
static final Ingredient
private ItemStack[]
static final com.mojang.serialization.Codec
<List<Ingredient>> static final com.mojang.serialization.Codec
<List<Ingredient>> static final com.mojang.serialization.MapCodec
<Ingredient> This is a codec that only allows the{...}
syntax.private it.unimi.dsi.fastutil.ints.IntList
private final Ingredient.Value[]
-
Constructor Summary
ModifierConstructorDescriptionprivate
Ingredient
(Stream<? extends Ingredient.Value> p_43907_) private
Ingredient
(Ingredient.Value[] p_301044_) Ingredient
(ICustomIngredient customIngredient) -
Method Summary
Modifier and TypeMethodDescriptionprivate static com.mojang.serialization.Codec
<Ingredient> codec
(boolean p_301074_) Deprecated.boolean
static Ingredient
fromValues
(Stream<? extends Ingredient.Value> p_43939_) getItems()
it.unimi.dsi.fastutil.ints.IntList
Retrieves the underlying values of this ingredient.int
hashCode()
boolean
Returnstrue
if this ingredient has an empty stack list.boolean
isCustom()
boolean
isEmpty()
Returnstrue
if this ingredient is explicitly chosen to be empty, i.e.boolean
isSimple()
static Ingredient
of()
static Ingredient
static Ingredient
static Ingredient
static Ingredient
boolean
-
Field Details
-
EMPTY
-
CONTENTS_STREAM_CODEC
-
values
-
itemStacks
-
stackingIds
@Nullable private it.unimi.dsi.fastutil.ints.IntList stackingIds -
customIngredient
-
CODEC
This codec allows both the{...}
and[{...}, {...}, ...]
syntax.[]
is allowed for empty ingredients, and will only match empty stacks. -
CODEC_NONEMPTY
Same asCODEC
except that empty ingredients ([]
) are not allowed. -
MAP_CODEC_NONEMPTY
This is a codec that only allows the{...}
syntax. Array ingredients are serialized using the CompoundIngredient custom ingredient type:{ "type": "neoforge:compound", "ingredients": [{...}, {...}, ...] }
. -
LIST_CODEC
-
LIST_CODEC_NONEMPTY
-
-
Constructor Details
-
Ingredient
-
Ingredient
-
Ingredient
-
-
Method Details
-
getItems
-
test
-
getStackingIds
public it.unimi.dsi.fastutil.ints.IntList getStackingIds() -
isEmpty
public boolean isEmpty()Returnstrue
if this ingredient is explicitly chosen to be empty, i.e. using[]
. -
hasNoItems
public boolean hasNoItems()Returnstrue
if this ingredient has an empty stack list. UnlikeisEmpty()
, this will catch "accidentally empty" ingredients, for example a tag ingredient that has an empty tag. -
equals
-
hashCode
public int hashCode() -
getValues
Retrieves the underlying values of this ingredient. If this is a custom ingredient, an exception is thrown. -
isSimple
public boolean isSimple() -
getCustomIngredient
-
isCustom
public boolean isCustom() -
fromValues
-
of
-
of
-
of
-
of
-
of
-
codec
Deprecated.
-