You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (recipe.isBaseValid(baseBlock) && recipe.isDimensionValid(level.dimension())) {
matchingRecipe = recipe;
break;
}
}
if (matchingRecipe == null) {
return;
}
into a getMatchingRecipe() method
Put if (getMatchingRecipe() != null) { ...} return; inside if (isFire) {
Surround spawnInfinityDrops(...) with a if (getMatchingRecipe() instanceof FireCraftingRecipe matchingRecipe) { (or if ((FireCraftingRecipe matchingRecipe = getMatchingRecipe()) != null) {)
Move the // 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.
I think the if (FIRE_TRACKER.isEmpty() && !isFire) { now has no benefit anymore.
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:
EnderIO/enderio-base/src/main/java/com/enderio/base/common/handler/FireCraftingHandler.java
Lines 70 to 88 in 65f3b09
if (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.
The text was updated successfully, but these errors were encountered: