Package net.minecraft.recipe
Class ServerRecipeManager
java.lang.Object
net.minecraft.resource.SinglePreparationResourceReloader<PreparedRecipes>
net.minecraft.recipe.ServerRecipeManager
- All Implemented Interfaces:
RecipeManager
,ResourceReloader
public class ServerRecipeManager
extends SinglePreparationResourceReloader<PreparedRecipes>
implements RecipeManager
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/ServerRecipeManager
intermediary net/minecraft/class_1863
official dck
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
ServerRecipeManager.MatchGetter<I extends RecipeInput,
T extends Recipe<I>> static class
static final record
static interface
Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final Logger
private PreparedRecipes
private Map
<RegistryKey<RecipePropertySet>, RecipePropertySet> private List
<ServerRecipeManager.ServerRecipe> private Map
<RegistryKey<Recipe<?>>, List<ServerRecipeManager.ServerRecipe>> private final RegistryWrapper.WrapperLookup
private static final Map
<RegistryKey<RecipePropertySet>, ServerRecipeManager.SoleIngredientGetter> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
apply
(PreparedRecipes preparedRecipes, ResourceManager resourceManager, Profiler profiler) Handles the prepared intermediate object.private static List
<ServerRecipeManager.ServerRecipe> collectServerRecipes
(Iterable<RecipeEntry<?>> recipes, FeatureSet enabledFeatures) Filters recipes byenabledFeatures
and assigns an integer ID to each recipe and recipe group.private static ServerRecipeManager.SoleIngredientGetter
cookingIngredientGetter
(RecipeType<? extends SingleStackRecipe> expectedType) static <I extends RecipeInput,
T extends Recipe<I>>
ServerRecipeManager.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.(package private) static List
<Ingredient> filterIngredients
(FeatureSet features, List<Ingredient> ingredients) void
forEachRecipeDisplay
(RegistryKey<Recipe<?>> key, Consumer<RecipeDisplayEntry> action) get
(NetworkRecipeId id) private <T extends Recipe<?>>
@Nullable RecipeEntry<T> get
(RecipeType<T> type, RegistryKey<Recipe<?>> key) Returns a recipe with the givenid
andtype
, 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 giventype
that match the giveninventory
andworld
.<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) void
initialize
(FeatureSet features) private static boolean
isEnabled
(FeatureSet features, Ingredient ingredient) protected PreparedRecipes
prepare
(ResourceManager resourceManager, Profiler profiler) Prepares the intermediate object.values()
Returns all recipes in this manager.Methods inherited from class net.minecraft.resource.SinglePreparationResourceReloader
reload
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.resource.ResourceReloader
getName
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGER
Lnet/minecraft/recipe/ServerRecipeManager;LOGGER:Lorg/slf4j/Logger;
intermediary field_9027
Lnet/minecraft/class_1863;field_9027:Lorg/slf4j/Logger;
official a
Ldck;a:Lorg/slf4j/Logger;
-
SOLE_INGREDIENT_GETTERS
private static final Map<RegistryKey<RecipePropertySet>,ServerRecipeManager.SoleIngredientGetter> SOLE_INGREDIENT_GETTERS- Mappings:
Namespace Name Mixin selector named SOLE_INGREDIENT_GETTERS
Lnet/minecraft/recipe/ServerRecipeManager;SOLE_INGREDIENT_GETTERS:Ljava/util/Map;
intermediary field_54897
Lnet/minecraft/class_1863;field_54897:Ljava/util/Map;
official b
Ldck;b:Ljava/util/Map;
-
registries
- Mappings:
Namespace Name Mixin selector named registries
Lnet/minecraft/recipe/ServerRecipeManager;registries:Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;
intermediary field_54637
Lnet/minecraft/class_1863;field_54637:Lnet/minecraft/class_7225$class_7874;
official c
Ldck;c:Ljs$a;
-
preparedRecipes
- Mappings:
Namespace Name Mixin selector named preparedRecipes
Lnet/minecraft/recipe/ServerRecipeManager;preparedRecipes:Lnet/minecraft/recipe/PreparedRecipes;
intermediary field_54638
Lnet/minecraft/class_1863;field_54638:Lnet/minecraft/class_10289;
official d
Ldck;d:Ldcl;
-
propertySets
- Mappings:
Namespace Name Mixin selector named propertySets
Lnet/minecraft/recipe/ServerRecipeManager;propertySets:Ljava/util/Map;
intermediary field_54639
Lnet/minecraft/class_1863;field_54639:Ljava/util/Map;
official e
Ldck;e:Ljava/util/Map;
-
stonecutterRecipes
- Mappings:
Namespace Name Mixin selector named stonecutterRecipes
Lnet/minecraft/recipe/ServerRecipeManager;stonecutterRecipes:Lnet/minecraft/recipe/display/CuttingRecipeDisplay$Grouping;
intermediary field_54640
Lnet/minecraft/class_1863;field_54640:Lnet/minecraft/class_10291$class_10293;
official f
Ldck;f:Ldcq$b;
-
recipes
- Mappings:
Namespace Name Mixin selector named recipes
Lnet/minecraft/recipe/ServerRecipeManager;recipes:Ljava/util/List;
intermediary field_54641
Lnet/minecraft/class_1863;field_54641:Ljava/util/List;
official g
Ldck;g:Ljava/util/List;
-
recipesByKey
- Mappings:
Namespace Name Mixin selector named recipesByKey
Lnet/minecraft/recipe/ServerRecipeManager;recipesByKey:Ljava/util/Map;
intermediary field_54642
Lnet/minecraft/class_1863;field_54642:Ljava/util/Map;
official h
Ldck;h:Ljava/util/Map;
-
-
Constructor Details
-
ServerRecipeManager
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/recipe/ServerRecipeManager;<init>(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)V
intermediary <init>
Lnet/minecraft/class_1863;<init>(Lnet/minecraft/class_7225$class_7874;)V
official <init>
Ldck;<init>(Ljs$a;)V
-
-
Method Details
-
prepare
Description copied from class:SinglePreparationResourceReloader
Prepares the intermediate object.This method is called in the prepare executor in a reload.
- Specified by:
prepare
in classSinglePreparationResourceReloader<PreparedRecipes>
- Parameters:
resourceManager
- the resource managerprofiler
- the prepare profiler- Returns:
- the prepared object
- Mappings:
Namespace Name Mixin selector named prepare
Lnet/minecraft/recipe/ServerRecipeManager;prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Lnet/minecraft/recipe/PreparedRecipes;
intermediary method_64680
Lnet/minecraft/class_1863;method_64680(Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)Lnet/minecraft/class_10289;
official a
Ldck;a(Lavv;Lbps;)Ldcl;
-
apply
protected void apply(PreparedRecipes preparedRecipes, ResourceManager resourceManager, Profiler profiler) Description copied from class:SinglePreparationResourceReloader
Handles the prepared intermediate object.This method is called in the apply executor, or the game engine, in a reload.
- Specified by:
apply
in classSinglePreparationResourceReloader<PreparedRecipes>
- Parameters:
preparedRecipes
- the prepared objectresourceManager
- the resource managerprofiler
- the apply profiler- Mappings:
Namespace Name Mixin selector named apply
Lnet/minecraft/recipe/ServerRecipeManager;apply(Lnet/minecraft/recipe/PreparedRecipes;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V
intermediary method_20705
Lnet/minecraft/class_1863;method_20705(Lnet/minecraft/class_10289;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)V
official a
Ldck;a(Ldcl;Lavv;Lbps;)V
-
initialize
- Mappings:
Namespace Name Mixin selector named initialize
Lnet/minecraft/recipe/ServerRecipeManager;initialize(Lnet/minecraft/resource/featuretoggle/FeatureSet;)V
intermediary method_64681
Lnet/minecraft/class_1863;method_64681(Lnet/minecraft/class_7699;)V
official a
Ldck;a(Lcss;)V
-
filterIngredients
- Mappings:
Namespace Name Mixin selector named filterIngredients
Lnet/minecraft/recipe/ServerRecipeManager;filterIngredients(Lnet/minecraft/resource/featuretoggle/FeatureSet;Ljava/util/List;)Ljava/util/List;
intermediary method_64683
Lnet/minecraft/class_1863;method_64683(Lnet/minecraft/class_7699;Ljava/util/List;)Ljava/util/List;
official a
Ldck;a(Lcss;Ljava/util/List;)Ljava/util/List;
-
isEnabled
- Mappings:
Namespace Name Mixin selector named isEnabled
Lnet/minecraft/recipe/ServerRecipeManager;isEnabled(Lnet/minecraft/resource/featuretoggle/FeatureSet;Lnet/minecraft/recipe/Ingredient;)Z
intermediary method_64682
Lnet/minecraft/class_1863;method_64682(Lnet/minecraft/class_7699;Lnet/minecraft/class_1856;)Z
official a
Ldck;a(Lcss;Ldbz;)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 getFirstMatch
Lnet/minecraft/recipe/ServerRecipeManager;getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;Lnet/minecraft/registry/RegistryKey;)Ljava/util/Optional;
intermediary method_42299
Lnet/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 a
Ldck;a(Ldco;Ldcj;Ldhh;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 getFirstMatch
Lnet/minecraft/recipe/ServerRecipeManager;getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;Lnet/minecraft/recipe/RecipeEntry;)Ljava/util/Optional;
intermediary method_59993
Lnet/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 a
Ldck;a(Ldco;Ldcj;Ldhh;Ldci;)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 giventype
that match the giveninventory
andworld
.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
type
that match the giveninventory
andworld
- Mappings:
Namespace Name Mixin selector named getFirstMatch
Lnet/minecraft/recipe/ServerRecipeManager;getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;)Ljava/util/Optional;
intermediary method_8132
Lnet/minecraft/class_1863;method_8132(Lnet/minecraft/class_3956;Lnet/minecraft/class_9695;Lnet/minecraft/class_1937;)Ljava/util/Optional;
official a
Ldck;a(Ldco;Ldcj;Ldhh;)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 get
Lnet/minecraft/recipe/ServerRecipeManager;get(Lnet/minecraft/registry/RegistryKey;)Ljava/util/Optional;
intermediary method_8130
Lnet/minecraft/class_1863;method_8130(Lnet/minecraft/class_5321;)Ljava/util/Optional;
official b
Ldck;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 givenid
andtype
, or empty if there is no such recipe.- Parameters:
type
- the type of the desired recipe- Returns:
- a recipe with the given
id
andtype
, or empty if there is no such recipe - Mappings:
Namespace Name Mixin selector named get
Lnet/minecraft/recipe/ServerRecipeManager;get(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/recipe/RecipeEntry;
intermediary method_59821
Lnet/minecraft/class_1863;method_59821(Lnet/minecraft/class_3956;Lnet/minecraft/class_5321;)Lnet/minecraft/class_8786;
official a
Ldck;a(Ldco;Laly;)Ldci;
-
getPropertySets
- Mappings:
Namespace Name Mixin selector named getPropertySets
Lnet/minecraft/recipe/ServerRecipeManager;getPropertySets()Ljava/util/Map;
intermediary method_64692
Lnet/minecraft/class_1863;method_64692()Ljava/util/Map;
official b
Ldck;b()Ljava/util/Map;
-
getStonecutterRecipeForSync
- Mappings:
Namespace Name Mixin selector named getStonecutterRecipeForSync
Lnet/minecraft/recipe/ServerRecipeManager;getStonecutterRecipeForSync()Lnet/minecraft/recipe/display/CuttingRecipeDisplay$Grouping;
intermediary method_64694
Lnet/minecraft/class_1863;method_64694()Lnet/minecraft/class_10291$class_10293;
official d
Ldck;d()Ldcq$b;
-
getPropertySet
- Specified by:
getPropertySet
in interfaceRecipeManager
- Mappings:
Namespace Name Mixin selector named getPropertySet
Lnet/minecraft/recipe/RecipeManager;getPropertySet(Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/recipe/RecipePropertySet;
intermediary method_64678
Lnet/minecraft/class_10286;method_64678(Lnet/minecraft/class_5321;)Lnet/minecraft/class_10290;
official a
Ldce;a(Laly;)Ldcm;
-
getStonecutterRecipes
- Specified by:
getStonecutterRecipes
in interfaceRecipeManager
- Mappings:
Namespace Name Mixin selector named getStonecutterRecipes
Lnet/minecraft/recipe/RecipeManager;getStonecutterRecipes()Lnet/minecraft/recipe/display/CuttingRecipeDisplay$Grouping;
intermediary method_64677
Lnet/minecraft/class_10286;method_64677()Lnet/minecraft/class_10291$class_10293;
official a
Ldce;a()Ldcq$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 values
Lnet/minecraft/recipe/ServerRecipeManager;values()Ljava/util/Collection;
intermediary method_8126
Lnet/minecraft/class_1863;method_8126()Ljava/util/Collection;
official e
Ldck;e()Ljava/util/Collection;
-
get
- Mappings:
Namespace Name Mixin selector named get
Lnet/minecraft/recipe/ServerRecipeManager;get(Lnet/minecraft/recipe/NetworkRecipeId;)Lnet/minecraft/recipe/ServerRecipeManager$ServerRecipe;
intermediary method_64686
Lnet/minecraft/class_1863;method_64686(Lnet/minecraft/class_10298;)Lnet/minecraft/class_1863$class_10288;
official a
Ldck;a(Lddk;)Ldck$d;
-
forEachRecipeDisplay
- Mappings:
Namespace Name Mixin selector named forEachRecipeDisplay
Lnet/minecraft/recipe/ServerRecipeManager;forEachRecipeDisplay(Lnet/minecraft/registry/RegistryKey;Ljava/util/function/Consumer;)V
intermediary method_64679
Lnet/minecraft/class_1863;method_64679(Lnet/minecraft/class_5321;Ljava/util/function/Consumer;)V
official a
Ldck;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
type
field in the JSON format and referred so in this method, its registry has keyminecraft:root/minecraft:recipe_serializer
and is thus named. - Mappings:
Namespace Name Mixin selector named deserialize
Lnet/minecraft/recipe/ServerRecipeManager;deserialize(Lnet/minecraft/registry/RegistryKey;Lcom/google/gson/JsonObject;Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/recipe/RecipeEntry;
intermediary method_17720
Lnet/minecraft/class_1863;method_17720(Lnet/minecraft/class_5321;Lcom/google/gson/JsonObject;Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_8786;
official a
Ldck;a(Laly;Lcom/google/gson/JsonObject;Ljs$a;)Ldci;
-
createCachedMatchGetter
public static <I extends RecipeInput,T extends Recipe<I>> ServerRecipeManager.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 createCachedMatchGetter
Lnet/minecraft/recipe/ServerRecipeManager;createCachedMatchGetter(Lnet/minecraft/recipe/RecipeType;)Lnet/minecraft/recipe/ServerRecipeManager$MatchGetter;
intermediary method_42302
Lnet/minecraft/class_1863;method_42302(Lnet/minecraft/class_3956;)Lnet/minecraft/class_1863$class_7266;
official a
Ldck;a(Ldco;)Ldck$a;
-
collectServerRecipes
private static List<ServerRecipeManager.ServerRecipe> collectServerRecipes(Iterable<RecipeEntry<?>> recipes, FeatureSet enabledFeatures) Filters recipes byenabledFeatures
and assigns an integer ID to each recipe and recipe group.- Mappings:
Namespace Name Mixin selector named collectServerRecipes
Lnet/minecraft/recipe/ServerRecipeManager;collectServerRecipes(Ljava/lang/Iterable;Lnet/minecraft/resource/featuretoggle/FeatureSet;)Ljava/util/List;
intermediary method_64688
Lnet/minecraft/class_1863;method_64688(Ljava/lang/Iterable;Lnet/minecraft/class_7699;)Ljava/util/List;
official a
Ldck;a(Ljava/lang/Iterable;Lcss;)Ljava/util/List;
-
cookingIngredientGetter
private static ServerRecipeManager.SoleIngredientGetter cookingIngredientGetter(RecipeType<? extends SingleStackRecipe> expectedType) - Mappings:
Namespace Name Mixin selector named cookingIngredientGetter
Lnet/minecraft/recipe/ServerRecipeManager;cookingIngredientGetter(Lnet/minecraft/recipe/RecipeType;)Lnet/minecraft/recipe/ServerRecipeManager$SoleIngredientGetter;
intermediary method_64992
Lnet/minecraft/class_1863;method_64992(Lnet/minecraft/class_3956;)Lnet/minecraft/class_1863$class_10357;
official b
Ldck;b(Ldco;)Ldck$c;
-