类 BlockTagIngredient

java.lang.Object
net.neoforged.neoforge.common.crafting.BlockTagIngredient
所有已实现的接口:
ICustomIngredient

public class BlockTagIngredient extends Object implements ICustomIngredient
Ingredient that matches ItemStacks of Blocks from a TagKey<Block>, useful in cases like "minecraft:convertable_to_mud" where there isn't an accompanying item tag

Notice: This should not be used as a replacement for the normal item tag ingredient. This should only be used when there is no way an item tag can be used in your use case

  • 字段详细资料

  • 构造器详细资料

    • BlockTagIngredient

      public BlockTagIngredient(TagKey<Block> tag)
  • 方法详细资料

    • dissolve

      protected HolderSet<Item> dissolve()
    • items

      public Stream<Holder<Item>> items()
      从接口复制的说明: ICustomIngredient
      返回 the list of items that this ingredient accepts。

      The following guidelines should be followed for good compatibility:

      • At least one item must be returned for the ingredient not to be considered empty. Empty ingredients invalidate the entire recipe.
      • The ingredient should return all Items it might possible accept. This allows mods that inspect the ingredient to figure out which stacks it might accept.
      • Returned items might not always be accepted by the ingredient, as an ingredient might still perform additional NBT-dependent tests.
      • An exception is ingredients that are simple, for which testing a stack is equivalent to testing if the item is in the returned list.

      Note: no caching needs to be done by the implementation, this is already handled by the ingredient itself.

      指定者:
      items 在接口中 ICustomIngredient
      返回:
      the list of items that this ingredient accepts
    • test

      public boolean test(@Nullable @Nullable ItemStack stack)
      从接口复制的说明: ICustomIngredient
      Checks if a stack matches this ingredient. The stack must not be modified in any way.
      指定者:
      test 在接口中 ICustomIngredient
      参数:
      stack - the stack to test
      返回:
      true if the stack matches this ingredient, false otherwise
    • getTag

      public TagKey<Block> getTag()
    • isSimple

      public boolean isSimple()
      从接口复制的说明: ICustomIngredient
      Returns whether this ingredient always requires direct stack testing.
      指定者:
      isSimple 在接口中 ICustomIngredient
      返回:
      true if this ingredient ignores NBT data when matching stacks, false otherwise
      另请参阅:
    • getType

      public IngredientType<?> getType()
      从接口复制的说明: ICustomIngredient
      返回 the type of this ingredient。

      The type must be registered to NeoForgeRegistries.INGREDIENT_TYPES.

      指定者:
      getType 在接口中 ICustomIngredient
      返回:
      the type of this ingredient
    • display

      public SlotDisplay display()
      从接口复制的说明: ICustomIngredient
      Returns the display for this ingredient.

      The display is synced to the client, and is also used to retrieve the ItemStacks that are shown to the client.

      指定者:
      display 在接口中 ICustomIngredient
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object