Class HolderIngredientHelper<T,H extends HolderIngredientHelper.HolderHolder<T>>

java.lang.Object
petrolpark.mc.library.compat.jei.ingredient.HolderIngredientHelper<T,H>
All Implemented Interfaces:
mezz.jei.api.ingredients.IIngredientHelper<H>

@ParametersAreNonnullByDefault public class HolderIngredientHelper<T,H extends HolderIngredientHelper.HolderHolder<T>> extends Object implements mezz.jei.api.ingredients.IIngredientHelper<H>

An IIngredientHelper for data-pack registered objects. The type of the Helper and the associated IIngredientType should be subclass of HolderIngredientHelper.HolderHolder, which wraps a Holder of the data-registered object.

JEI sorts IIngredientTypes based on the Class of ingredient. Seeing as we want to preserve the Holder that wraps data-registered objects, but generic types are lost at runtime, we need to wrap the Holder, which is why we need this HolderHolder nonsense.
See Also:
  • Field Details

    • ingredientType

      public final mezz.jei.api.ingredients.IIngredientType<H extends HolderIngredientHelper.HolderHolder<T>> ingredientType
    • registryKey

      public final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registryKey
    • holderHolderer

      public final Function<net.minecraft.core.Holder<T>,H extends HolderIngredientHelper.HolderHolder<T>> holderHolderer
    • langKey

      public final String langKey
    • tagInfoRecipeType

      public final mezz.jei.api.recipe.RecipeType<mezz.jei.library.plugins.jei.tags.ITagInfoRecipe> tagInfoRecipeType
  • Constructor Details

    • HolderIngredientHelper

      public HolderIngredientHelper(mezz.jei.api.ingredients.IIngredientType<H> ingredientType, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registryKey, Function<net.minecraft.core.Holder<T>,H> holderHolderer)
    • HolderIngredientHelper

      public HolderIngredientHelper(mezz.jei.api.ingredients.IIngredientType<H> ingredientType, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> registryKey, Function<net.minecraft.core.Holder<T>,H> holderHolderer, String langKey)
  • Method Details

    • getIngredientType

      public mezz.jei.api.ingredients.IIngredientType<H> getIngredientType()
      Specified by:
      getIngredientType in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • getRegistry

      public net.minecraft.core.Registry<T> getRegistry()
    • getDisplayName

      public String getDisplayName(H ingredient)
      Specified by:
      getDisplayName in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • getDisplayNameComponent

      public net.minecraft.network.chat.Component getDisplayNameComponent(H ingredient)
    • getUniqueId

      public String getUniqueId(H ingredient, mezz.jei.api.ingredients.subtypes.UidContext context)
      Specified by:
      getUniqueId in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • getResourceLocation

      public net.minecraft.resources.ResourceLocation getResourceLocation(H ingredient)
      Specified by:
      getResourceLocation in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • copyIngredient

      public H copyIngredient(H ingredient)
      Specified by:
      copyIngredient in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • getErrorInfo

      public String getErrorInfo(@Nullable H ingredient)
      Specified by:
      getErrorInfo in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • getDisplayModId

      public String getDisplayModId(H ingredient)
      Specified by:
      getDisplayModId in interface mezz.jei.api.ingredients.IIngredientHelper<T>
    • codec

      public com.mojang.serialization.Codec<H> codec()
    • streamAll

      public Stream<H> streamAll()
    • registerTagInfoCategory

      public void registerTagInfoCategory(mezz.jei.api.registration.IRecipeCategoryRegistration registration)
    • addTagRecipes

      public void addTagRecipes(mezz.jei.api.registration.IRecipeRegistration registration)