Refactor Fire Crafting Handler #749
Labels
No labels
Area-Assets
Area-Backend
Area-Conduits
Area-Datapacks
Area-Lang
Area-Mod Compat
Area-Parity
Area-Rendering
Good first issue
MC-1.19.2
MC-1.20.1
MC-1.20.4
MC-1.20.6
MC-1.21
MC-1.21.1
Modtoberfest
P-0-High
P-1-Medium
P-2-Low
Status-Awaiting Response
Status-Behind-Flag
Status-Blocked
Status-Cannot Reproduce
Status-Duplicate
Status-Help Wanted
Status-Incomplete Report
Status-Invalid
Status-Needs LTS Backport
Status-Needs Updating
Status-Stale
Status-To Implement
Status-Triage
Status-Wontfix
Status-Wontmerge
Type-Backport
Type-Bug
Type-Documentation
Type-Enhancement
Type-Question
Type-RFC
Type-Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Team-EnderIO/EnderIO#749
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Copying from HenryLoenwind's comment on #740:
I just had a look at the handler out of curiosity, and it looks a bit wasteful. (Also very much as I remember it, so this probably is my fault.)
I'd suggest a couple of changes:
65f3b09b23/enderio-base/src/main/java/com/enderio/base/common/handler/FireCraftingHandler.java (L70-L88)into a getMatchingRecipe() methodif (getMatchingRecipe() != null) { ...} return;insideif (isFire) {spawnInfinityDrops(...)with aif (getMatchingRecipe() instanceof FireCraftingRecipe matchingRecipe) {(orif ((FireCraftingRecipe matchingRecipe = getMatchingRecipe()) != null) {)// Grab useful fields.stuff inside the two if blocks just above where it's needed. Sadly this means duplicating it, but this is not an event to be picky---NeighborNotifyEvents are fired very often.if (FIRE_TRACKER.isEmpty() && !isFire) {now has no benefit anymore.And then ignore the complicated description above and look at what I cobbled up in a text editor: https://gist.github.com/HenryLoenwind/e276c7f437120011f1c84175496c531d
I think this would greatly reduce the time spent in this event handler.