Class RecipePrioritiesProvider
java.lang.Object
net.neoforged.neoforge.common.data.RecipePrioritiesProvider
- All Implemented Interfaces:
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
DataProvider.Factory<T extends DataProvider>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final PackOutput
protected HolderLookup.Provider
private final CompletableFuture
<HolderLookup.Provider> private boolean
private final Map
<ResourceLocation, Integer> Fields inherited from interface net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, INDENT_WIDTH, KEY_COMPARATOR, LOGGER
-
Constructor Summary
ConstructorsConstructorDescriptionRecipePrioritiesProvider
(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, String modid) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add
(ResourceKey<Recipe> recipe, int priority) void
add
(ResourceLocation recipe, int priority) getName()
protected void
Sets the "replace" key in recipe_priorities to true.final CompletableFuture
<?> run
(CachedOutput cache) protected CompletableFuture
<?> run
(CachedOutput cache, HolderLookup.Provider registries) protected abstract void
start()
Calladd(net.minecraft.resources.ResourceLocation, int)
here, which will pass in the necessary information to write the jsons.
-
Field Details
-
output
-
registriesLookup
-
registries
-
modid
-
toSerialize
-
replace
private boolean replace
-
-
Constructor Details
-
RecipePrioritiesProvider
public RecipePrioritiesProvider(PackOutput output, CompletableFuture<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()Calladd(net.minecraft.resources.ResourceLocation, int)
here, which will pass in the necessary information to write the jsons. -
run
- Specified by:
run
in interfaceDataProvider
-
run
-
add
-
add
-
add
-
getName
- Specified by:
getName
in interfaceDataProvider
-