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 Type
    Method
    Description
    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 given LootItemFunction so it does not conform to this IAdvancedIngredient.
    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 given VillagerTrades.ItemListing to a MerchantOffer whose output does not conform to this IAdvancedIngredient.
    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 given LootItemFunction to conform to this IAdvancedIngredient.
    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 given VillagerTrades.ItemListing to a MerchantOffer whose output conforms to this IAdvancedIngredient.
  • 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 given LootItemFunction to conform to this IAdvancedIngredient. This should not return an ItemStack which could not have been generated by the LootItemFunction naturally. It is not guaranteed that the returned ItemStack (if there is one) will conform, but this method should make a best effort.
      Parameters:
      function - The LootItemFunction being called. This will never be a SequenceFunction, as those are unpacked automatically. Also, if it is a LootItemConditionalFunction, then it will have already passed all conditions by the time this method is called.
      context -
      stack - The ItemStack to which the LootItemFunction is being applied
      Returns:
      Non-null Optional, filled if an ItemStack could be generated matching this IAdvancedIngredient, or empty if we could not force the output of the LootItemFunction successfully 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 given LootItemFunction so it does not conform to this IAdvancedIngredient. This should not return an ItemStack which could not have been generated by the LootItemFunction naturally. It is not guaranteed that the returned ItemStack (if there is one) won't conform, but this method should make a best effort.
      Parameters:
      function - The LootItemFunction being called. This will never be a SequenceFunction, as those are unpacked automatically. Also, if it is a LootItemConditionalFunction, then it will have already passed all conditions by the time this method is called.
      context -
      stack - The ItemStack to which the LootItemFunction is being applied
      Returns:
      Non-null Optional, filled if an ItemStack could be generated not matching this IAdvancedIngredient, or empty if we could not force the output of the LootItemFunction successfully 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 given VillagerTrades.ItemListing to a MerchantOffer whose output conforms to this IAdvancedIngredient. This should not generate a MerchantOffer which could not have been generated by the VillagerTrades.ItemListing naturally. It is not guaranteed that the result of the returned MerchantOffer (if there is one) will conform, but this method should make a best effort.
      Parameters:
      listing -
      trader -
      random -
      Returns:
      null if this IAdvancedIngredient could not generate a MerchantOffer with a matching result, an empty Optional if the VillagerTrades.ItemListing should generate no MerchantOffer at all (i.e. return null), or a filled Optional containing a MerchantOffer with 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 given VillagerTrades.ItemListing to a MerchantOffer whose output does not conform to this IAdvancedIngredient. This should not generate a MerchantOffer which could not have been generated by the VillagerTrades.ItemListing naturally. It is not guaranteed that the result of the returned MerchantOffer (if there is one) won't conform, but this method should make a best effort.
      Parameters:
      listing -
      trader -
      random -
      Returns:
      null if this IAdvancedIngredient could not generate a MerchantOffer with a non-matching result, an empty Optional if the VillagerTrades.ItemListing should generate no MerchantOffer at all (i.e. return null), or a filled Optional containing a MerchantOffer with a non-matching result.