Class BlockTagIngredient
java.lang.Object
net.neoforged.neoforge.common.crafting.BlockTagIngredient
- All Implemented Interfaces:
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondisplay()Returns the display for this ingredient.dissolve()booleangetTag()getType()Returns the type of this ingredient.inthashCode()booleanisSimple()Returns whether this ingredient always requires direct stack testing.items()Returns the list of items that this ingredient accepts.booleanChecks if a stack matches this ingredient.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.common.crafting.ICustomIngredient
toVanilla
-
Field Details
-
CODEC
-
tag
-
items
-
-
Constructor Details
-
BlockTagIngredient
-
-
Method Details
-
dissolve
-
items
Description copied from interface:ICustomIngredientReturns 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 stackis 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.
- Specified by:
itemsin interfaceICustomIngredient- Returns:
- the list of items that this ingredient accepts
-
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
-
getTag
-
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
-
display
Description copied from interface:ICustomIngredientReturns 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.- Specified by:
displayin interfaceICustomIngredient
-
equals
-
hashCode
public int hashCode()
-