Class RecipeManager
java.lang.Object
net.neoforged.neoforge.resource.ContextAwareReloadListener
net.minecraft.server.packs.resources.SimplePreparableReloadListener<RecipeMap>
net.minecraft.world.item.crafting.RecipeManager
- All Implemented Interfaces:
PreparableReloadListener, RecipeAccess
public class RecipeManager
extends SimplePreparableReloadListener<RecipeMap>
implements RecipeAccess
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRecipeManager.CachedCheck<I extends RecipeInput, T extends Recipe<I>>static classstatic interfacestatic final recordNested classes/interfaces inherited from interface PreparableReloadListener
PreparableReloadListener.PreparationBarrier, PreparableReloadListener.SharedState, PreparableReloadListener.StateKey<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<RecipeManager.ServerDisplayInfo> private static final org.slf4j.Loggerprivate Map<ResourceKey<RecipePropertySet>, RecipePropertySet> private static final FileToIdConverterprivate static final Map<ResourceKey<RecipePropertySet>, RecipeManager.IngredientExtractor> private it.unimi.dsi.fastutil.objects.Object2IntMap<ResourceKey<Recipe<?>>> private RecipeMapprivate Map<ResourceKey<Recipe<?>>, List<RecipeManager.ServerDisplayInfo>> private final HolderLookup.Provider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(RecipeMap recipes, ResourceManager manager, ProfilerFiller profiler) Optional<RecipeHolder<?>> byKey(ResourceKey<Recipe<?>> recipeId) private <T extends Recipe<?>>
@Nullable RecipeHolder<T> byKeyTyped(RecipeType<T> type, ResourceKey<Recipe<?>> recipeId) static <I extends RecipeInput, T extends Recipe<I>>
RecipeManager.CachedCheck<I, T> createCheck(RecipeType<T> type) private static List<Ingredient> filterDisabled(FeatureFlagSet enabledFlags, List<Ingredient> ingredients) voidfinalizeRecipeLoading(FeatureFlagSet enabledFlags) private static RecipeManager.IngredientExtractorforSingleInput(RecipeType<? extends SingleItemRecipe> type) protected static RecipeHolder<?> fromJson(ResourceKey<Recipe<?>> id, JsonObject object, HolderLookup.Provider registries) <I extends RecipeInput, T extends Recipe<I>>
Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level level) <I extends RecipeInput, T extends Recipe<I>>
Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level level, @Nullable ResourceKey<Recipe<?>> recipeHint) <I extends RecipeInput, T extends Recipe<I>>
Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level level, @Nullable RecipeHolder<T> recipeHint) @Nullable RecipeManager.ServerDisplayInfoprivate static booleanisIngredientEnabled(FeatureFlagSet enabledFlags, Ingredient ingredient) voidlistDisplaysForRecipe(ResourceKey<Recipe<?>> id, Consumer<RecipeDisplayEntry> output) protected RecipeMapprepare(ResourceManager manager, ProfilerFiller profiler) Performs any reloading that can be done off-thread, such as file IOvoidsetPriorityMap(it.unimi.dsi.fastutil.objects.Object2IntMap<ResourceKey<Recipe<?>>> recipePriorities) private static List<RecipeManager.ServerDisplayInfo> unpackRecipeInfo(Iterable<RecipeHolder<?>> recipes, FeatureFlagSet enabledFeatures) Methods inherited from class SimplePreparableReloadListener
reloadMethods inherited from class ContextAwareReloadListener
getContext, getRegistryLookup, injectContext, makeConditionalOps, makeConditionalOpsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PreparableReloadListener
getName, prepareSharedState
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
RECIPE_PROPERTY_SETS
private static final Map<ResourceKey<RecipePropertySet>, RecipeManager.IngredientExtractor> RECIPE_PROPERTY_SETS -
RECIPE_LISTER
-
registries
-
recipes
-
propertySets
-
stonecutterRecipes
-
allDisplays
-
recipeToDisplay
-
recipePriorities
-
-
Constructor Details
-
RecipeManager
-
-
Method Details
-
prepare
Description copied from class:SimplePreparableReloadListenerPerforms any reloading that can be done off-thread, such as file IO- Specified by:
preparein classSimplePreparableReloadListener<RecipeMap>
-
apply
- Specified by:
applyin classSimplePreparableReloadListener<RecipeMap>
-
finalizeRecipeLoading
-
filterDisabled
private static List<Ingredient> filterDisabled(FeatureFlagSet enabledFlags, List<Ingredient> ingredients) -
isIngredientEnabled
-
getRecipeFor
public <I extends RecipeInput, T extends Recipe<I>> Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level level, @Nullable ResourceKey<Recipe<?>> recipeHint) -
getRecipeFor
public <I extends RecipeInput, T extends Recipe<I>> Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level level, @Nullable RecipeHolder<T> recipeHint) -
getRecipeFor
public <I extends RecipeInput, T extends Recipe<I>> Optional<RecipeHolder<T>> getRecipeFor(RecipeType<T> type, I input, Level level) -
byKey
-
byKeyTyped
private <T extends Recipe<?>> @Nullable RecipeHolder<T> byKeyTyped(RecipeType<T> type, ResourceKey<Recipe<?>> recipeId) -
getSynchronizedItemProperties
-
getSynchronizedStonecutterRecipes
-
propertySet
- Specified by:
propertySetin interfaceRecipeAccess
-
stonecutterRecipes
- Specified by:
stonecutterRecipesin interfaceRecipeAccess
-
getRecipes
-
getRecipeFromDisplay
-
listDisplaysForRecipe
-
fromJson
protected static RecipeHolder<?> fromJson(ResourceKey<Recipe<?>> id, JsonObject object, HolderLookup.Provider registries) -
createCheck
public static <I extends RecipeInput, T extends Recipe<I>> RecipeManager.CachedCheck<I,T> createCheck(RecipeType<T> type) -
unpackRecipeInfo
private static List<RecipeManager.ServerDisplayInfo> unpackRecipeInfo(Iterable<RecipeHolder<?>> recipes, FeatureFlagSet enabledFeatures) -
forSingleInput
private static RecipeManager.IngredientExtractor forSingleInput(RecipeType<? extends SingleItemRecipe> type) -
recipeMap
-
setPriorityMap
public void setPriorityMap(it.unimi.dsi.fastutil.objects.Object2IntMap<ResourceKey<Recipe<?>>> recipePriorities)
-