记录类 TestEnabledIngredient

java.lang.Object
java.lang.Record
net.neoforged.testframework.condition.TestEnabledIngredient
所有已实现的接口:
ICustomIngredient

public record TestEnabledIngredient(Ingredient base, TestFramework framework, String testId) extends Record implements ICustomIngredient
  • 字段详细资料

    • base

      private final Ingredient base
      base 记录组件的字段。
    • framework

      private final TestFramework framework
      framework 记录组件的字段。
    • testId

      private final String testId
      testId 记录组件的字段。
    • CODEC

      public static final com.mojang.serialization.MapCodec<TestEnabledIngredient> CODEC
  • 构造器详细资料

    • TestEnabledIngredient

      public TestEnabledIngredient(Ingredient base, TestFramework framework, String testId)
      创建 TestEnabledIngredient 记录类的实例。
      参数:
      base - base 记录组件的值
      framework - framework 记录组件的值
      testId - testId 记录组件的值
  • 方法详细资料

    • test

      public boolean test(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
    • 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
    • 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
    • toString

      public final String toString()
      返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。
      指定者:
      toString 在类中 Record
      返回:
      此对象的字符串表示形式
    • hashCode

      public final int hashCode()
      返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。
      指定者:
      hashCode 在类中 Record
      返回:
      此对象的哈希代码值
    • equals

      public final boolean equals(Object o)
      指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 此记录类中的所有组件都使用 Objects::equals(Object,Object) 进行比较。
      指定者:
      equals 在类中 Record
      参数:
      o - 要与之进行比较的对象
      返回:
      如果此对象与 o 参数相同,则为 true;否则为 false
    • base

      public Ingredient base()
      返回 base 记录组件的值。
      返回:
      base 记录组件的值
    • framework

      public TestFramework framework()
      返回 framework 记录组件的值。
      返回:
      framework 记录组件的值
    • testId

      public String testId()
      返回 testId 记录组件的值。
      返回:
      testId 记录组件的值