Feat: Batch Recipe (Un)Registration Methods#13945
Open
JustAHuman-xD wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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