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
FieldsModifier and TypeFieldDescriptionprivate final String
private final net.minecraft.data.PackOutput
protected net.minecraft.core.HolderLookup.Provider
private final CompletableFuture
<net.minecraft.core.HolderLookup.Provider> private boolean
Fields inherited from interface net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, INDENT_WIDTH, KEY_COMPARATOR, LOGGER
-
Constructor Summary
ConstructorsConstructorDescriptionRecipePrioritiesProvider
(net.minecraft.data.PackOutput output, CompletableFuture<net.minecraft.core.HolderLookup.Provider> registries, String modid) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add
(net.minecraft.resources.ResourceKey<net.minecraft.world.item.crafting.Recipe> recipe, int priority) void
add
(net.minecraft.resources.ResourceLocation recipe, int priority) getName()
protected void
Sets the "replace" key in recipe_priorities to true.final CompletableFuture
<?> run
(net.minecraft.data.CachedOutput cache) protected CompletableFuture
<?> run
(net.minecraft.data.CachedOutput cache, net.minecraft.core.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
private final net.minecraft.data.PackOutput output -
registriesLookup
-
registries
protected net.minecraft.core.HolderLookup.Provider registries -
modid
-
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()Calladd(net.minecraft.resources.ResourceLocation, int)
here, which will pass in the necessary information to write the jsons. -
run
- Specified by:
run
in interfacenet.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
-
getName
- Specified by:
getName
in interfacenet.minecraft.data.DataProvider
-