Class RecipePrioritiesProvider

java.lang.Object
net.neoforged.neoforge.common.data.RecipePrioritiesProvider
All Implemented Interfaces:
net.minecraft.data.DataProvider

public abstract class RecipePrioritiesProvider extends Object implements net.minecraft.data.DataProvider
Data Provider class for generating the recipe_priorities.json file and adding recipe priority overrides to it. These overrides allow a specified recipe to be given a certain load priority relative to another recipe, by providing the recipe ID and the integer representing the priority. All recipes are treated with a priority of 0 by default. Recipes assigned with higher priority values will take precedent over lower priority values when choosing what recipe result to provide in a crafting block. E.g. A recipe given the priority of 1 that has matching ingredients to a recipe with a priority of 0 will output its result instead of the result of the recipe with priority 0.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider

    net.minecraft.data.DataProvider.Factory<T extends net.minecraft.data.DataProvider>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
     
    private final net.minecraft.data.PackOutput
     
    protected net.minecraft.core.HolderLookup.Provider
     
    private final CompletableFuture<net.minecraft.core.HolderLookup.Provider>
     
    private boolean
     
    private final Map<net.minecraft.resources.ResourceLocation,Integer>
     

    Fields inherited from interface net.minecraft.data.DataProvider

    FIXED_ORDER_FIELDS, INDENT_WIDTH, KEY_COMPARATOR, LOGGER
  • Constructor Summary

    Constructors
    Constructor
    Description
    RecipePrioritiesProvider(net.minecraft.data.PackOutput output, CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries, String modid)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String recipe, int priority)
     
    void
    add(net.minecraft.resources.ResourceKey<net.minecraft.world.item.crafting.Recipe> recipe, int priority)
     
    void
    add(net.minecraft.resources.ResourceLocation recipe, int priority)
     
     
    protected void
    Sets the "replace" key in recipe_priorities to true.
    run(net.minecraft.data.CachedOutput cache)
     
    protected CompletableFuture<?>
    run(net.minecraft.data.CachedOutput cache, net.minecraft.core.HolderLookup.Provider registries)
     
    protected abstract void
    Call add(net.minecraft.resources.ResourceLocation, int) here, which will pass in the necessary information to write the jsons.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • output

      private final net.minecraft.data.PackOutput output
    • registriesLookup

      private final CompletableFuture<net.minecraft.core.HolderLookup.Provider> registriesLookup
    • registries

      protected net.minecraft.core.HolderLookup.Provider registries
    • modid

      private final String modid
    • toSerialize

      private final Map<net.minecraft.resources.ResourceLocation,Integer> toSerialize
    • replace

      private boolean replace
  • Constructor Details

    • RecipePrioritiesProvider

      public RecipePrioritiesProvider(net.minecraft.data.PackOutput output, CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries, String modid)
  • Method Details

    • replacing

      protected void replacing()
      Sets the "replace" key in recipe_priorities to true.
    • start

      protected abstract void start()
      Call add(net.minecraft.resources.ResourceLocation, int) here, which will pass in the necessary information to write the jsons.
    • run

      public final CompletableFuture<?> run(net.minecraft.data.CachedOutput cache)
      Specified by:
      run in interface net.minecraft.data.DataProvider
    • run

      protected CompletableFuture<?> run(net.minecraft.data.CachedOutput cache, net.minecraft.core.HolderLookup.Provider registries)
    • add

      public void add(net.minecraft.resources.ResourceLocation recipe, int priority)
    • add

      public void add(net.minecraft.resources.ResourceKey<net.minecraft.world.item.crafting.Recipe> recipe, int priority)
    • add

      public void add(String recipe, int priority)
    • getName

      public String getName()
      Specified by:
      getName in interface net.minecraft.data.DataProvider