Class PartialNBTIngredient

java.lang.Object
net.minecraft.world.item.crafting.Ingredient
net.neoforged.neoforge.common.crafting.PartialNBTIngredient
All Implemented Interfaces:
Predicate<ItemStack>

public class PartialNBTIngredient extends Ingredient
Ingredient that matches the given items, performing a partial NBT match. Use StrictNBTIngredient if you want exact match on NBT
  • Field Details

  • Constructor Details

    • PartialNBTIngredient

      protected PartialNBTIngredient(Set<Item> items, CompoundTag tag)
  • Method Details

    • areStacksEqual

      protected boolean areStacksEqual(ItemStack left, ItemStack right)
      Overrides:
      areStacksEqual in class Ingredient
    • synchronizeWithContents

      public boolean synchronizeWithContents()
      Description copied from class: Ingredient
      Returns if true, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the codec.
      Overrides:
      synchronizeWithContents in class Ingredient
      Returns:
      if true, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the codec
    • compareStacksUsingPredicate

      private static boolean compareStacksUsingPredicate(ItemStack left, ItemStack right)
    • of

      public static PartialNBTIngredient of(CompoundTag nbt, ItemLike... items)
      Creates a new ingredient matching any item from the list, containing the given NBT
    • of

      public static PartialNBTIngredient of(ItemLike item, CompoundTag nbt)
      Creates a new ingredient matching the given item, containing the given NBT
    • getContainedItems

      public Set<Item> getContainedItems()
    • getTag

      public CompoundTag getTag()
    • isSimple

      public boolean isSimple()
      Overrides:
      isSimple in class Ingredient