Skip to content

Feat: Batch Recipe (Un)Registration Methods#13945

Open
JustAHuman-xD wants to merge 3 commits into
PaperMC:mainfrom
JustAHuman-xD:feat/batch-recipe-registration
Open

Feat: Batch Recipe (Un)Registration Methods#13945
JustAHuman-xD wants to merge 3 commits into
PaperMC:mainfrom
JustAHuman-xD:feat/batch-recipe-registration

Conversation

@JustAHuman-xD

Copy link
Copy Markdown
Contributor

Adds a few methods for batch registering & unregistering recipes to save on a LOT of tick time (and bandwidth when players are online) when compared to doing tons of add/remove recipe calls.

Also adds a hasRecipe method to avoid converting a bukkit recipe when its unnecessary.

In order to do this I extracted the creation of the minecraft recipe classes from the existing CraftRecipe#addToRecipeManager method to a new CraftRecipe#toMinecraftRecipe method, for use by the new methods. I also extracted the conversion of the bukkit recipe classes to the craft recipe classes to CraftRecipe.

In terms of performance improvements I was implementing this solution manually for a plugin I work on here: pylonmc/rebar#827 where you can see the differences

@JustAHuman-xD JustAHuman-xD requested a review from a team as a code owner June 8, 2026 18:12
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jun 8, 2026
Comment on lines -1473 to -1476
toAdd.addToRecipeManager();
// Paper start - API for updating recipes on clients
if (true || resendRecipes) { // Always needs to be resent now... TODO
this.playerList.reloadRecipes();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In case anyone is wondering why I removed this line, now MC will automatically do this whenever a recipe is added to the recipe manager so it was a double call for no reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

1 participant