Class Ingredient
java.lang.Object
net.minecraft.world.item.crafting.Ingredient
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Ingredient> This codec allows both the{...}and[{...}, {...}, ...]syntax.static final com.mojang.serialization.Codec<Ingredient> Same asCODECexcept that empty ingredients ([]) are not allowed.static final StreamCodec<RegistryFriendlyByteBuf, Ingredient> private ICustomIngredientstatic final Ingredientprivate 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.IntListprivate final Ingredient.Value[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIngredient(Stream<? extends Ingredient.Value> p_43907_) privateIngredient(Ingredient.Value[] p_301044_) Ingredient(ICustomIngredient customIngredient) -
Method Summary
Modifier and TypeMethodDescriptionprivate static com.mojang.serialization.Codec<Ingredient> codec(boolean p_301074_) Deprecated.booleanstatic IngredientfromValues(Stream<? extends Ingredient.Value> p_43939_) getItems()it.unimi.dsi.fastutil.ints.IntListRetrieves the underlying values of this ingredient.inthashCode()booleanReturnstrueif this ingredient has an empty stack list.booleanisCustom()booleanisEmpty()Returnstrueif this ingredient is explicitly chosen to be empty, i.e.booleanisSimple()static Ingredientof()static Ingredientstatic Ingredientstatic Ingredientstatic Ingredientboolean
-
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 asCODECexcept 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()Returnstrueif this ingredient is explicitly chosen to be empty, i.e. using[]. -
hasNoItems
public boolean hasNoItems()Returnstrueif 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.
-