Package net.minecraft.recipe
Class RecipeManager
java.lang.Object
net.minecraft.resource.SinglePreparationResourceReloader<PreparedRecipes>
net.minecraft.recipe.RecipeManager
- All Implemented Interfaces:
StonecutterRecipes,ResourceReloader
public class RecipeManager
extends SinglePreparationResourceReloader<PreparedRecipes>
implements StonecutterRecipes
A recipe manager allows easier use of recipes, such as finding matches and
remainders. It is also integrated with a recipe loader, which loads recipes
from data packs' JSON files.
- Mappings:
Namespace Name named net/minecraft/recipe/RecipeManagerintermediary net/minecraft/class_1863official dcf
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic interfaceRecipeManager.MatchGetter<I extends RecipeInput,T extends Recipe<I>> Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<RecipeManager.class_10288> private Map<RegistryKey<Recipe<?>>, List<RecipeManager.class_10288>> private static final Loggerprivate PreparedRecipesprivate Map<RegistryKey<RecipePropertySet>, RecipePropertySet> private final RegistryWrapper.WrapperLookup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(PreparedRecipes preparedRecipes, ResourceManager resourceManager, Profiler profiler) Handles the prepared intermediate object.static <I extends RecipeInput,T extends Recipe<I>>
RecipeManager.MatchGetter<I, T> createCachedMatchGetter(RecipeType<T> type) Creates a cached match getter.protected static RecipeEntry<?> deserialize(RegistryKey<Recipe<?>> key, JsonObject json, RegistryWrapper.WrapperLookup registries) Reads a recipe from a JSON object.private static List<Ingredient> filterIngredients(FeatureSet features, List<Ingredient> ingredients) private <T extends Recipe<?>>
@Nullable RecipeEntry<T> get(RecipeType<T> type, RegistryKey<Recipe<?>> key) Returns a recipe with the givenidandtype, or empty if there is no such recipe.Optional<RecipeEntry<?>> get(RegistryKey<Recipe<?>> key) Returns a recipe with the givenid, or empty if there is no such recipe.<I extends RecipeInput,T extends Recipe<I>>
Optional<RecipeEntry<T>> getFirstMatch(RecipeType<T> type, I input, World world) Returns a recipe of the giventypethat match the giveninventoryandworld.<I extends RecipeInput,T extends Recipe<I>>
Optional<RecipeEntry<T>> getFirstMatch(RecipeType<T> type, I input, World world, @Nullable RecipeEntry<T> recipe) <I extends RecipeInput,T extends Recipe<I>>
Optional<RecipeEntry<T>> getFirstMatch(RecipeType<T> type, I input, World world, @Nullable RegistryKey<Recipe<?>> recipe) voidintitialize(FeatureSet features) private static booleanisEnabled(FeatureSet features, Ingredient ingredient) voidmethod_64679(RegistryKey<Recipe<?>> key, Consumer<class_10297> consumer) method_64686(class_10298 class_10298) private static List<RecipeManager.class_10288> method_64688(Iterable<RecipeEntry<?>> recipes, FeatureSet features) protected PreparedRecipesprepare(ResourceManager resourceManager, Profiler profiler) Prepares the intermediate object.values()Returns all recipes in this manager.Methods inherited from class net.minecraft.resource.SinglePreparationResourceReloader
reloadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.resource.ResourceReloader
getName
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGERLnet/minecraft/recipe/RecipeManager;LOGGER:Lorg/slf4j/Logger;intermediary field_9027Lnet/minecraft/class_1863;field_9027:Lorg/slf4j/Logger;official aLdcf;a:Lorg/slf4j/Logger;
-
registries
- Mappings:
Namespace Name Mixin selector named registriesLnet/minecraft/recipe/RecipeManager;registries:Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;intermediary field_54637Lnet/minecraft/class_1863;field_54637:Lnet/minecraft/class_7225$class_7874;official bLdcf;b:Ljs$a;
-
preparedRecipes
- Mappings:
Namespace Name Mixin selector named preparedRecipesLnet/minecraft/recipe/RecipeManager;preparedRecipes:Lnet/minecraft/recipe/PreparedRecipes;intermediary field_54638Lnet/minecraft/class_1863;field_54638:Lnet/minecraft/class_10289;official cLdcf;c:Ldcg;
-
propertySets
- Mappings:
Namespace Name Mixin selector named propertySetsLnet/minecraft/recipe/RecipeManager;propertySets:Ljava/util/Map;intermediary field_54639Lnet/minecraft/class_1863;field_54639:Ljava/util/Map;official dLdcf;d:Ljava/util/Map;
-
stonecutterRecipes
- Mappings:
Namespace Name Mixin selector named stonecutterRecipesLnet/minecraft/recipe/RecipeManager;stonecutterRecipes:Lnet/minecraft/recipe/display/CuttingRecipeDisplay$Grouping;intermediary field_54640Lnet/minecraft/class_1863;field_54640:Lnet/minecraft/class_10291$class_10293;official eLdcf;e:Ldcl$b;
-
field_54641
- Mappings:
Namespace Name Mixin selector named field_54641Lnet/minecraft/recipe/RecipeManager;field_54641:Ljava/util/List;intermediary field_54641Lnet/minecraft/class_1863;field_54641:Ljava/util/List;official fLdcf;f:Ljava/util/List;
-
field_54642
- Mappings:
Namespace Name Mixin selector named field_54642Lnet/minecraft/recipe/RecipeManager;field_54642:Ljava/util/Map;intermediary field_54642Lnet/minecraft/class_1863;field_54642:Ljava/util/Map;official gLdcf;g:Ljava/util/Map;
-
-
Constructor Details
-
RecipeManager
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/recipe/RecipeManager;<init>(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Vintermediary <init>Lnet/minecraft/class_1863;<init>(Lnet/minecraft/class_7225$class_7874;)Vofficial <init>Ldcf;<init>(Ljs$a;)V
-
-
Method Details
-
prepare
Description copied from class:SinglePreparationResourceReloaderPrepares the intermediate object.This method is called in the prepare executor in a reload.
- Specified by:
preparein classSinglePreparationResourceReloader<PreparedRecipes>- Parameters:
resourceManager- the resource managerprofiler- the prepare profiler- Returns:
- the prepared object
- Mappings:
Namespace Name Mixin selector named prepareLnet/minecraft/recipe/RecipeManager;prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Lnet/minecraft/recipe/PreparedRecipes;intermediary method_64680Lnet/minecraft/class_1863;method_64680(Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)Lnet/minecraft/class_10289;official aLdcf;a(Lavv;Lbpo;)Ldcg;
-
apply
protected void apply(PreparedRecipes preparedRecipes, ResourceManager resourceManager, Profiler profiler) Description copied from class:SinglePreparationResourceReloaderHandles the prepared intermediate object.This method is called in the apply executor, or the game engine, in a reload.
- Specified by:
applyin classSinglePreparationResourceReloader<PreparedRecipes>- Parameters:
preparedRecipes- the prepared objectresourceManager- the resource managerprofiler- the apply profiler- Mappings:
Namespace Name Mixin selector named applyLnet/minecraft/recipe/RecipeManager;apply(Lnet/minecraft/recipe/PreparedRecipes;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Vintermediary method_20705Lnet/minecraft/class_1863;method_20705(Lnet/minecraft/class_10289;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)Vofficial aLdcf;a(Ldcg;Lavv;Lbpo;)V
-
intitialize
- Mappings:
Namespace Name Mixin selector named intitializeLnet/minecraft/recipe/RecipeManager;intitialize(Lnet/minecraft/resource/featuretoggle/FeatureSet;)Vintermediary method_64681Lnet/minecraft/class_1863;method_64681(Lnet/minecraft/class_7699;)Vofficial aLdcf;a(Lcso;)V
-
filterIngredients
private static List<Ingredient> filterIngredients(FeatureSet features, List<Ingredient> ingredients) - Mappings:
Namespace Name Mixin selector named filterIngredientsLnet/minecraft/recipe/RecipeManager;filterIngredients(Lnet/minecraft/resource/featuretoggle/FeatureSet;Ljava/util/List;)Ljava/util/List;intermediary method_64683Lnet/minecraft/class_1863;method_64683(Lnet/minecraft/class_7699;Ljava/util/List;)Ljava/util/List;official aLdcf;a(Lcso;Ljava/util/List;)Ljava/util/List;
-
isEnabled
- Mappings:
Namespace Name Mixin selector named isEnabledLnet/minecraft/recipe/RecipeManager;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;Lnet/minecraft/recipe/Ingredient;)Zintermediary method_64682Lnet/minecraft/class_1863;method_64682(Lnet/minecraft/class_7699;Lnet/minecraft/class_1856;)Zofficial aLdcf;a(Lcso;Ldbv;)Z
-
getFirstMatch
public <I extends RecipeInput,T extends Recipe<I>> Optional<RecipeEntry<T>> getFirstMatch(RecipeType<T> type, I input, World world, @Nullable @Nullable RegistryKey<Recipe<?>> recipe) - Mappings:
Namespace Name Mixin selector named getFirstMatchLnet/minecraft/recipe/RecipeManager;getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;Lnet/minecraft/registry/RegistryKey;)Ljava/util/Optional;intermediary method_42299Lnet/minecraft/class_1863;method_42299(Lnet/minecraft/class_3956;Lnet/minecraft/class_9695;Lnet/minecraft/class_1937;Lnet/minecraft/class_5321;)Ljava/util/Optional;official aLdcf;a(Ldcj;Ldce;Ldha;Laly;)Ljava/util/Optional;
-
getFirstMatch
public <I extends RecipeInput,T extends Recipe<I>> Optional<RecipeEntry<T>> getFirstMatch(RecipeType<T> type, I input, World world, @Nullable @Nullable RecipeEntry<T> recipe) - Mappings:
Namespace Name Mixin selector named getFirstMatchLnet/minecraft/recipe/RecipeManager;getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;Lnet/minecraft/recipe/RecipeEntry;)Ljava/util/Optional;intermediary method_59993Lnet/minecraft/class_1863;method_59993(Lnet/minecraft/class_3956;Lnet/minecraft/class_9695;Lnet/minecraft/class_1937;Lnet/minecraft/class_8786;)Ljava/util/Optional;official aLdcf;a(Ldcj;Ldce;Ldha;Ldcd;)Ljava/util/Optional;
-
getFirstMatch
public <I extends RecipeInput,T extends Recipe<I>> Optional<RecipeEntry<T>> getFirstMatch(RecipeType<T> type, I input, World world) Returns a recipe of the giventypethat match the giveninventoryandworld.If there are multiple matching recipes, the result is arbitrary, but this method will return the same result unless the recipes in this manager are updated.
- Parameters:
type- the desired recipe typeworld- the input world- Returns:
- a recipe of the given
typethat match the giveninventoryandworld - Mappings:
Namespace Name Mixin selector named getFirstMatchLnet/minecraft/recipe/RecipeManager;getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;)Ljava/util/Optional;intermediary method_8132Lnet/minecraft/class_1863;method_8132(Lnet/minecraft/class_3956;Lnet/minecraft/class_9695;Lnet/minecraft/class_1937;)Ljava/util/Optional;official aLdcf;a(Ldcj;Ldce;Ldha;)Ljava/util/Optional;
-
get
Returns a recipe with the givenid, or empty if there is no such recipe.- Returns:
- a recipe with the given
id, or empty if there is no such recipe - Mappings:
Namespace Name Mixin selector named getLnet/minecraft/recipe/RecipeManager;get(Lnet/minecraft/registry/RegistryKey;)Ljava/util/Optional;intermediary method_8130Lnet/minecraft/class_1863;method_8130(Lnet/minecraft/class_5321;)Ljava/util/Optional;official bLdcf;b(Laly;)Ljava/util/Optional;
-
get
@Nullable private <T extends Recipe<?>> @Nullable RecipeEntry<T> get(RecipeType<T> type, RegistryKey<Recipe<?>> key) Returns a recipe with the givenidandtype, or empty if there is no such recipe.- Parameters:
type- the type of the desired recipe- Returns:
- a recipe with the given
idandtype, or empty if there is no such recipe - Mappings:
Namespace Name Mixin selector named getLnet/minecraft/recipe/RecipeManager;get(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/recipe/RecipeEntry;intermediary method_59821Lnet/minecraft/class_1863;method_59821(Lnet/minecraft/class_3956;Lnet/minecraft/class_5321;)Lnet/minecraft/class_8786;official aLdcf;a(Ldcj;Laly;)Ldcd;
-
getPropertySets
- Mappings:
Namespace Name Mixin selector named getPropertySetsLnet/minecraft/recipe/RecipeManager;getPropertySets()Ljava/util/Map;intermediary method_64692Lnet/minecraft/class_1863;method_64692()Ljava/util/Map;official bLdcf;b()Ljava/util/Map;
-
getStonecutterRecipeForSync
- Mappings:
Namespace Name Mixin selector named getStonecutterRecipeForSyncLnet/minecraft/recipe/RecipeManager;getStonecutterRecipeForSync()Lnet/minecraft/recipe/display/CuttingRecipeDisplay$Grouping;intermediary method_64694Lnet/minecraft/class_1863;method_64694()Lnet/minecraft/class_10291$class_10293;official dLdcf;d()Ldcl$b;
-
getPropertySet
- Specified by:
getPropertySetin interfaceStonecutterRecipes- Mappings:
Namespace Name Mixin selector named getPropertySetLnet/minecraft/recipe/StonecutterRecipes;getPropertySet(Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/recipe/RecipePropertySet;intermediary method_64678Lnet/minecraft/class_10286;method_64678(Lnet/minecraft/class_5321;)Lnet/minecraft/class_10290;official aLdca;a(Laly;)Ldch;
-
getStonecutterRecipes
- Specified by:
getStonecutterRecipesin interfaceStonecutterRecipes- Mappings:
Namespace Name Mixin selector named getStonecutterRecipesLnet/minecraft/recipe/StonecutterRecipes;getStonecutterRecipes()Lnet/minecraft/recipe/display/CuttingRecipeDisplay$Grouping;intermediary method_64677Lnet/minecraft/class_10286;method_64677()Lnet/minecraft/class_10291$class_10293;official aLdca;a()Ldcl$b;
-
values
Returns all recipes in this manager.The returned set does not update with the manager. Modifications to the returned set does not affect this manager.
- Returns:
- all recipes in this manager
- Mappings:
Namespace Name Mixin selector named valuesLnet/minecraft/recipe/RecipeManager;values()Ljava/util/Collection;intermediary method_8126Lnet/minecraft/class_1863;method_8126()Ljava/util/Collection;official eLdcf;e()Ljava/util/Collection;
-
method_64686
- Mappings:
Namespace Name Mixin selector named method_64686Lnet/minecraft/recipe/RecipeManager;method_64686(Lnet/minecraft/class_10298;)Lnet/minecraft/recipe/RecipeManager$class_10288;intermediary method_64686Lnet/minecraft/class_1863;method_64686(Lnet/minecraft/class_10298;)Lnet/minecraft/class_1863$class_10288;official aLdcf;a(Ldde;)Ldcf$b;
-
method_64679
- Mappings:
Namespace Name Mixin selector named method_64679Lnet/minecraft/recipe/RecipeManager;method_64679(Lnet/minecraft/registry/RegistryKey;Ljava/util/function/Consumer;)Vintermediary method_64679Lnet/minecraft/class_1863;method_64679(Lnet/minecraft/class_5321;Ljava/util/function/Consumer;)Vofficial aLdcf;a(Laly;Ljava/util/function/Consumer;)V
-
deserialize
protected static RecipeEntry<?> deserialize(RegistryKey<Recipe<?>> key, JsonObject json, RegistryWrapper.WrapperLookup registries) Reads a recipe from a JSON object.- Returns:
- the read recipe
- Throws:
JsonParseException- if the recipe JSON is invalid- Implementation Note:
- Even though a recipe's serializer
is stored in a
typefield in the JSON format and referred so in this method, its registry has keyminecraft:root/minecraft:recipe_serializerand is thus named. - Mappings:
Namespace Name Mixin selector named deserializeLnet/minecraft/recipe/RecipeManager;deserialize(Lnet/minecraft/registry/RegistryKey;Lcom/google/gson/JsonObject;Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/recipe/RecipeEntry;intermediary method_17720Lnet/minecraft/class_1863;method_17720(Lnet/minecraft/class_5321;Lcom/google/gson/JsonObject;Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_8786;official aLdcf;a(Laly;Lcom/google/gson/JsonObject;Ljs$a;)Ldcd;
-
createCachedMatchGetter
public static <I extends RecipeInput,T extends Recipe<I>> RecipeManager.MatchGetter<I,T> createCachedMatchGetter(RecipeType<T> type) Creates a cached match getter. This is optimized for getting matches of the same recipe repeatedly, such as furnaces.- Mappings:
Namespace Name Mixin selector named createCachedMatchGetterLnet/minecraft/recipe/RecipeManager;createCachedMatchGetter(Lnet/minecraft/recipe/RecipeType;)Lnet/minecraft/recipe/RecipeManager$MatchGetter;intermediary method_42302Lnet/minecraft/class_1863;method_42302(Lnet/minecraft/class_3956;)Lnet/minecraft/class_1863$class_7266;official aLdcf;a(Ldcj;)Ldcf$a;
-
method_64688
private static List<RecipeManager.class_10288> method_64688(Iterable<RecipeEntry<?>> recipes, FeatureSet features) - Mappings:
Namespace Name Mixin selector named method_64688Lnet/minecraft/recipe/RecipeManager;method_64688(Ljava/lang/Iterable;Lnet/minecraft/resource/featuretoggle/FeatureSet;)Ljava/util/List;intermediary method_64688Lnet/minecraft/class_1863;method_64688(Ljava/lang/Iterable;Lnet/minecraft/class_7699;)Ljava/util/List;official aLdcf;a(Ljava/lang/Iterable;Lcso;)Ljava/util/List;
-