Interface IForcingItemAdvancedIngredient
- All Known Subinterfaces:
ItemAdvancedIngredient
- All Known Implementing Classes:
CompoundAdvancedIngredient,ContaminatedAdvancedIngredient,EnchantmentItemAdvancedIngredient,HolderSetItemAdvancedIngredient,ItemIDRegExAdvancedIngredient,ItemIngredientValueAdvancedIngredient,ItemItemAdvancedIngredient,NotAdvancedIngredient,TagItemAdvancedIngredient,TypeAttachedAdvancedIngredient
public interface IForcingItemAdvancedIngredient
-
Method Summary
Modifier and TypeMethodDescriptionOptional<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.Optional<net.minecraft.world.item.trading.MerchantOffer> forbidTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing listing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputdoes notconformto thisIAdvancedIngredient.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) Optional<net.minecraft.world.item.trading.MerchantOffer> forceTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing listing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt to force the output of the givenVillagerTrades.ItemListingto aMerchantOfferwhoseoutputconformsto thisIAdvancedIngredient.
-
Method Details
-
forceLootItemFunction
@Nonnull 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) Attempt 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.- 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 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. 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.- 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 Optional<net.minecraft.world.item.trading.MerchantOffer> forceTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing listing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt 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.- Parameters:
listing-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 Optional<net.minecraft.world.item.trading.MerchantOffer> forbidTradeListing(net.minecraft.world.entity.npc.VillagerTrades.ItemListing listing, net.minecraft.world.entity.Entity trader, net.minecraft.util.RandomSource random) Attempt 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.- Parameters:
listing-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.
-