Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe use example missing how to get the RecipeManager #154

Closed
jcotton42 opened this issue Aug 19, 2024 · 1 comment · Fixed by #155
Closed

Recipe use example missing how to get the RecipeManager #154

jcotton42 opened this issue Aug 19, 2024 · 1 comment · Fixed by #155
Labels
incorrect Incorrect information.

Comments

@jcotton42
Copy link

In the code sample under https://docs.neoforged.net/docs/resources/server/recipes/#the-crafting-mechanic, the variable recipes is used without showing how to get it.

I asked on the Discord, got this response

oop, seems like a minor omission -- after the level.isClientSide check, you should be able to cast the level to a ServerLevel (directly or via instanceof pattern matching, whichever you feel better about) and then call getRecipeManager

@HenryLoenwind
Copy link
Contributor

Note that getRecipeManager() is on Level, not ServerLevel. However, the client-server handling in this example is not the best. Cancelling the event only on the server and letting it run on the client can cause all kinds of desyncs, depending on what happens next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incorrect Incorrect information.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants