Skip to content

Commit

Permalink
fix(docs): Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ChampionAsh5357 committed Nov 12, 2024
1 parent 1cd2cd9 commit 79f4be9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/resources/server/recipes/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/server/recipes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

1 comment on commit 79f4be9

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: 79f4be9a6ba4941b62ea00324df65b6ffa83fdb4
Status: ✅ Deploy successful!
Preview URL: https://c0d0d9af.neoforged-docs-previews.pages.dev
PR Preview URL: https://pr-178.neoforged-docs-previews.pages.dev

Please sign in to comment.