diff --git a/docs/resources/server/recipes/custom.md b/docs/resources/server/recipes/custom.md index d3a5d392..ea5e67da 100644 --- a/docs/resources/server/recipes/custom.md +++ b/docs/resources/server/recipes/custom.md @@ -589,8 +589,8 @@ public class ClientRightClickBlockRecipes { public class RightClickBlockRecipes { // Make proxy method to access properly - public static RightClickBlockRecipeInputs inputs() { - return FMLEnvironment.dist == Dist.CLIENT + public static RightClickBlockRecipeInputs inputs(Level level) { + return level.isClientSide ? ClientRightClickBlockRecipes.inputs() : ServerRightClickBlockRecipes.inputs(); } @@ -612,7 +612,7 @@ public static void useItemOnBlock(UseItemOnBlockEvent event) { ItemStack itemStack = event.getItemStack(); // Check if the input can result in a recipe on both sides - if (!RightClickBlockRecipes.inputs().test(blockState, itemStack)) return; + if (!RightClickBlockRecipes.inputs(level).test(blockState, itemStack)) return; // If so, make sure on server before checking recipe if (!level.isClientSide() && level instanceof ServerLevel serverLevel) { diff --git a/docs/resources/server/recipes/index.md b/docs/resources/server/recipes/index.md index 22d66884..db2a11f4 100644 --- a/docs/resources/server/recipes/index.md +++ b/docs/resources/server/recipes/index.md @@ -39,7 +39,7 @@ A full list of types provided by Minecraft can be found in the [Built-In Recipe ## Using Recipes -Recipes are loaded, stored and obtained via the `RecipeManager` class, which is in turn obtained via `ServerLevel#recipeAccess` or - if you don't have a `ServerLevel` available - `ServerLifecycleHooks.getCurrentServer()#getRecipeManager`. The server does not sync the recipes to the client in their entirety instead it only sends the `RecipePropertySet`s for restricting inputs on menu slots and `RecipeDisplay`s via `RecipeDisplayEntry`s for the recipe book (excluding all recipes where `Recipe#isSpecial` returns true). All recipe logic should always run on the server. +Recipes are loaded, stored and obtained via the `RecipeManager` class, which is in turn obtained via `ServerLevel#recipeAccess` or - if you don't have a `ServerLevel` available - `ServerLifecycleHooks.getCurrentServer()#getRecipeManager`. The server does not sync the recipes to the client by default, instead it only sends the `RecipePropertySet`s for restricting inputs on menu slots. Additionally, whenever a recipe is unlocked for the recipe book, its `RecipeDisplay`s via `RecipeDisplayEntry`s are sent to the client (excluding all recipes where `Recipe#isSpecial` returns true) As such, recipe logic should always run on the server. The easiest way to get a recipe is by its resource key: