Interface IIngredient
- All Superinterfaces:
CommandStringDisplayable
- All Known Subinterfaces:
IItemStack
- All Known Implementing Classes:
IIngredientAny,IIngredientEmpty,IIngredientList,TagIngredient,WrappingIIngredient
The CraftTweaker Ingredient class which is used to power our recipes and ItemStack matching.
- DocParam:
- this invalid input: '<'tag:item:minecraft:wool>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<IIngredient> static final net.minecraft.resources.ResourceLocationstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, IIngredient> -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddGlobalAttributeModifier(net.minecraft.world.entity.ai.attributes.Attribute attribute, net.minecraft.resources.ResourceLocation id, double value, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.default voidaddShiftTooltip(net.minecraft.network.chat.Component content, net.minecraft.network.chat.Component showMessage) default voidaddTooltip(net.minecraft.network.chat.Component content) default IIngredientdefault IDataasIData()default IIngredientWithAmountUsed implicitly when a machine can accept more than one item but you only provide one.default MapDatanet.minecraft.world.item.crafting.IngredientCreate a Vanilla ingredient matching this one.default voidclearTooltip(boolean leaveName) default IIngredientcondition(IIngredientCondition condition) Use this if you already have the condition from another ingredientdefault booleancontains(IIngredient ingredient) Does the ingredient contain the given ingredient?static IIngredientfromIngredient(net.minecraft.world.item.crafting.Ingredient ingredient) Returns the BEP to get this stackgetItems()default IItemStackgetRemainingItem(IItemStack stack) When this ingredient stack is crafted, what will remain in the grid? Does not check if the stack matches though! Used e.g.default booleanisEmpty()Checks if this ingredient is empty.booleanmatches(IItemStack stack) Does the given stack match the ingredient?default voidmodifyShiftTooltip(ITooltipFunction shiftedFunction, ITooltipFunction unshiftedFunction) default voidmodifyTooltip(ITooltipFunction function) default IIngredientWithAmountmul(int amount) Use this in contexts where machines accept more than one item to state that fact.default IIngredientdefault IIngredientonlyDamagedAtLeast(int minDamage) default IIngredientonlyDamagedAtMost(int maxDamage) default IIngredientonlyIf(String uid, Predicate<IItemStack> function) default IIngredientListor(IIngredient other) default voidremoveGlobalAttribute(net.minecraft.world.entity.ai.attributes.Attribute attribute, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.default voidremoveGlobalAttributeModifier(String uuid, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.default voidremoveGlobalAttributeModifier(UUID uuid, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.default voidremoveTooltip(String regex) default IIngredientreuse()default voidsetBurnTime(int time) Sets the burn time of this ingredient, for use in the furnace and other machinesdefault IIngredienttransform(IIngredientTransformer transformer) default IIngredienttransformCustom(String uid, Function<IItemStack, IItemStack> function) default IIngredienttransformDamage(int amount) default IIngredienttransformReplace(IItemStack replaceWith)
-
Field Details
-
INGREDIENT_ID
static final net.minecraft.resources.ResourceLocation INGREDIENT_ID -
CODEC
-
STREAM_CODEC
static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,IIngredient> STREAM_CODEC
-
-
Method Details
-
matches
Does the given stack match the ingredient?- Parameters:
stack- The stack to check- DocParam:
- stack invalid input: '<'item:minecraft:iron_ingot>
-
isEmpty
default boolean isEmpty()Checks if this ingredient is empty.- Returns:
- true if empty, false otherwise
-
contains
Does the ingredient contain the given ingredient?- Parameters:
ingredient- The ingredient to check- DocParam:
- ingredient (invalid input: '<'item:minecraft:iron_ingot> | invalid input: '<'item:minecraft:gold_ingot>)
-
asVanillaIngredient
net.minecraft.world.item.crafting.Ingredient asVanillaIngredient()Create a Vanilla ingredient matching this one. -
getRemainingItem
When this ingredient stack is crafted, what will remain in the grid? Does not check if the stack matches though! Used e.g. in Crafting Table recipes.- Parameters:
stack- The stack to provide for this ingredient.- DocParam:
- stack invalid input: '<'item:minecraft:iron_ingot>
-
getCommandString
String getCommandString()Returns the BEP to get this stack- Specified by:
getCommandStringin interfaceCommandStringDisplayable
-
getItems
IItemStack[] getItems() -
setBurnTime
default void setBurnTime(int time) Sets the burn time of this ingredient, for use in the furnace and other machines- Parameters:
time- the new burn time- DocParam:
- time 500
-
clearTooltip
default void clearTooltip(boolean leaveName) -
addTooltip
default void addTooltip(net.minecraft.network.chat.Component content) -
addShiftTooltip
default void addShiftTooltip(net.minecraft.network.chat.Component content, net.minecraft.network.chat.Component showMessage) -
modifyTooltip
-
modifyShiftTooltip
default void modifyShiftTooltip(ITooltipFunction shiftedFunction, ITooltipFunction unshiftedFunction) -
removeTooltip
-
addGlobalAttributeModifier
@Deprecated(forRemoval=true) default void addGlobalAttributeModifier(net.minecraft.world.entity.ai.attributes.Attribute attribute, net.minecraft.resources.ResourceLocation id, double value, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.This method no longer works and is deprecated, it is left in so it doesn't cause breaking changes. Please use Item Components instead. -
removeGlobalAttribute
@Deprecated(forRemoval=true) default void removeGlobalAttribute(net.minecraft.world.entity.ai.attributes.Attribute attribute, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.This method no longer works and is deprecated, it is left in so it doesn't cause breaking changes. Please use Item Components instead. -
removeGlobalAttributeModifier
@Deprecated(forRemoval=true) default void removeGlobalAttributeModifier(String uuid, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.This method no longer works and is deprecated, it is left in so it doesn't cause breaking changes. Please use Item Components instead. -
removeGlobalAttributeModifier
@Deprecated(forRemoval=true) default void removeGlobalAttributeModifier(UUID uuid, net.minecraft.world.entity.EquipmentSlot[] slotTypes) Deprecated, for removal: This API element is subject to removal in a future version.This method no longer works and is deprecated, it is left in so it doesn't cause breaking changes. Please use Item Components instead. -
fromIngredient
-
asMapData
-
asIData
-
or
-
mul
Use this in contexts where machines accept more than one item to state that fact. -
asIIngredientWithAmount
Used implicitly when a machine can accept more than one item but you only provide one. -
transformers
IngredientTransformers transformers() -
transformReplace
-
transformDamage
-
transformCustom
-
reuse
-
transform
-
conditions
IngredientConditions conditions() -
onlyDamaged
-
onlyDamagedAtLeast
-
onlyDamagedAtMost
-
anyDamage
-
onlyIf
-
condition
Use this if you already have the condition from another ingredient
-