Class RecipeSynchronization
java.lang.Object
net.fabricmc.fabric.api.recipe.v1.sync.RecipeSynchronization
Since Minecraft 1.21.2, vanilla no longer syncs all recipes to the client automatically,
opting into sending only required recipe book data.
This api can be used to enable Fabric's recipe sync for select RecipeSerializers,
which will synchronize recipes to the client.
See SynchronizedRecipes
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.IdentifierEvent phase used for sending recipes to the client. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsynchronizeRecipeSerializer(net.minecraft.world.item.crafting.RecipeSerializer<?> serializer) Enables synchronization of recipes to the client, for recipes that can be handled by the provided RecipeSerializer.
-
Field Details
-
RECIPE_SYNC_EVENT_PHASE
public static final net.minecraft.resources.Identifier RECIPE_SYNC_EVENT_PHASEEvent phase used for sending recipes to the client. It runs after the default event phaseEvent.DEFAULT_PHASE. It's defined forServerLifecycleEvents.SYNC_DATA_PACK_CONTENTSevent.
-
-
Method Details
-
synchronizeRecipeSerializer
public static void synchronizeRecipeSerializer(net.minecraft.world.item.crafting.RecipeSerializer<?> serializer) Enables synchronization of recipes to the client, for recipes that can be handled by the provided RecipeSerializer.Only add recipe serializers that are provided by your own mod or vanilla. Blindly adding unchecked recipe serializers might cause bugs and crashes.
This method should be called in the main mod initializer on both the client and the server.
- Parameters:
serializer- the recipe serializer used to synchronize recipes to the client.
-