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 Details

    • TYPED_CODEC

      static final com.mojang.serialization.Codec<IAdvancedIngredient<? super net.minecraft.world.item.ItemStack>> TYPED_CODEC
      Use instead.
    • 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)
      Specified by:
      test in interface Predicate<net.minecraft.world.item.ItemStack>
    • translate

      default net.minecraft.network.chat.Component translate(String postfix, Object... translationArgs)
    • translateSimple

      default net.minecraft.network.chat.Component translateSimple(Object... translationArgs)
    • translateInverse

      default net.minecraft.network.chat.Component translateInverse(Object... translationArgs)
    • 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: IForcingItemAdvancedIngredient
      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.
      Specified by:
      forceLootItemFunction in interface IForcingItemAdvancedIngredient
      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 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: IForcingItemAdvancedIngredient
      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.
      Specified by:
      forbidLootItemFunction in interface IForcingItemAdvancedIngredient
      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 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: IForcingItemAdvancedIngredient
      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.
      Specified by:
      forceTradeListing in interface IForcingItemAdvancedIngredient
      Parameters:
      tradeListing -
      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 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: IForcingItemAdvancedIngredient
      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.
      Specified by:
      forbidTradeListing in interface IForcingItemAdvancedIngredient
      Parameters:
      tradeListing -
      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.
    • getType

      INamedAdvancedIngredientType<net.minecraft.world.item.ItemStack> getType()
      Specified by:
      getType in interface IAdvancedIngredient<net.minecraft.world.item.ItemStack>