Interface ItemAdvancedIngredient
- All Superinterfaces:
IAdvancedIngredient<net.minecraft.world.item.ItemStack>,IForcingItemAdvancedIngredient,ITypelessAdvancedIngredient<net.minecraft.world.item.ItemStack>,Predicate<net.minecraft.world.item.ItemStack>
- All Known Implementing Classes:
EnchantmentItemAdvancedIngredient,HolderSetItemAdvancedIngredient,ItemIDRegExAdvancedIngredient,ItemIngredientValueAdvancedIngredient,ItemItemAdvancedIngredient,TagItemAdvancedIngredient
public interface ItemAdvancedIngredient
extends IAdvancedIngredient<net.minecraft.world.item.ItemStack>, IForcingItemAdvancedIngredient
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> static final com.mojang.serialization.Codec<IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> Useinstead. -
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<net.minecraft.world.item.ItemStack> forbidLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Attempt to force the output of the givenLootItemFunctionso it does notconformto thisIAdvancedIngredient.default Optional<net.minecraft.world.item.trading.MerchantOffer> forbidTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputdoes notconformto thisIAdvancedIngredient.default Optional<net.minecraft.world.item.ItemStack> forceLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) default Optional<net.minecraft.world.item.trading.MerchantOffer> forceTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputconformsto thisIAdvancedIngredient.INamedAdvancedIngredientType<net.minecraft.world.item.ItemStack> getType()booleantest(net.minecraft.world.item.ItemStack stack) default net.minecraft.network.chat.Componentdefault net.minecraft.network.chat.ComponenttranslateInverse(Object... translationArgs) default net.minecraft.network.chat.ComponenttranslateSimple(Object... translationArgs) Methods inherited from interface com.petrolpark.core.recipe.ingredient.advanced.IAdvancedIngredient
simplifyMethods inherited from interface com.petrolpark.core.recipe.ingredient.advanced.ITypelessAdvancedIngredient
addToCounterDescription, addToDescription, checkedCast, modifyCounterExamples, modifyExamples, streamCounterExamples, streamExamples
-
Field Details
-
TYPED_CODEC
static final com.mojang.serialization.Codec<IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> TYPED_CODECUseinstead. -
CODEC
static final com.mojang.serialization.Codec<IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> CODEC -
STREAM_CODEC
static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> STREAM_CODEC
-
-
Method Details
-
test
boolean test(net.minecraft.world.item.ItemStack stack) -
translate
-
translateSimple
-
translateInverse
-
forceLootItemFunction
@Nonnull default Optional<net.minecraft.world.item.ItemStack> forceLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenLootItemFunctiontoconformto thisIAdvancedIngredient. This should not return an ItemStack which could not have been generated by theLootItemFunctionnaturally. It is not guaranteed that the returned ItemStack (if there is one) willconform, but this method should make a best effort.- Specified by:
forceLootItemFunctionin interfaceIForcingItemAdvancedIngredient- Parameters:
function- TheLootItemFunctionbeing called. This will never be aSequenceFunction, as those are unpacked automatically. Also, if it is aLootItemConditionalFunction, then it will have already passed all conditions by the time this method is called.context-stack- The ItemStack to which theLootItemFunctionis being applied- Returns:
- Non-
nullOptional, filled if an ItemStack could be generated matching thisIAdvancedIngredient, or empty if we could not force the output of theLootItemFunctionsuccessfully and it should be called as normal.
-
forbidLootItemFunction
@Nonnull default Optional<net.minecraft.world.item.ItemStack> forbidLootItemFunction(net.minecraft.world.level.storage.loot.functions.LootItemFunction function, net.minecraft.world.level.storage.loot.LootContext context, net.minecraft.world.item.ItemStack stack) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenLootItemFunctionso it does notconformto thisIAdvancedIngredient. This should not return an ItemStack which could not have been generated by theLootItemFunctionnaturally. It is not guaranteed that the returned ItemStack (if there is one) won'tconform, but this method should make a best effort.- Specified by:
forbidLootItemFunctionin interfaceIForcingItemAdvancedIngredient- Parameters:
function- TheLootItemFunctionbeing called. This will never be aSequenceFunction, as those are unpacked automatically. Also, if it is aLootItemConditionalFunction, then it will have already passed all conditions by the time this method is called.context-stack- The ItemStack to which theLootItemFunctionis being applied- Returns:
- Non-
nullOptional, filled if an ItemStack could be generated not matching thisIAdvancedIngredient, or empty if we could not force the output of theLootItemFunctionsuccessfully and it should be called as normal.
-
forceTradeListing
@Nullable default Optional<net.minecraft.world.item.trading.MerchantOffer> forceTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputconformsto thisIAdvancedIngredient. This should not generate aMerchantOfferwhich could not have been generated by theVillagerTrades.ItemListingnaturally. It is not guaranteed that the result of the returnedMerchantOffer(if there is one) willconform, but this method should make a best effort.- Specified by:
forceTradeListingin interfaceIForcingItemAdvancedIngredient- Parameters:
tradeListing-trader-random-- Returns:
nullif thisIAdvancedIngredientcould not generate aMerchantOfferwith a matching result, an empty Optional if theVillagerTrades.ItemListingshould generate noMerchantOfferat all (i.e.returnnull), or a filled Optional containing aMerchantOfferwith a matching result.
-
forbidTradeListing
@Nullable default Optional<net.minecraft.world.item.trading.MerchantOffer> forbidTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing tradeListing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Description copied from interface:IForcingItemAdvancedIngredientAttempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputdoes notconformto thisIAdvancedIngredient. This should not generate aMerchantOfferwhich could not have been generated by theVillagerTrades.ItemListingnaturally. It is not guaranteed that the result of the returnedMerchantOffer(if there is one) won'tconform, but this method should make a best effort.- Specified by:
forbidTradeListingin interfaceIForcingItemAdvancedIngredient- Parameters:
tradeListing-trader-random-- Returns:
nullif thisIAdvancedIngredientcould not generate aMerchantOfferwith a non-matching result, an empty Optional if theVillagerTrades.ItemListingshould generate noMerchantOfferat all (i.e.returnnull), or a filled Optional containing aMerchantOfferwith a non-matching result.
-
getType
INamedAdvancedIngredientType<net.minecraft.world.item.ItemStack> getType()- Specified by:
getTypein interfaceIAdvancedIngredient<net.minecraft.world.item.ItemStack>
-