Record Class TestEnabledIngredient
java.lang.Object
java.lang.Record
net.neoforged.testframework.condition.TestEnabledIngredient
- All Implemented Interfaces:
ICustomIngredient
public record TestEnabledIngredient(Ingredient base, TestFramework framework, String testId)
extends Record
implements ICustomIngredient
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IngredientThe field for thebaserecord component.static final com.mojang.serialization.MapCodec<TestEnabledIngredient> private final TestFrameworkThe field for theframeworkrecord component.private final StringThe field for thetestIdrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionTestEnabledIngredient(Ingredient base, TestFramework framework, String testId) Creates an instance of aTestEnabledIngredientrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbase()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theframeworkrecord component.getItems()Returns the list of stacks that this ingredient accepts.getType()Returns the type of this ingredient.final inthashCode()Returns a hash code value for this object.booleanisSimple()Returns whether this ingredient always requires direct stack testing.booleanChecks if a stack matches this ingredient.testId()Returns the value of thetestIdrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.common.crafting.ICustomIngredient
toVanilla
-
Field Details
-
base
The field for thebaserecord component. -
framework
The field for theframeworkrecord component. -
testId
The field for thetestIdrecord component. -
CODEC
-
-
Constructor Details
-
TestEnabledIngredient
Creates an instance of aTestEnabledIngredientrecord class.- Parameters:
base- the value for thebaserecord componentframework- the value for theframeworkrecord componenttestId- the value for thetestIdrecord component
-
-
Method Details
-
test
Description copied from interface:ICustomIngredientChecks if a stack matches this ingredient. The stack must not be modified in any way.- Specified by:
testin interfaceICustomIngredient- Parameters:
stack- the stack to test- Returns:
trueif the stack matches this ingredient,falseotherwise
-
getItems
Description copied from interface:ICustomIngredientReturns the list of stacks that this ingredient accepts.The following guidelines should be followed for good compatibility:
- These stacks are generally used for display purposes, and need not be exhaustive or perfectly accurate.
- An exception is ingredients that are simple,
for which it is important that the returned stacks correspond exactly to all the accepted
Items. - At least one stack must be returned for the ingredient not to be considered accidentally empty.
- The ingredient should try to return at least one stack with each accepted
Item. This allows mods that inspect the ingredient to figure out which stacks it might accept.
Note: no caching needs to be done by the implementation, this is already handled by the ingredient itself.
- Specified by:
getItemsin interfaceICustomIngredient- Returns:
- the list of stacks that this ingredient accepts
-
isSimple
public boolean isSimple()Description copied from interface:ICustomIngredientReturns whether this ingredient always requires direct stack testing.- Specified by:
isSimplein interfaceICustomIngredient- Returns:
trueif this ingredient ignores NBT data when matching stacks,falseotherwise- See Also:
-
getType
Description copied from interface:ICustomIngredientReturns the type of this ingredient.The type must be registered to
NeoForgeRegistries.INGREDIENT_TYPES.- Specified by:
getTypein interfaceICustomIngredient- Returns:
- the type of this ingredient
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
base
Returns the value of thebaserecord component.- Returns:
- the value of the
baserecord component
-
framework
Returns the value of theframeworkrecord component.- Returns:
- the value of the
frameworkrecord component
-
testId
Returns the value of thetestIdrecord component.- Returns:
- the value of the
testIdrecord component
-