Class Ingredient

java.lang.Object
net.minecraft.world.item.crafting.Ingredient
All Implemented Interfaces:
Predicate<ItemStack>
Direct Known Subclasses:
CompoundIngredient, DifferenceIngredient, IntersectionIngredient, NBTIngredient, TestEnabledIngredient

public class Ingredient extends Object implements Predicate<ItemStack>
  • Field Details

    • EMPTY

      public static final Ingredient EMPTY
    • values

      public final Ingredient.Value[] values
    • itemStacks

      @Nullable private ItemStack[] itemStacks
    • stackingIds

      @Nullable private it.unimi.dsi.fastutil.ints.IntList stackingIds
    • type

      private final Supplier<? extends IngredientType<?>> type
    • VANILLA_CODEC

      public static final com.mojang.serialization.Codec<Ingredient> VANILLA_CODEC
    • VANILLA_CODEC_NONEMPTY

      public static final com.mojang.serialization.Codec<Ingredient> VANILLA_CODEC_NONEMPTY
    • CODEC

      public static final com.mojang.serialization.Codec<Ingredient> CODEC
    • CODEC_NONEMPTY

      public static final com.mojang.serialization.Codec<Ingredient> CODEC_NONEMPTY
    • LIST_CODEC

      public static final com.mojang.serialization.Codec<List<Ingredient>> LIST_CODEC
    • LIST_CODEC_NONEMPTY

      public static final com.mojang.serialization.Codec<List<Ingredient>> LIST_CODEC_NONEMPTY
  • Constructor Details

  • Method Details

    • getType

      public IngredientType<?> getType()
    • getItems

      public ItemStack[] getItems()
    • test

      public boolean test(@Nullable ItemStack p_43914_)
      Specified by:
      test in interface Predicate<ItemStack>
    • areStacksEqual

      protected boolean areStacksEqual(ItemStack left, ItemStack right)
    • getStackingIds

      public it.unimi.dsi.fastutil.ints.IntList getStackingIds()
    • toNetwork

      public final void toNetwork(FriendlyByteBuf p_43924_)
    • synchronizeWithContents

      public boolean synchronizeWithContents()
      Returns if true, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the codec.
      Returns:
      if true, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the codec
    • isEmpty

      public boolean isEmpty()
    • equals

      public boolean equals(Object p_301003_)
      Overrides:
      equals in class Object
    • isSimple

      public boolean isSimple()
    • fromValues

      public static Ingredient fromValues(Stream<? extends Ingredient.Value> p_43939_)
    • of

      public static Ingredient of()
    • of

      public static Ingredient of(ItemLike... p_43930_)
    • of

      public static Ingredient of(ItemStack... p_43928_)
    • of

      public static Ingredient of(Stream<ItemStack> p_43922_)
    • of

      public static Ingredient of(TagKey<Item> p_204133_)
    • fromJson

      public static Ingredient fromJson(com.google.gson.JsonElement element, boolean nonEmpty)
    • fromNetwork

      public static Ingredient fromNetwork(FriendlyByteBuf p_43941_)
    • codec

      private static com.mojang.serialization.Codec<Ingredient> codec(boolean p_301074_)
    • getValues

      public final Ingredient.Value[] getValues()